[Haskell-cafe] Seeking help to generalize this ..

Matthew Farkas-Dyck strake888 at gmail.com
Fri Feb 7 17:55:37 UTC 2020


On 2/1/20, Jack Kelly <jack at jackkelly.name> wrote:
> In Data.Monoid there is the 'Endo' newtype, which wraps functions of
> type 'a -> a'. Is there an 'EndoM' variant, or is that something that's
> usually created by putting other pieces together? Below is a sketch of
> what I mean:
>
> -- Maybe this is known by another name?
> newtype EndoM f a = EndoM { appEndoM :: a -> f a }

I define a general `Endo` type in the category package, here:
http://hackage.haskell.org/package/category-0.2.5.0/docs/Data-Morphism-Endo.html

Thus one can use `Endo (Kleisli m)`.


More information about the Haskell-Cafe mailing list