packages feed

contstuff 0.4.0 → 0.4.1

raw patch · 2 files changed

+28/−21 lines, 2 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Control.ContStuff: instance (LiftBase m a, Monad m) => LiftBase (ChoiceT r i m) a
- Control.ContStuff: instance (LiftBase m a, Monad m) => LiftBase (ContT r m) a
- Control.ContStuff: instance (LiftBase m a, Monad m) => LiftBase (EitherT r e m) a
- Control.ContStuff: instance (LiftBase m a, Monad m) => LiftBase (IdT m) a
- Control.ContStuff: instance (LiftBase m a, Monad m) => LiftBase (StateT r s m) a
- Control.ContStuff: instance LiftBase ((->) r) a
- Control.ContStuff: instance LiftBase (ST s) a
- Control.ContStuff: instance LiftBase IO a
- Control.ContStuff: instance LiftBase Id a
- Control.ContStuff: instance LiftBase Maybe a
- Control.ContStuff: instance LiftBase [] a
+ Control.ContStuff: instance (Applicative m) => Abortable (ChoiceT r i m)
+ Control.ContStuff: instance (LiftBase m, Monad m) => LiftBase (ChoiceT r i m)
+ Control.ContStuff: instance (LiftBase m, Monad m) => LiftBase (ContT r m)
+ Control.ContStuff: instance (LiftBase m, Monad m) => LiftBase (EitherT r e m)
+ Control.ContStuff: instance (LiftBase m, Monad m) => LiftBase (IdT m)
+ Control.ContStuff: instance (LiftBase m, Monad m) => LiftBase (StateT r s m)
+ Control.ContStuff: instance (Show a) => Show (Id a)
+ Control.ContStuff: instance LiftBase ((->) r)
+ Control.ContStuff: instance LiftBase (ST s)
+ Control.ContStuff: instance LiftBase IO
+ Control.ContStuff: instance LiftBase Id
+ Control.ContStuff: instance LiftBase Maybe
+ Control.ContStuff: instance LiftBase []
- Control.ContStuff: base :: (LiftBase m a) => Base m a -> m a
+ Control.ContStuff: base :: (LiftBase m) => Base m a -> m a
- Control.ContStuff: class LiftBase m a where { type family Base m a; }
+ Control.ContStuff: class LiftBase m where { type family Base m :: * -> *; }
- Control.ContStuff: io :: (LiftBase m a, (Base m a) ~ (IO a)) => Base m a -> m a
+ Control.ContStuff: io :: (LiftBase m, (Base m) ~ IO) => Base m a -> m a

Files

Control/ContStuff.hs view
@@ -99,7 +99,10 @@ instance MonadFix Id where   mfix f = fix (f . getId) +instance Show a => Show (Id a) where+  show x = "Id " ++ show x + -- ================== -- -- Monad transformers -- -- ================== --@@ -120,6 +123,9 @@                 -> (i -> m r)                 -> m r } +instance Applicative m => Abortable (ChoiceT r i m) where+  type Result (ChoiceT r i m) = r+  abort x = ChoiceT $ \_ _ _ -> pure x  instance Alternative (ChoiceT r i m) where   empty = ChoiceT $ \_ z k -> k z@@ -721,35 +727,36 @@  -- | Monads, which support lifting base monad computations. -class LiftBase m a where+class LiftBase m where   -- | Base monad of @m@.-  type Base m a+  type Base m :: * -> *    -- | Promote a base monad computation.   base :: Base m a -> m a -instance LiftBase IO a where type Base IO a = IO a; base = id-instance LiftBase Id a where type Base Id a = Id a; base = id-instance LiftBase Maybe a where type Base Maybe a = Maybe a; base = id-instance LiftBase (ST s) a where type Base (ST s) a = ST s a; base = id-instance LiftBase [] a where type Base [] a = [a]; base = id-instance LiftBase ((->) r) a where type Base ((->) r) a = r -> a; base = id -instance (LiftBase m a, Monad m) => LiftBase (IdT m) a where-  type Base (IdT m) a = Base m a; base = lift . base-instance (LiftBase m a, Monad m) => LiftBase (ChoiceT r i m) a where-  type Base (ChoiceT r i m) a = Base m a; base = lift . base-instance (LiftBase m a, Monad m) => LiftBase (ContT r m) a where-  type Base (ContT r m) a = Base m a; base = lift . base-instance (LiftBase m a, Monad m) => LiftBase (EitherT r e m) a where-  type Base (EitherT r e m) a = Base m a; base = lift . base-instance (LiftBase m a, Monad m) => LiftBase (StateT r s m) a where-  type Base (StateT r s m) a = Base m a; base = lift . base+instance LiftBase IO where type Base IO = IO; base = id+instance LiftBase Id where type Base Id = Id; base = id+instance LiftBase Maybe where type Base Maybe = Maybe; base = id+instance LiftBase (ST s) where type Base (ST s) = ST s; base = id+instance LiftBase [] where type Base [] = []; base = id+instance LiftBase ((->) r) where type Base ((->) r) = (->) r; base = id +instance (LiftBase m, Monad m) => LiftBase (IdT m) where+  type Base (IdT m) = Base m; base = lift . base+instance (LiftBase m, Monad m) => LiftBase (ChoiceT r i m) where+  type Base (ChoiceT r i m) = Base m; base = lift . base+instance (LiftBase m, Monad m) => LiftBase (ContT r m) where+  type Base (ContT r m) = Base m; base = lift . base+instance (LiftBase m, Monad m) => LiftBase (EitherT r e m) where+  type Base (EitherT r e m) = Base m; base = lift . base+instance (LiftBase m, Monad m) => LiftBase (StateT r s m) where+  type Base (StateT r s m) = Base m; base = lift . base --- | Handy alias for lifting IO computations. -io :: (LiftBase m a, Base m a ~ IO a) => Base m a -> m a+-- | Handy alias for lifting 'IO' computations.++io :: (LiftBase m, Base m ~ IO) => Base m a -> m a io = base  
contstuff.cabal view
@@ -1,5 +1,5 @@ Name:          contstuff-Version:       0.4.0+Version:       0.4.1 Category:      Control, Monads Synopsis:      Easy to use CPS-based monads Maintainer:    Ertugrul Söylemez <es@ertes.de>