diff options
author | Griffin Smith <grfn@gws.fyi> | 2021-06-13T14·20-0400 |
---|---|---|
committer | grfn <grfn@gws.fyi> | 2021-06-14T13·04+0000 |
commit | efbb135cfc0511ffcd350def9e9e5efcfc7e887c (patch) | |
tree | c6bb00ca465c9d65e056b603c74f0cacaf0eb39d /users/grfn/xanthous/src/Xanthous/Random.hs | |
parent | 2cfe4069bb9b46778d737f5ca535edcb9993f356 (diff) |
feat(xanthous): Extend speech generation to arbitrary words r/2657
Wrap up the Phonotactics type into a Language type including both the phonotactics and a distribution of the number of syllables per word, so we can generate arbitrary words in addition to just arbitrary syllables Change-Id: I8a37ce9c0eec019c9b84d21b0f2b3b9f5fd319eb Reviewed-on: https://cl.tvl.fyi/c/depot/+/3203 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
Diffstat (limited to 'users/grfn/xanthous/src/Xanthous/Random.hs')
-rw-r--r-- | users/grfn/xanthous/src/Xanthous/Random.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/users/grfn/xanthous/src/Xanthous/Random.hs b/users/grfn/xanthous/src/Xanthous/Random.hs index d97dcb9e1175..72bdb63d2c61 100644 --- a/users/grfn/xanthous/src/Xanthous/Random.hs +++ b/users/grfn/xanthous/src/Xanthous/Random.hs @@ -1,5 +1,6 @@ -------------------------------------------------------------------------------- {-# LANGUAGE UndecidableInstances #-} +{-# LANGUAGE StandaloneDeriving #-} {-# OPTIONS_GHC -fno-warn-orphans #-} -------------------------------------------------------------------------------- module Xanthous.Random @@ -74,6 +75,10 @@ instance Choose (a, a) where newtype Weighted w t a = Weighted (t (w, a)) deriving (Functor, Foldable) via (t `Compose` (,) w) +deriving newtype instance Eq (t (w, a)) => Eq (Weighted w t a) +deriving newtype instance Show (t (w, a)) => Show (Weighted w t a) +deriving newtype instance NFData (t (w, a)) => NFData (Weighted w t a) + instance Traversable t => Traversable (Weighted w t) where traverse f (Weighted twa) = Weighted <$> (traverse . traverse) f twa |