Skip to content

Include a class for hoist? #30

@garyb

Description

@garyb

There's an MFunctor class in Control.Monad.Morph which is something like what I had in mind:

class MFunctor t where
  hoist :: Monad m => (forall a. m a -> n a) -> t m b -> t n b

But that imposes a monad constraint. I was thinking more like:

class Functor1 t where
  hoist :: (f ~> g) -> t f ~> t g

With the usual laws:

hoist (f ∘ g) = hoist f ∘ hoist g
hoist id = id

We have quite a few types with hoist operations when you get into free, yoneda, coroutines, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions