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