Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Type-safe indexing for Env
.
This module is intended for internal use only, and may change without warning in subsequent releases.
Synopsis
- type Effect = (Type -> Type) -> Type -> Type
- class (e :: Effect) :> (es :: [Effect]) where
- reifyIndex :: Int
- type family xs :>> es :: Constraint where ...
- class KnownPrefix es => Subset (subEs :: [Effect]) (es :: [Effect]) where
- subsetFullyKnown :: Bool
- reifyIndices :: [Int]
- class Subset subEs es => KnownSubset (subEs :: [Effect]) (es :: [Effect])
- class KnownPrefix (es :: [Effect]) where
- prefixLength :: Int
- class IsUnknownSuffixOf (subEs :: [Effect]) (es :: [Effect])
- type family (xs :: [Effect]) ++ (ys :: [Effect]) :: [Effect] where ...
- class KnownEffects (es :: [Effect]) where
- type Type = TYPE LiftedRep
Documentation
class (e :: Effect) :> (es :: [Effect]) where Source #
A constraint that requires that a particular effect e
is a member of the
type-level list es
. This is used to parameterize an Eff
computation over an arbitrary list of effects, so long as e
is somewhere
in the list.
For example, a computation that only needs access to a mutable value of type
Integer
would have the following type:
State
Integer
:>
es =>Eff
es ()
Nothing
reifyIndex :: Int Source #
Get the position of e
in es
.
Note: GHC is kind enough to cache these values as they're top level CAFs,
so the lookup is amortized O(1)
without any language level tricks.
Instances
(TypeError (('Text "There is no handler for '" ':<>: 'ShowType e) ':<>: 'Text "' in the context") :: Constraint) => e :> ('[] :: [Effect]) Source # | |
Defined in Effectful.Internal.Effect reifyIndex :: Int Source # | |
e :> (e ': es) Source # | |
Defined in Effectful.Internal.Effect reifyIndex :: Int Source # | |
e :> es => e :> (x ': es) Source # | |
Defined in Effectful.Internal.Effect reifyIndex :: Int Source # |
type family xs :>> es :: Constraint where ... Source #
Deprecated: Usage of (:>>) slows down GHC too much. See https://github.com/haskell-effectful/effectful/issues/52#issuecomment-1269155485 for more information.
Convenience operator for expressing that a function uses multiple effects
in a more concise way than enumerating them all with (:>)
.
[E1, E2, ..., En]:>>
es ≡ (E1:>
es, E2:>
es, ..., En :> es)
class KnownPrefix es => Subset (subEs :: [Effect]) (es :: [Effect]) where Source #
Provide evidence that subEs
is a subset of es
.
Nothing
subsetFullyKnown :: Bool Source #
reifyIndices :: [Int] Source #
Instances
(KnownPrefix es, IsUnknownSuffixOf subEs es) => Subset subEs es Source # | |
Defined in Effectful.Internal.Effect subsetFullyKnown :: Bool Source # reifyIndices :: [Int] Source # | |
KnownPrefix es => Subset ('[] :: [Effect]) es Source # | |
Defined in Effectful.Internal.Effect subsetFullyKnown :: Bool Source # reifyIndices :: [Int] Source # | |
(e :> es, Subset subEs es) => Subset (e ': subEs) es Source # | |
Defined in Effectful.Internal.Effect subsetFullyKnown :: Bool Source # reifyIndices :: [Int] Source # |
class Subset subEs es => KnownSubset (subEs :: [Effect]) (es :: [Effect]) Source #
Provide evidence that subEs
is a known subset of es
.
Instances
KnownSubset ('[] :: [Effect]) es Source # | |
Defined in Effectful.Internal.Effect | |
(e :> es, KnownSubset subEs es) => KnownSubset (e ': subEs) es Source # | |
Defined in Effectful.Internal.Effect |
class KnownPrefix (es :: [Effect]) where Source #
Calculate length of a statically known prefix of es
.
prefixLength :: Int Source #
Instances
KnownPrefix es Source # | |
Defined in Effectful.Internal.Effect prefixLength :: Int Source # | |
KnownPrefix es => KnownPrefix (e ': es) Source # | |
Defined in Effectful.Internal.Effect prefixLength :: Int Source # |
class IsUnknownSuffixOf (subEs :: [Effect]) (es :: [Effect]) Source #
Require that subEs
is the unknown suffix of es
.
Instances
subEs ~ es => IsUnknownSuffixOf subEs es Source # | |
Defined in Effectful.Internal.Effect | |
IsUnknownSuffixOf subEs es => IsUnknownSuffixOf subEs (e ': es) Source # | |
Defined in Effectful.Internal.Effect |
type family (xs :: [Effect]) ++ (ys :: [Effect]) :: [Effect] where ... infixr 5 Source #
Append two type-level lists together.
class KnownEffects (es :: [Effect]) where Source #
Calculate length of a list of known effects.
Nothing
Instances
KnownEffects ('[] :: [Effect]) Source # | |
Defined in Effectful.Internal.Effect | |
KnownEffects es => KnownEffects (e ': es) Source # | |
Defined in Effectful.Internal.Effect |