Skip to content

Instantly share code, notes, and snippets.

@dewey92
Last active April 23, 2018 11:40
Show Gist options
  • Select an option

  • Save dewey92/953785c2146076dee17d75a1b2f08efc to your computer and use it in GitHub Desktop.

Select an option

Save dewey92/953785c2146076dee17d75a1b2f08efc to your computer and use it in GitHub Desktop.
Functor Map
fmap<A, B>(f: (v: A) => B, functorA: Functor<A>): Functor<B>
// for Reader, it should be
fmap<D, A, B>(f: (v: A) => B, readerA: Reader<D, A>): Reader<D, B>
// Hindley-Milner style
// fmap :: Functor f => (a -> b) -> f a -> f b
// fmap :: (a -> b) -> Reader d a -> Reader d b
// fmap :: (a -> b) -> (d -> a) -> (d -> b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment