operational 0.2.3.2 → 0.2.3.3
raw patch · 8 files changed
+55/−45 lines, 8 filesdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
- Control.Monad.Operational: (:>>=) :: instr b -> (b -> ProgramT instr m a) -> ProgramViewT instr m a
- Control.Monad.Operational: Return :: a -> ProgramViewT instr m a
- Control.Monad.Operational: instance Monad m => Applicative (ProgramT instr m)
- Control.Monad.Operational: instance Monad m => Functor (ProgramT instr m)
- Control.Monad.Operational: instance Monad m => Monad (ProgramT instr m)
- Control.Monad.Operational: instance MonadIO m => MonadIO (ProgramT instr m)
- Control.Monad.Operational: instance MonadReader r m => MonadReader r (ProgramT instr m)
- Control.Monad.Operational: instance MonadState s m => MonadState s (ProgramT instr m)
- Control.Monad.Operational: instance MonadTrans (ProgramT instr)
+ Control.Monad.Operational: [:>>=] :: instr b -> (b -> ProgramT instr m a) -> ProgramViewT instr m a
+ Control.Monad.Operational: [Return] :: a -> ProgramViewT instr m a
+ Control.Monad.Operational: instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Control.Monad.Operational.ProgramT instr m)
+ Control.Monad.Operational: instance Control.Monad.Reader.Class.MonadReader r m => Control.Monad.Reader.Class.MonadReader r (Control.Monad.Operational.ProgramT instr m)
+ Control.Monad.Operational: instance Control.Monad.State.Class.MonadState s m => Control.Monad.State.Class.MonadState s (Control.Monad.Operational.ProgramT instr m)
+ Control.Monad.Operational: instance Control.Monad.Trans.Class.MonadTrans (Control.Monad.Operational.ProgramT instr)
+ Control.Monad.Operational: instance GHC.Base.Monad m => GHC.Base.Applicative (Control.Monad.Operational.ProgramT instr m)
+ Control.Monad.Operational: instance GHC.Base.Monad m => GHC.Base.Functor (Control.Monad.Operational.ProgramT instr m)
+ Control.Monad.Operational: instance GHC.Base.Monad m => GHC.Base.Monad (Control.Monad.Operational.ProgramT instr m)
- Control.Monad.Operational: interpretWithMonad :: Monad m => (forall a. instr a -> m a) -> (Program instr b -> m b)
+ Control.Monad.Operational: interpretWithMonad :: forall instr m b. Monad m => (forall a. instr a -> m a) -> (Program instr b -> m b)
Files
- CHANGELOG +0/−35
- CHANGELOG.md +43/−0
- doc/examples/ListT.hs +1/−1
- doc/examples/LogicT.hs +1/−0
- doc/examples/PoorMansConcurrency.hs +1/−0
- doc/proofs.md +1/−1
- operational.cabal +4/−4
- src/Control/Monad/Operational.hs +4/−4
− CHANGELOG
@@ -1,35 +0,0 @@-Changelog------------operational - 0.2.3.1--* bump dependency `mtl >= 1.1 && < 2.3`.--operational - 0.2.3.0--* added instance for `MonadReader` class-* clean up documentation--operational - 0.2.2.0--* add utility function `interpretWithMonad`--operational - 0.2.1.0--* minor change: eta-reduce `Program` and `ProgramView` type synonyms--operational - 0.2.0.3--* moved project repository to github--operational - 0.2.0.0--* changed name of view type to `ProgramView`-* added instances for mtl classes-* new function `liftProgram` to embed `Program` in `ProgramT`-* new example `TicTacToe.hs`-* various documentation updates--operational - 0.1.0.0--* initial release
+ CHANGELOG.md view
@@ -0,0 +1,43 @@+Changelog for the `operational` package+---------------------------------------++**0.2.3.3** -- Maintenance release.++* Minor fixes to documentation and examples++**0.2.3.2** -- Maintenance release.++* Bump `mtl` dependency to allow 2.3++**0.2.3.1** -- Maintenance release.++* Bump `mtl` dependency to allow 2.2++**0.2.3.0** -- Maintenance release.++* added instance for `MonadReader` class+* clean up documentation++**0.2.2.0** -- Feature release.++* add utility function `interpretWithMonad`++**0.2.1.0** -- Maintenance release.++* minor change: eta-reduce `Program` and `ProgramView` type synonyms++**0.2.0.3** -- Maintenance release.++* moved project repository to github++**0.2.0.0** -- Feature release.++* changed name of view type to `ProgramView`+* added instances for mtl classes+* new function `liftProgram` to embed `Program` in `ProgramT`+* new example `TicTacToe.hs`+* various documentation updates++**0.1.0.0**++* initial release
doc/examples/ListT.hs view
@@ -47,7 +47,7 @@ -- testing the monad laws, from the Haskellwiki- -- http://www.haskell.org/haskellwiki/ListT_done_right#Order_of_printing+ -- http://wiki.haskell.org/ListT_done_right#Order_of_printing a,b,c :: ListT IO () [a,b,c] = map (lift . putChar) ['a','b','c']
doc/examples/LogicT.hs view
@@ -47,6 +47,7 @@ where -- apply the laws for msplit eval :: Monad m => ProgramViewT (MPlus m) m a -> m (Maybe (a, LogicT m a))+ eval (Return v) = return (Just (v, mzero)) eval (MZero :>>= k) = return Nothing eval (MPlus m n :>>= k) = do ma <- split (m >>= k)
doc/examples/PoorMansConcurrency.hs view
@@ -42,6 +42,7 @@ runProcess m = schedule [m] where schedule :: Monad m => [Process m a] -> m ()+ schedule [] = return () schedule (x:xs) = run (view x) xs run :: Monad m => ProgramView (ProcessI m) a -> [Process m a] -> m ()
doc/proofs.md view
@@ -45,7 +45,7 @@ instance Monad (NF instr) where return = Return' (Return' a) >>= k = k a- (m :>>=' g) >>= k = m :>>=' (\a -> g a :>>=' k)+ (m :>>=' g) >>= k = m :>>=' (\a -> g a >>= k) In particular, it fulfills the monad laws. (Actually we would have to prove that by using coinduction, but I leave that as an exercise.)
operational.cabal view
@@ -1,5 +1,5 @@ Name: operational-Version: 0.2.3.2+Version: 0.2.3.3 Synopsis: Implementation of difficult monads made easy with operational semantics. Description:@@ -7,7 +7,7 @@ . This is useful for: writing web applications in a sequential style, programming games with a uniform interface for human and AI players and easy replay capababilities, implementing fast parser monads, designing monadic DSLs, etc. .- See the project homepage <http://haskell.org/haskellwiki/Operational> for a more detailed introduction and features.+ See the project homepage <http://wiki.haskell.org/Operational> for a more detailed introduction and features. . Related packages: MonadPrompt <http://hackage.haskell.org/package/MonadPrompt>. @@ -17,12 +17,12 @@ Author: Heinrich Apfelmus Maintainer: Heinrich Apfelmus <apfelmus quantentunnel de> Copyright: (c) Heinrich Apfelmus 2010-2013-Homepage: http://haskell.org/haskellwiki/Operational+Homepage: http://wiki.haskell.org/Operational Stability: Provisional build-type: Simple cabal-version: >= 1.6-extra-source-files: CHANGELOG+extra-source-files: CHANGELOG.md doc/*.md doc/examples/*.hs doc/examples/*.lhs
src/Control/Monad/Operational.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE GADTs, Rank2Types, ScopedTypeVariables #-}+{-# LANGUAGE GADTSyntax, ExistentialQuantification, Rank2Types, ScopedTypeVariables #-} {-# LANGUAGE UndecidableInstances, MultiParamTypeClasses, FlexibleInstances #-} -- Search for UndecidableInstances to see why this is needed @@ -175,7 +175,7 @@ > eval (Pop :>>= is) (a:stack) = interpret (is a ) stack > eval (Return a) stack = a -Note that since 'ProgramView' is a GADT, the type annotation for @eval@ is mandatory.+In this example, the type signature for the `eval` helper function is optional. -} @@ -284,7 +284,7 @@ > eval (Plus m n :>>= k) = > liftM2 (++) (runList (m >>= k)) (runList (n >>= k)) -Note that since 'ProgramView' is a GADT, the type annotation for @eval@ is mandatory.+In this example, the type signature for the `eval` helper function is optional. -} @@ -311,5 +311,5 @@ local r (Lift m) = Lift (local r m) local r (m `Bind` k) = local r m `Bind` (local r . k)- local r (Instr i) = Instr i+ local _ (Instr i) = Instr i