functor-monad-0.1.1.1: FFunctor: functors on (the usual) Functors
Safe HaskellSafe-Inferred
LanguageHaskell2010

FMonad.FreeT

Description

Another way to make FreeT an instance of FMonad

FreeT can be FMonad in two different ways. There is already an instance:

instance Functor f => FMonad (FreeT f) where
  fpure :: Functor m => m ~> FreeT f m
  fbind :: (Functor m, Functor n) => (m ~> FreeT f n) -> (FreeT f m ~> FreeT f n)

In addition to this standard instance, FreeT f m have FMonad-like structure by treating f as the parameter while fixing m to some arbitrary Monad.

fpureFst :: (Monad m) => (Functor f) => f ~> FreeT f m
fbindFst :: (Monad m) => (Functor f, Functor g) => (f ~> FreeT g m) -> (FreeT f m ~> FreeT g m)

This module provides a newtype wrapper FreeT' to use these as a real FMonad instance.

Synopsis

Documentation

newtype FreeT' m f b Source #

FreeT' is a FreeT, but with the order of its arguments flipped.

FreeT' m f a ≡ FreeT f m a

Constructors

WrapFreeT' 

Fields

Instances

Instances details
Functor m => FFunctor (FreeT' m) Source # 
Instance details

Defined in FMonad.FreeT

Methods

ffmap :: forall (g :: Type -> Type) (h :: Type -> Type) x. (Functor g, Functor h) => (g ~> h) -> FreeT' m g x -> FreeT' m h x Source #

Monad m => FMonad (FreeT' m) Source # 
Instance details

Defined in FMonad.FreeT

Methods

fpure :: forall (g :: Type -> Type). Functor g => g ~> FreeT' m g Source #

fbind :: forall (g :: Type -> Type) (h :: Type -> Type) a. (Functor g, Functor h) => (g ~> FreeT' m h) -> FreeT' m g a -> FreeT' m h a Source #

(Foldable m, Foldable f) => Foldable (FreeT' m f) Source # 
Instance details

Defined in FMonad.FreeT

Methods

fold :: Monoid m0 => FreeT' m f m0 -> m0 #

foldMap :: Monoid m0 => (a -> m0) -> FreeT' m f a -> m0 #

foldMap' :: Monoid m0 => (a -> m0) -> FreeT' m f a -> m0 #

foldr :: (a -> b -> b) -> b -> FreeT' m f a -> b #

foldr' :: (a -> b -> b) -> b -> FreeT' m f a -> b #

foldl :: (b -> a -> b) -> b -> FreeT' m f a -> b #

foldl' :: (b -> a -> b) -> b -> FreeT' m f a -> b #

foldr1 :: (a -> a -> a) -> FreeT' m f a -> a #

foldl1 :: (a -> a -> a) -> FreeT' m f a -> a #

toList :: FreeT' m f a -> [a] #

null :: FreeT' m f a -> Bool #

length :: FreeT' m f a -> Int #

elem :: Eq a => a -> FreeT' m f a -> Bool #

maximum :: Ord a => FreeT' m f a -> a #

minimum :: Ord a => FreeT' m f a -> a #

sum :: Num a => FreeT' m f a -> a #

product :: Num a => FreeT' m f a -> a #

(Eq1 f, Eq1 m) => Eq1 (FreeT' m f) Source # 
Instance details

Defined in FMonad.FreeT

Methods

liftEq :: (a -> b -> Bool) -> FreeT' m f a -> FreeT' m f b -> Bool #

(Ord1 f, Ord1 m) => Ord1 (FreeT' m f) Source # 
Instance details

Defined in FMonad.FreeT

Methods

liftCompare :: (a -> b -> Ordering) -> FreeT' m f a -> FreeT' m f b -> Ordering #

(Read1 f, Read1 m) => Read1 (FreeT' m f) Source # 
Instance details

Defined in FMonad.FreeT

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (FreeT' m f a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [FreeT' m f a] #

liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (FreeT' m f a) #

liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [FreeT' m f a] #

(Show1 f, Show1 m) => Show1 (FreeT' m f) Source # 
Instance details

Defined in FMonad.FreeT

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> FreeT' m f a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [FreeT' m f a] -> ShowS #

(Traversable f, Traversable m) => Traversable (FreeT' f m) Source # 
Instance details

Defined in FMonad.FreeT

Methods

traverse :: Applicative f0 => (a -> f0 b) -> FreeT' f m a -> f0 (FreeT' f m b) #

sequenceA :: Applicative f0 => FreeT' f m (f0 a) -> f0 (FreeT' f m a) #

mapM :: Monad m0 => (a -> m0 b) -> FreeT' f m a -> m0 (FreeT' f m b) #

sequence :: Monad m0 => FreeT' f m (m0 a) -> m0 (FreeT' f m a) #

(MonadPlus m, Functor f) => Alternative (FreeT' m f) Source # 
Instance details

Defined in FMonad.FreeT

Methods

empty :: FreeT' m f a #

(<|>) :: FreeT' m f a -> FreeT' m f a -> FreeT' m f a #

some :: FreeT' m f a -> FreeT' m f [a] #

many :: FreeT' m f a -> FreeT' m f [a] #

(Monad m, Functor f) => Applicative (FreeT' m f) Source # 
Instance details

Defined in FMonad.FreeT

Methods

pure :: a -> FreeT' m f a #

(<*>) :: FreeT' m f (a -> b) -> FreeT' m f a -> FreeT' m f b #

liftA2 :: (a -> b -> c) -> FreeT' m f a -> FreeT' m f b -> FreeT' m f c #

(*>) :: FreeT' m f a -> FreeT' m f b -> FreeT' m f b #

(<*) :: FreeT' m f a -> FreeT' m f b -> FreeT' m f a #

(Functor f, Functor m) => Functor (FreeT' m f) Source # 
Instance details

Defined in FMonad.FreeT

Methods

fmap :: (a -> b) -> FreeT' m f a -> FreeT' m f b #

(<$) :: a -> FreeT' m f b -> FreeT' m f a #

(Monad m, Functor f) => Monad (FreeT' m f) Source # 
Instance details

Defined in FMonad.FreeT

Methods

(>>=) :: FreeT' m f a -> (a -> FreeT' m f b) -> FreeT' m f b #

(>>) :: FreeT' m f a -> FreeT' m f b -> FreeT' m f b #

return :: a -> FreeT' m f a #

(MonadPlus m, Functor f) => MonadPlus (FreeT' m f) Source # 
Instance details

Defined in FMonad.FreeT

Methods

mzero :: FreeT' m f a #

mplus :: FreeT' m f a -> FreeT' m f a -> FreeT' m f a #

(Read1 f, Read1 m, Read b) => Read (FreeT' m f b) Source # 
Instance details

Defined in FMonad.FreeT

Methods

readsPrec :: Int -> ReadS (FreeT' m f b) #

readList :: ReadS [FreeT' m f b] #

readPrec :: ReadPrec (FreeT' m f b) #

readListPrec :: ReadPrec [FreeT' m f b] #

(Show1 f, Show1 m, Show b) => Show (FreeT' m f b) Source # 
Instance details

Defined in FMonad.FreeT

Methods

showsPrec :: Int -> FreeT' m f b -> ShowS #

show :: FreeT' m f b -> String #

showList :: [FreeT' m f b] -> ShowS #

(Eq1 f, Eq1 m, Eq b) => Eq (FreeT' m f b) Source # 
Instance details

Defined in FMonad.FreeT

Methods

(==) :: FreeT' m f b -> FreeT' m f b -> Bool #

(/=) :: FreeT' m f b -> FreeT' m f b -> Bool #

(Ord1 f, Ord1 m, Ord b) => Ord (FreeT' m f b) Source # 
Instance details

Defined in FMonad.FreeT

Methods

compare :: FreeT' m f b -> FreeT' m f b -> Ordering #

(<) :: FreeT' m f b -> FreeT' m f b -> Bool #

(<=) :: FreeT' m f b -> FreeT' m f b -> Bool #

(>) :: FreeT' m f b -> FreeT' m f b -> Bool #

(>=) :: FreeT' m f b -> FreeT' m f b -> Bool #

max :: FreeT' m f b -> FreeT' m f b -> FreeT' m f b #

min :: FreeT' m f b -> FreeT' m f b -> FreeT' m f b #

liftM' :: Functor m => m a -> FreeT' m f a Source #

Lift of the Monad side.

fpureFst :: Monad m => Functor f => f ~> FreeT f m Source #

fpure to the first parameter of FreeT

fbindFst :: Monad m => (Functor f, Functor g) => (f ~> FreeT g m) -> FreeT f m ~> FreeT g m Source #

fbind to the first parameter of FreeT