Copyright | (c) Fumiaki Kinoshita 2018 |
---|---|
License | BSD3 |
Maintainer | Fumiaki Kinoshita <fumiexcel@gmail.com> |
Safe Haskell | None |
Language | Haskell2010 |
Extensible tangles
Synopsis
- newtype TangleT xs h m a = TangleT {}
- lasso :: forall k v m h xs. (Monad m, Lookup xs k v, Wrapper h) => FieldName k -> TangleT xs h m (Repr h (k :> v))
- hitchAt :: Monad m => Membership xs x -> TangleT xs h m (h x)
- runTangleT :: Monad m => (xs :& Comp (TangleT xs h m) h) -> (xs :& Nullable h) -> TangleT xs h m a -> m (a, xs :& Nullable h)
- evalTangleT :: Monad m => (xs :& Comp (TangleT xs h m) h) -> (xs :& Nullable h) -> TangleT xs h m a -> m a
- runTangles :: Monad m => (xs :& Comp (TangleT xs h m) h) -> (xs :& Nullable h) -> m (xs :& h)
Documentation
newtype TangleT xs h m a Source #
is the monad of computations that may depend on the elements in TangleT
h xs mxs
.
Instances
MonadTrans (TangleT xs h) Source # | |
Defined in Data.Extensible.Tangle | |
Monad m => Monad (TangleT xs h m) Source # | |
Functor m => Functor (TangleT xs h m) Source # | |
Monad m => Applicative (TangleT xs h m) Source # | |
Defined in Data.Extensible.Tangle pure :: a -> TangleT xs h m a # (<*>) :: TangleT xs h m (a -> b) -> TangleT xs h m a -> TangleT xs h m b # liftA2 :: (a -> b -> c) -> TangleT xs h m a -> TangleT xs h m b -> TangleT xs h m c # (*>) :: TangleT xs h m a -> TangleT xs h m b -> TangleT xs h m b # (<*) :: TangleT xs h m a -> TangleT xs h m b -> TangleT xs h m a # | |
(Monad m, Semigroup a) => Semigroup (TangleT xs h m a) Source # | |
(Monad m, Monoid a) => Monoid (TangleT xs h m a) Source # | |
lasso :: forall k v m h xs. (Monad m, Lookup xs k v, Wrapper h) => FieldName k -> TangleT xs h m (Repr h (k :> v)) Source #
Hitch an element associated to the FieldName
through a wrapper.
hitchAt :: Monad m => Membership xs x -> TangleT xs h m (h x) Source #
Take a value from the tangles. The result is memoized.
runTangleT :: Monad m => (xs :& Comp (TangleT xs h m) h) -> (xs :& Nullable h) -> TangleT xs h m a -> m (a, xs :& Nullable h) Source #
Run a TangleT
action and return the result and the calculated values.