Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expound on functor map type signature #62

Closed
mikehaertl opened this issue Jul 18, 2015 · 2 comments
Closed

Expound on functor map type signature #62

mikehaertl opened this issue Jul 18, 2015 · 2 comments

Comments

@mikehaertl
Copy link

In chapter 8 I found this type signature:

map :: Functor f => (a -> b) -> f a -> f b

While the introductory chapter on Hindley-Milner was easy to follow, I think it doesn't cover the above signature. The problem is the f a and f b part. What does that mean? f multiplied by a? Or f applied to a? Or something else? Maybe you could elaborate on this a little.

Oh, and by the way, thanks for your impressive work so far. It's a joy to read and I like how concise you present the main principles.

@DrBoolean
Copy link

Thanks! Yeah, I'll definitely have to work both type constraints and f a into the signature chapter.

To elaborate here: f a simply means functor with an a in it like Maybe("test") or IO(2).

@KtorZ KtorZ closed this as completed in ab1353b Feb 20, 2016
@dmitriz
Copy link

dmitriz commented Nov 22, 2016

Mathematically, f a should mean the functor f applied to the type a, and the result is the new type. Now replace types by objects and you get the exact maths definition (https://en.wikipedia.org/wiki/Functor)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants