What does Haskell call the Hom Functor/Monad?

2019-05-07 01:16发布

问题:

I'd like to use it in my code and would rather not duplicate it, but since it involves only massively generic words like "function" or "composition" I can't find it by searching.

To be completely specific, I'm looking for

instance Functor (x->) where
    fmap f p = f . p

回答1:

This is the basic reader (or environment) monad, usually referred to as ((->) e). (This is (e ->) written as a partially applied function instead of as a section; the latter syntax is problematic to parse.) You can get it by importing Control.Monad.Reader or Control.Monad.Instances.