extensible-0.5.1: Extensible, efficient, optics-friendly data types and effects

Copyright(c) Fumiaki Kinoshita 2018
LicenseBSD3
MaintainerFumiaki Kinoshita <fumiexcel@gmail.com>
Safe HaskellNone
LanguageHaskell2010

Data.Extensible.Effect

Contents

Description

Name-based extensible effects

Synopsis

Base

data Instruction (xs :: [Assoc k (* -> *)]) a where Source #

A unit of named effects. This is a variant of (:|) specialised for 'Type -> Type'.

Constructors

Instruction :: !(Membership xs kv) -> TargetOf kv a -> Instruction xs a 
Instances
(Monoid w, Lookup xs "Writer" ((,) w)) => MonadWriter w (Eff xs) Source # 
Instance details

Defined in Data.Extensible.Effect.Default

Methods

writer :: (a, w) -> Eff xs a #

tell :: w -> Eff xs () #

listen :: Eff xs a -> Eff xs (a, w) #

pass :: Eff xs (a, w -> w) -> Eff xs a #

Lookup xs "State" (State s) => MonadState s (Eff xs) Source # 
Instance details

Defined in Data.Extensible.Effect.Default

Methods

get :: Eff xs s #

put :: s -> Eff xs () #

state :: (s -> (a, s)) -> Eff xs a #

Lookup xs "Reader" ((:~:) r) => MonadReader r (Eff xs) Source # 
Instance details

Defined in Data.Extensible.Effect.Default

Methods

ask :: Eff xs r #

local :: (r -> r) -> Eff xs a -> Eff xs a #

reader :: (r -> a) -> Eff xs a #

Lookup xs "Either" (Const e :: Type -> Type) => MonadError e (Eff xs) Source # 
Instance details

Defined in Data.Extensible.Effect.Default

Methods

throwError :: e -> Eff xs a #

catchError :: Eff xs a -> (e -> Eff xs a) -> Eff xs a #

(Monoid e, Lookup xs "Either" (Const e :: Type -> Type)) => Alternative (Eff xs) Source #

A bit dubious

Instance details

Defined in Data.Extensible.Effect.Default

Methods

empty :: Eff xs a #

(<|>) :: Eff xs a -> Eff xs a -> Eff xs a #

some :: Eff xs a -> Eff xs [a] #

many :: Eff xs a -> Eff xs [a] #

(Monoid e, Lookup xs "Either" (Const e :: Type -> Type)) => MonadPlus (Eff xs) Source # 
Instance details

Defined in Data.Extensible.Effect.Default

Methods

mzero :: Eff xs a #

mplus :: Eff xs a -> Eff xs a -> Eff xs a #

(MonadIO m, Lookup xs "IO" m) => MonadIO (Eff xs) Source # 
Instance details

Defined in Data.Extensible.Effect.Default

Methods

liftIO :: IO a -> Eff xs a #

(MonadThrow m, Lookup xs "IO" m) => MonadThrow (Eff xs) Source # 
Instance details

Defined in Data.Extensible.Effect.Default

Methods

throwM :: Exception e => e -> Eff xs a #

(MonadCatch m, Lookup xs "IO" m) => MonadCatch (Eff xs) Source # 
Instance details

Defined in Data.Extensible.Effect.Default

Methods

catch :: Exception e => Eff xs a -> (e -> Eff xs a) -> Eff xs a #

(MonadResource m, Lookup xs "IO" m) => MonadResource (Eff xs) Source # 
Instance details

Defined in Data.Extensible.Effect.Default

Methods

liftResourceT :: ResourceT IO a -> Eff xs a #

type Eff xs = Skeleton (Instruction xs) Source #

The extensible operational monad

liftEff :: forall s t xs a. Lookup xs s t => Proxy s -> t a -> Eff xs a Source #

Lift an instruction onto an Eff action.

liftsEff :: forall s t xs a r. Lookup xs s t => Proxy s -> t a -> (a -> r) -> Eff xs r Source #

Lift an instruction onto an Eff action and apply a function to the result.

hoistEff :: forall s t xs a. Lookup xs s t => Proxy s -> (forall x. t x -> t x) -> Eff xs a -> Eff xs a Source #

Censor a specific type of effects in an action.

castEff :: IncludeAssoc ys xs => Eff xs a -> Eff ys a Source #

Upcast an action.

Step-wise handling

newtype Interpreter f g Source #

Transformation between effects

Constructors

Interpreter 

Fields

handleEff :: RecordOf (Interpreter m) xs -> Eff xs a -> MonadView m (Eff xs) a Source #

Process an Eff action using a record of Interpreters.

Peeling

peelEff Source #

Arguments

:: Rebinder xs r

Re-bind an unrelated action

-> (a -> r)

return the result

-> (forall x. t x -> (x -> r) -> r)

Handle the foremost type of an action

-> Eff ((k >: t) ': xs) a 
-> r 

Build a relay-style handler from a triple of functions.

runStateEff = peelEff1 (a s -> return (a, s))
  (m k s -> let (a, s') = runState m s in k a s')

type Rebinder xs r = forall x. Instruction xs x -> (x -> r) -> r Source #

A function to bind an Instruction in peelEff.

rebindEff0 :: Rebinder xs (Eff xs r) Source #

A common value for the second argument of peelEff. Binds an instruction directly.

peelEff0 Source #

Arguments

:: (a -> Eff xs r)

return the result

-> (forall x. t x -> (x -> Eff xs r) -> Eff xs r)

Handle the foremost type of an action

-> Eff ((k >: t) ': xs) a 
-> Eff xs r 

peelEff specialised for continuations with no argument

rebindEff1 :: Rebinder xs (a -> Eff xs r) Source #

A pre-defined value for the second argument of peelEff. Preserves the argument of the continuation.

peelEff1 Source #

Arguments

:: (a -> b -> Eff xs r)

return the result

-> (forall x. t x -> (x -> b -> Eff xs r) -> b -> Eff xs r)

Handle the foremost type of an action

-> Eff ((k >: t) ': xs) a 
-> b 
-> Eff xs r 

peelEff specialised for 1-argument continuation

rebindEff2 :: Rebinder xs (a -> b -> Eff xs r) Source #

A pre-defined value for the second argument of peelEff. Preserves two arguments of the continuation.

leaveEff :: Eff '[] a -> a Source #

Reveal the final result of Eff.

retractEff :: forall k m a. Monad m => Eff '[k >: m] a -> m a Source #

Tear down an action using the Monad instance of the instruction.

Anonymous actions

data Action (args :: [*]) a r where Source #

Anonymous representation of instructions.

Constructors

AResult :: Action '[] a a 
AArgument :: x -> Action xs a r -> Action (x ': xs) a r 

type family Function args r :: * where ... Source #

Function [a, b, c] r is a -> b -> c -> r

Equations

Function '[] r = r 
Function (x ': xs) r = x -> Function xs r 

runAction :: Function xs (f a) -> Action xs a r -> f r Source #

Pass the arguments of Action to the supplied function.

(@!?) :: FieldName k -> Function xs (f a) -> Field (Interpreter f) (k :> Action xs a) infix 1 Source #

Create a Field of a Interpreter for an Action.

peelAction Source #

Arguments

:: (forall x. Instruction xs x -> (x -> r) -> r)

Re-bind an unrelated action

-> (a -> r)

return the result

-> Function ps ((q -> r) -> r)

Handle the foremost action

-> Eff ((k >: Action ps q) ': xs) a 
-> r 

Specialised version of peelEff for Actions. You can pass a function a -> b -> ... -> (q -> r) -> r as a handler for Action '[a, b, ...] q.

peelAction0 Source #

Arguments

:: Function ps (Eff xs q)

Handle the foremost action

-> Eff ((k >: Action ps q) ': xs) a 
-> Eff xs a 

Non continuation-passing variant of peelAction.

transformers-compatible actions and handlers

Reader

type ReaderEff = (:~:) Source #

The reader monad is characterised by a type equality between the result type and the enviroment type.

askEff :: forall k r xs. Lookup xs k (ReaderEff r) => Proxy k -> Eff xs r Source #

Fetch the environment.

asksEff :: forall k r xs a. Lookup xs k (ReaderEff r) => Proxy k -> (r -> a) -> Eff xs a Source #

Pass the environment to a function.

localEff :: forall k r xs a. Lookup xs k (ReaderEff r) => Proxy k -> (r -> r) -> Eff xs a -> Eff xs a Source #

Modify the enviroment locally.

runReaderEff :: forall k r xs a. Eff ((k >: ReaderEff r) ': xs) a -> r -> Eff xs a Source #

Run the frontal reader effect.

State

type State s = StateT s Identity #

A state monad parameterized by the type s of the state to carry.

The return function leaves the state unchanged, while >>= uses the final state of the first computation as the initial state of the second.

getEff :: forall k s xs. Lookup xs k (State s) => Proxy k -> Eff xs s Source #

Get the current state.

getsEff :: forall k s a xs. Lookup xs k (State s) => Proxy k -> (s -> a) -> Eff xs a Source #

Pass the current state to a function.

putEff :: forall k s xs. Lookup xs k (State s) => Proxy k -> s -> Eff xs () Source #

Replace the state with a new value.

modifyEff :: forall k s xs. Lookup xs k (State s) => Proxy k -> (s -> s) -> Eff xs () Source #

Modify the state.

stateEff :: forall k s xs a. Lookup xs k (State s) => Proxy k -> (s -> (a, s)) -> Eff xs a Source #

Lift a state modification function.

runStateEff :: forall k s xs a. Eff ((k >: State s) ': xs) a -> s -> Eff xs (a, s) Source #

Run the frontal state effect.

execStateEff :: forall k s xs a. Eff ((k >: State s) ': xs) a -> s -> Eff xs s Source #

Run the frontal state effect and return the final state.

evalStateEff :: forall k s xs a. Eff ((k >: State s) ': xs) a -> s -> Eff xs a Source #

Run the frontal state effect and return the final result.

Writer

type WriterEff w = (,) w Source #

(,) already is a writer monad.

writerEff :: forall k w xs a. Lookup xs k (WriterEff w) => Proxy k -> (a, w) -> Eff xs a Source #

Write the second element and return the first element.

tellEff :: forall k w xs. Lookup xs k (WriterEff w) => Proxy k -> w -> Eff xs () Source #

Write a value.

listenEff :: forall k w xs a. (Lookup xs k (WriterEff w), Monoid w) => Proxy k -> Eff xs a -> Eff xs (a, w) Source #

Squash the outputs into one step and return it.

passEff :: forall k w xs a. (Lookup xs k (WriterEff w), Monoid w) => Proxy k -> Eff xs (a, w -> w) -> Eff xs a Source #

Modify the output using the function in the result.

runWriterEff :: forall k w xs a. Monoid w => Eff ((k >: WriterEff w) ': xs) a -> Eff xs (a, w) Source #

Run the frontal writer effect.

execWriterEff :: forall k w xs a. Monoid w => Eff ((k >: WriterEff w) ': xs) a -> Eff xs w Source #

Run the frontal state effect.

Maybe

type MaybeEff = Const () Source #

An effect with no result

nothingEff :: Lookup xs k MaybeEff => Proxy k -> Eff xs a Source #

Break out of the computation. Similar to Nothing.

runMaybeEff :: forall k xs a. Eff ((k >: MaybeEff) ': xs) a -> Eff xs (Maybe a) Source #

Run an effect which may fail in the name of k.

Either

type EitherEff = Const Source #

Throwing an exception

throwEff :: Lookup xs k (EitherEff e) => Proxy k -> e -> Eff xs a Source #

Throw an exception e, throwing the rest of the computation away.

catchEff :: forall k e xs a. Lookup xs k (EitherEff e) => Proxy k -> Eff xs a -> (e -> Eff xs a) -> Eff xs a Source #

Attach a handler for an exception.

runEitherEff :: forall k e xs a. Eff ((k >: EitherEff e) ': xs) a -> Eff xs (Either e a) Source #

Run an action and abort on throwEff.

Iter

data Identity a #

Identity functor and monad. (a non-strict monad)

Since: base-4.8.0.0

Instances
Monad Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

(>>=) :: Identity a -> (a -> Identity b) -> Identity b #

(>>) :: Identity a -> Identity b -> Identity b #

return :: a -> Identity a #

fail :: String -> Identity a #

Functor Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

fmap :: (a -> b) -> Identity a -> Identity b #

(<$) :: a -> Identity b -> Identity a #

MonadFix Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

mfix :: (a -> Identity a) -> Identity a #

Applicative Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

pure :: a -> Identity a #

(<*>) :: Identity (a -> b) -> Identity a -> Identity b #

liftA2 :: (a -> b -> c) -> Identity a -> Identity b -> Identity c #

(*>) :: Identity a -> Identity b -> Identity b #

(<*) :: Identity a -> Identity b -> Identity a #

Foldable Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

fold :: Monoid m => Identity m -> m #

foldMap :: Monoid m => (a -> m) -> Identity a -> m #

foldr :: (a -> b -> b) -> b -> Identity a -> b #

foldr' :: (a -> b -> b) -> b -> Identity a -> b #

foldl :: (b -> a -> b) -> b -> Identity a -> b #

foldl' :: (b -> a -> b) -> b -> Identity a -> b #

foldr1 :: (a -> a -> a) -> Identity a -> a #

foldl1 :: (a -> a -> a) -> Identity a -> a #

toList :: Identity a -> [a] #

null :: Identity a -> Bool #

length :: Identity a -> Int #

elem :: Eq a => a -> Identity a -> Bool #

maximum :: Ord a => Identity a -> a #

minimum :: Ord a => Identity a -> a #

sum :: Num a => Identity a -> a #

product :: Num a => Identity a -> a #

Traversable Identity

Since: base-4.9.0.0

Instance details

Defined in Data.Traversable

Methods

traverse :: Applicative f => (a -> f b) -> Identity a -> f (Identity b) #

sequenceA :: Applicative f => Identity (f a) -> f (Identity a) #

mapM :: Monad m => (a -> m b) -> Identity a -> m (Identity b) #

sequence :: Monad m => Identity (m a) -> m (Identity a) #

Arbitrary1 Identity 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

liftArbitrary :: Gen a -> Gen (Identity a) #

liftShrink :: (a -> [a]) -> Identity a -> [Identity a] #

ToJSON1 Identity 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Value) -> ([a] -> Value) -> Identity a -> Value #

liftToJSONList :: (a -> Value) -> ([a] -> Value) -> [Identity a] -> Value #

liftToEncoding :: (a -> Encoding) -> ([a] -> Encoding) -> Identity a -> Encoding #

liftToEncodingList :: (a -> Encoding) -> ([a] -> Encoding) -> [Identity a] -> Encoding #

FromJSON1 Identity 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON :: (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (Identity a) #

liftParseJSONList :: (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [Identity a] #

Eq1 Identity

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftEq :: (a -> b -> Bool) -> Identity a -> Identity b -> Bool #

Ord1 Identity

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftCompare :: (a -> b -> Ordering) -> Identity a -> Identity b -> Ordering #

Read1 Identity

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Identity a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Identity a] #

liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Identity a) #

liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Identity a] #

Show1 Identity

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Identity a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Identity a] -> ShowS #

Comonad Identity 
Instance details

Defined in Control.Comonad

Methods

extract :: Identity a -> a #

duplicate :: Identity a -> Identity (Identity a) #

extend :: (Identity a -> b) -> Identity a -> Identity b #

ComonadApply Identity 
Instance details

Defined in Control.Comonad

Methods

(<@>) :: Identity (a -> b) -> Identity a -> Identity b #

(@>) :: Identity a -> Identity b -> Identity b #

(<@) :: Identity a -> Identity b -> Identity a #

NFData1 Identity

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf :: (a -> ()) -> Identity a -> () #

Hashable1 Identity 
Instance details

Defined in Data.Hashable.Class

Methods

liftHashWithSalt :: (Int -> a -> Int) -> Int -> Identity a -> Int #

() :=> (Monad Identity) 
Instance details

Defined in Data.Constraint

Methods

ins :: () :- Monad Identity #

() :=> (Functor Identity) 
Instance details

Defined in Data.Constraint

Methods

ins :: () :- Functor Identity #

Unbox a => Vector Vector (Identity a) Source # 
Instance details

Defined in Data.Extensible.Dictionary

Unbox a => MVector MVector (Identity a) Source # 
Instance details

Defined in Data.Extensible.Dictionary

FromBits r a => FromBits r (Identity a) Source # 
Instance details

Defined in Data.Extensible.Bits

Associated Types

type BitWidth (Identity a) :: Nat Source #

Methods

fromBits :: r -> Identity a Source #

toBits :: Identity a -> r Source #

Bounded a => Bounded (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Enum a => Enum (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Eq a => Eq (Identity a)

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

(==) :: Identity a -> Identity a -> Bool #

(/=) :: Identity a -> Identity a -> Bool #

Floating a => Floating (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Fractional a => Fractional (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Integral a => Integral (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Num a => Num (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Ord a => Ord (Identity a)

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

compare :: Identity a -> Identity a -> Ordering #

(<) :: Identity a -> Identity a -> Bool #

(<=) :: Identity a -> Identity a -> Bool #

(>) :: Identity a -> Identity a -> Bool #

(>=) :: Identity a -> Identity a -> Bool #

max :: Identity a -> Identity a -> Identity a #

min :: Identity a -> Identity a -> Identity a #

Read a => Read (Identity a)

This instance would be equivalent to the derived instances of the Identity newtype if the runIdentity field were removed

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Real a => Real (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Methods

toRational :: Identity a -> Rational #

RealFloat a => RealFloat (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

RealFrac a => RealFrac (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Methods

properFraction :: Integral b => Identity a -> (b, Identity a) #

truncate :: Integral b => Identity a -> b #

round :: Integral b => Identity a -> b #

ceiling :: Integral b => Identity a -> b #

floor :: Integral b => Identity a -> b #

Show a => Show (Identity a)

This instance would be equivalent to the derived instances of the Identity newtype if the runIdentity field were removed

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

showsPrec :: Int -> Identity a -> ShowS #

show :: Identity a -> String #

showList :: [Identity a] -> ShowS #

Ix a => Ix (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

IsString a => IsString (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.String

Methods

fromString :: String -> Identity a #

Generic (Identity a) 
Instance details

Defined in Data.Functor.Identity

Associated Types

type Rep (Identity a) :: Type -> Type #

Methods

from :: Identity a -> Rep (Identity a) x #

to :: Rep (Identity a) x -> Identity a #

Semigroup a => Semigroup (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Methods

(<>) :: Identity a -> Identity a -> Identity a #

sconcat :: NonEmpty (Identity a) -> Identity a #

stimes :: Integral b => b -> Identity a -> Identity a #

Monoid a => Monoid (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Methods

mempty :: Identity a #

mappend :: Identity a -> Identity a -> Identity a #

mconcat :: [Identity a] -> Identity a #

Arbitrary a => Arbitrary (Identity a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (Identity a) #

shrink :: Identity a -> [Identity a] #

CoArbitrary a => CoArbitrary (Identity a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

coarbitrary :: Identity a -> Gen b -> Gen b #

Hashable a => Hashable (Identity a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Identity a -> Int #

hash :: Identity a -> Int #

ToJSON a => ToJSON (Identity a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSONKey a => ToJSONKey (Identity a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

FromJSON a => FromJSON (Identity a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSONKey a => FromJSONKey (Identity a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

Storable a => Storable (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Methods

sizeOf :: Identity a -> Int #

alignment :: Identity a -> Int #

peekElemOff :: Ptr (Identity a) -> Int -> IO (Identity a) #

pokeElemOff :: Ptr (Identity a) -> Int -> Identity a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (Identity a) #

pokeByteOff :: Ptr b -> Int -> Identity a -> IO () #

peek :: Ptr (Identity a) -> IO (Identity a) #

poke :: Ptr (Identity a) -> Identity a -> IO () #

Bits a => Bits (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

FiniteBits a => FiniteBits (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

NFData a => NFData (Identity a)

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Identity a -> () #

Pretty a => Pretty (Identity a)
>>> pretty (Identity 1)
1
Instance details

Defined in Data.Text.Prettyprint.Doc.Internal

Methods

pretty :: Identity a -> Doc ann #

prettyList :: [Identity a] -> Doc ann #

Prim a => Prim (Identity a)

Since: primitive-0.6.5.0

Instance details

Defined in Data.Primitive.Types

Unbox a => Unbox (Identity a) Source # 
Instance details

Defined in Data.Extensible.Dictionary

Generic1 Identity 
Instance details

Defined in Data.Functor.Identity

Associated Types

type Rep1 Identity :: k -> Type #

Methods

from1 :: Identity a -> Rep1 Identity a #

to1 :: Rep1 Identity a -> Identity a #

Wrapper Identity Source # 
Instance details

Defined in Data.Extensible.Wrapper

Associated Types

type Repr Identity v :: Type Source #

(Bounded a) :=> (Bounded (Identity a)) 
Instance details

Defined in Data.Constraint

Methods

ins :: Bounded a :- Bounded (Identity a) #

(Enum a) :=> (Enum (Identity a)) 
Instance details

Defined in Data.Constraint

Methods

ins :: Enum a :- Enum (Identity a) #

(Eq a) :=> (Eq (Identity a)) 
Instance details

Defined in Data.Constraint

Methods

ins :: Eq a :- Eq (Identity a) #

(Floating a) :=> (Floating (Identity a)) 
Instance details

Defined in Data.Constraint

Methods

ins :: Floating a :- Floating (Identity a) #

(Fractional a) :=> (Fractional (Identity a)) 
Instance details

Defined in Data.Constraint

(Integral a) :=> (Integral (Identity a)) 
Instance details

Defined in Data.Constraint

Methods

ins :: Integral a :- Integral (Identity a) #

(Num a) :=> (Num (Identity a)) 
Instance details

Defined in Data.Constraint

Methods

ins :: Num a :- Num (Identity a) #

(Ord a) :=> (Ord (Identity a)) 
Instance details

Defined in Data.Constraint

Methods

ins :: Ord a :- Ord (Identity a) #

(Read a) :=> (Read (Identity a)) 
Instance details

Defined in Data.Constraint

Methods

ins :: Read a :- Read (Identity a) #

(Real a) :=> (Real (Identity a)) 
Instance details

Defined in Data.Constraint

Methods

ins :: Real a :- Real (Identity a) #

(RealFloat a) :=> (RealFloat (Identity a)) 
Instance details

Defined in Data.Constraint

(RealFrac a) :=> (RealFrac (Identity a)) 
Instance details

Defined in Data.Constraint

Methods

ins :: RealFrac a :- RealFrac (Identity a) #

(Show a) :=> (Show (Identity a)) 
Instance details

Defined in Data.Constraint

Methods

ins :: Show a :- Show (Identity a) #

(Semigroup a) :=> (Semigroup (Identity a)) 
Instance details

Defined in Data.Constraint

(Monoid a) :=> (Monoid (Identity a)) 
Instance details

Defined in Data.Constraint

Methods

ins :: Monoid a :- Monoid (Identity a) #

(Bits a) :=> (Bits (Identity a)) 
Instance details

Defined in Data.Constraint

Methods

ins :: Bits a :- Bits (Identity a) #

Sieve ((->) :: Type -> Type -> Type) Identity 
Instance details

Defined in Data.Profunctor.Sieve

Methods

sieve :: (a -> b) -> a -> Identity b #

Cosieve ((->) :: Type -> Type -> Type) Identity 
Instance details

Defined in Data.Profunctor.Sieve

Methods

cosieve :: (a -> b) -> Identity a -> b #

newtype MVector s (Identity a) Source # 
Instance details

Defined in Data.Extensible.Dictionary

newtype MVector s (Identity a) = MV_Identity (MVector s a)
type Rep (Identity a)

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

type Rep (Identity a) = D1 (MetaData "Identity" "Data.Functor.Identity" "base" True) (C1 (MetaCons "Identity" PrefixI True) (S1 (MetaSel (Just "runIdentity") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)))
newtype Vector (Identity a) Source # 
Instance details

Defined in Data.Extensible.Dictionary

newtype Vector (Identity a) = V_Identity (Vector a)
type BitWidth (Identity a) Source # 
Instance details

Defined in Data.Extensible.Bits

type Rep1 Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

type Rep1 Identity = D1 (MetaData "Identity" "Data.Functor.Identity" "base" True) (C1 (MetaCons "Identity" PrefixI True) (S1 (MetaSel (Just "runIdentity") NoSourceUnpackedness NoSourceStrictness DecidedLazy) Par1))
type Repr Identity (a :: Type) Source # 
Instance details

Defined in Data.Extensible.Wrapper

type Repr Identity (a :: Type) = a

tickEff :: Lookup xs k Identity => Proxy k -> Eff xs () Source #

Put a milestone on a computation.

runIterEff :: Eff ((k >: Identity) ': xs) a -> Eff xs (Either a (Eff ((k >: Identity) ': xs) a)) Source #

Run a computation until the first call of tickEff.

Cont

data ContT (r :: k) (m :: k -> Type) a :: forall k. k -> (k -> Type) -> Type -> Type #

The continuation monad transformer. Can be used to add continuation handling to any type constructor: the Monad instance and most of the operations do not require m to be a monad.

ContT is not a functor on the category of monads, and many operations cannot be lifted through it.

Instances
MonadState s m => MonadState s (ContT r m) 
Instance details

Defined in Control.Monad.State.Class

Methods

get :: ContT r m s #

put :: s -> ContT r m () #

state :: (s -> (a, s)) -> ContT r m a #

MonadReader r' m => MonadReader r' (ContT r m) 
Instance details

Defined in Control.Monad.Reader.Class

Methods

ask :: ContT r m r' #

local :: (r' -> r') -> ContT r m a -> ContT r m a #

reader :: (r' -> a) -> ContT r m a #

MonadTrans (ContT r) 
Instance details

Defined in Control.Monad.Trans.Cont

Methods

lift :: Monad m => m a -> ContT r m a #

Monad (ContT r m) 
Instance details

Defined in Control.Monad.Trans.Cont

Methods

(>>=) :: ContT r m a -> (a -> ContT r m b) -> ContT r m b #

(>>) :: ContT r m a -> ContT r m b -> ContT r m b #

return :: a -> ContT r m a #

fail :: String -> ContT r m a #

Functor (ContT r m) 
Instance details

Defined in Control.Monad.Trans.Cont

Methods

fmap :: (a -> b) -> ContT r m a -> ContT r m b #

(<$) :: a -> ContT r m b -> ContT r m a #

MonadFail m => MonadFail (ContT r m) 
Instance details

Defined in Control.Monad.Trans.Cont

Methods

fail :: String -> ContT r m a #

Applicative (ContT r m) 
Instance details

Defined in Control.Monad.Trans.Cont

Methods

pure :: a -> ContT r m a #

(<*>) :: ContT r m (a -> b) -> ContT r m a -> ContT r m b #

liftA2 :: (a -> b -> c) -> ContT r m a -> ContT r m b -> ContT r m c #

(*>) :: ContT r m a -> ContT r m b -> ContT r m b #

(<*) :: ContT r m a -> ContT r m b -> ContT r m a #

MonadIO m => MonadIO (ContT r m) 
Instance details

Defined in Control.Monad.Trans.Cont

Methods

liftIO :: IO a -> ContT r m a #

MonadThrow m => MonadThrow (ContT r m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> ContT r m a #

PrimMonad m => PrimMonad (ContT r m)

Since: primitive-0.6.3.0

Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (ContT r m) :: Type #

Methods

primitive :: (State# (PrimState (ContT r m)) -> (#State# (PrimState (ContT r m)), a#)) -> ContT r m a #

MonadResource m => MonadResource (ContT r m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> ContT r m a #

type PrimState (ContT r m) 
Instance details

Defined in Control.Monad.Primitive

type PrimState (ContT r m) = PrimState m

contEff :: Lookup xs k (ContT r m) => Proxy k -> ((a -> m r) -> m r) -> Eff xs a Source #

Place a continuation-passing action.

runContEff :: forall k r xs a. Eff ((k >: ContT r (Eff xs)) ': xs) a -> (a -> Eff xs r) -> Eff xs r Source #

Unwrap a continuation.