Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Continuation based control-flow
- newtype ContFlow (xs :: [*]) r = ContFlow (ContListToTuple xs r -> r)
- (>::>) :: ContFlow xs r -> ContListToTuple xs r -> r
- (>:-:>) :: ContFlow '[a] r -> (a -> r) -> r
- (>:%:>) :: forall ts xs r. ReorderTuple ts (ContListToTuple xs r) => ContFlow xs r -> ts -> r
- fret :: forall x r t n xs. (ExtractTuple n t (x -> r), xs ~ ContTupleToList t r, Member x xs, n ~ IndexOf x xs, KnownNat n, CheckNub xs) => t -> x -> r
- fretN :: forall n x r t xs. (ExtractTuple n t (x -> r), xs ~ ContTupleToList t r, x ~ Index n xs, KnownNat n) => t -> x -> r
- freturn :: forall x r t n xs. (ExtractTuple n t (x -> r), xs ~ ContTupleToList t r, Member x xs, n ~ IndexOf x xs, KnownNat n, CheckNub xs, ?__cs :: t) => x -> r
- freturnN :: forall n x r t xs. (ExtractTuple n t (x -> r), xs ~ ContTupleToList t r, x ~ Index n xs, KnownNat n, ?__cs :: t) => x -> r
- frec :: forall r xs. (?__cs :: ContListToTuple xs r) => ContFlow xs r -> r
- type family ContListToTuple (xs :: [*]) r where ...
- type family ContTupleToList t r :: [*] where ...
- type family StripR f r where ...
- type family AddR f r where ...
- fIf :: Bool -> ContFlow '[Then, Else] r
- data Then = Then
- data Else = Else
Documentation
newtype ContFlow (xs :: [*]) r Source #
A continuation based control-flow
ContFlow (ContListToTuple xs r -> r) |
(>::>) :: ContFlow xs r -> ContListToTuple xs r -> r infixl 0 Source #
Bind a flow to a tuple of continuations
(>:-:>) :: ContFlow '[a] r -> (a -> r) -> r infixl 0 Source #
Bind a flow to a 1-tuple of continuations
(>:%:>) :: forall ts xs r. ReorderTuple ts (ContListToTuple xs r) => ContFlow xs r -> ts -> r infixl 0 Source #
Bind a flow to a tuple of continuations and reorder fields if necessary
fret :: forall x r t n xs. (ExtractTuple n t (x -> r), xs ~ ContTupleToList t r, Member x xs, n ~ IndexOf x xs, KnownNat n, CheckNub xs) => t -> x -> r Source #
Call the type-indexed continuation from the tuple passed as first parameter
fretN :: forall n x r t xs. (ExtractTuple n t (x -> r), xs ~ ContTupleToList t r, x ~ Index n xs, KnownNat n) => t -> x -> r Source #
Call the indexed continuation from the tuple passed as first parameter
freturn :: forall x r t n xs. (ExtractTuple n t (x -> r), xs ~ ContTupleToList t r, Member x xs, n ~ IndexOf x xs, KnownNat n, CheckNub xs, ?__cs :: t) => x -> r Source #
Implicitly call the type-indexed continuation in the context
freturnN :: forall n x r t xs. (ExtractTuple n t (x -> r), xs ~ ContTupleToList t r, x ~ Index n xs, KnownNat n, ?__cs :: t) => x -> r Source #
Implicitly call the type-indexed continuation in the context
frec :: forall r xs. (?__cs :: ContListToTuple xs r) => ContFlow xs r -> r Source #
Recursive call
type family ContListToTuple (xs :: [*]) r where ... Source #
Convert a list of types into the actual data type representing the continuations.
ContListToTuple xs r = ListToTuple (AddR xs r) |
type family ContTupleToList t r :: [*] where ... Source #
Convert a tuple of continuations into a list of types
ContTupleToList t r = StripR (TupleToList t) r |