Skip to content

Open to including a "ControlTransformation" data type? #63

@shlevy

Description

@shlevy

As MonadTrans relates to a natural transformation, MonadTransControl roughly relates to a type like this:

data ControlTransformation st m n = ControlTransformation
  { transWith :: !(forall a. ((forall x. n x -> m (st x)) -> m a) -> n a)
  , restoreState :: !(forall a. st a -> n a)
  }

type StatelessControlTransformation = ControlTransformation Identity

statelessControlTransformation
  :: forall m n. (Functor m, Applicative n)
  => (forall a. ((forall x. n x -> m x) -> m a) -> n a)
  -> StatelessControlTransformation m n

statelessTransWith
  :: (Functor m)
  => StatelessControlTransformation m n
  -> ((forall x. n x -> m x) -> m a) -> n a

Would this type belong somewhere in monad-control?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions