objective 0.5.2 → 0.5.2.1
raw patch · 2 files changed
+13/−6 lines, 2 files
Files
- objective.cabal +2/−5
- src/Control/Monad/Objective/Class.hs +11/−1
objective.cabal view
@@ -1,8 +1,5 @@--- Initial objective.cabal generated by cabal init. For further --- documentation, see http://haskell.org/cabal/users-guide/ - name: objective -version: 0.5.2 +version: 0.5.2.1 synopsis: Extensible objects description: Stateful effect transducer homepage: https://github.com/fumieval/objective @@ -10,7 +7,7 @@ license-file: LICENSE author: Fumiaki Kinoshita maintainer: Fumiaki Kinoshita <fumiexcel@gmail.com> --- copyright: +copyright: Copyright (c) 2014 Fumiaki Kinoshita category: Control build-type: Simple extra-source-files:
src/Control/Monad/Objective/Class.hs view
@@ -23,10 +23,11 @@ import Control.Monad import Control.Elevator +import Control.Monad.Trans.State.Strict type Instance' e m = Instance e m m -class Monad m => MonadObjective m where +class (Tower m, Monad m) => MonadObjective m where data Instance (e :: * -> *) (n :: * -> *) m -- | Send a message to the pointed one. invoke :: Monad n => Instance e n m -> e a -> m (n (m a)) @@ -39,6 +40,7 @@ , MonadObjective m , Elevate m f) => Instance e n m -> e a -> f a a .- e = elevate $ invoke a e >>= join . elevate +{-# INLINE (.-) #-} infix 3 .- @@ -49,5 +51,13 @@ , MonadObjective m , Elevate m g) => Instance f n m -> e a -> g a a .^ e = a .- elevate e +{-# INLINE (.^) #-} infix 3 .^ + +-- | Specialized (.^) for StateT +(.&) :: (MonadObjective m, Elevate (StateT s m) e, Monad n, Elevate n m, Elevate m f) => Instance e n m -> StateT s m a -> f a +(.&) = (.^) +{-# INLINE (.&) #-} +infix 3 .& +