File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,7 @@ common test-deps
8686library
8787 import : deps
8888 exposed-modules :
89+ Control.Applicative.List
8990 Control.Monad.Bayes.Class
9091 Control.Monad.Bayes.Density.Free
9192 Control.Monad.Bayes.Density.State
@@ -114,8 +115,11 @@ library
114115 other-modules : Control.Monad.Bayes.Traced.Common
115116 default-language : Haskell2010
116117 default-extensions :
118+ ApplicativeDo
117119 BlockArguments
120+ DerivingStrategies
118121 FlexibleContexts
122+ GeneralizedNewtypeDeriving
119123 ImportQualifiedPost
120124 LambdaCase
121125 OverloadedStrings
Original file line number Diff line number Diff line change 1+ module Control.Applicative.List where
2+
3+ -- base
4+
5+ import Control.Applicative
6+ import Data.Functor.Compose
7+
8+ -- | _Applicative_ transformer adding a list/nondeterminism/choice effect.
9+ -- It is not a valid monad transformer, but it is a valid 'Applicative'.
10+ newtype ListT m a = ListT { getListT :: Compose [] m a }
11+ deriving newtype (Functor , Applicative , Alternative )
12+
13+ lift :: m a -> ListT m a
14+ lift = ListT . Compose . pure
15+
16+ runListT :: ListT m a -> [m a ]
17+ runListT = getCompose . getListT
You can’t perform that action at this time.
0 commit comments