question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Functors and functions both called `f` can be confusing

See original GitHub issue

In https://github.com/fantasyland/fantasy-land#map-method the letter f denotes a functor:

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

But in the next line the same f is a function:

u.map(x => f(g(x)))

Would it be less confusing to use different letters perhaps?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
gabejohnsoncommented, May 4, 2018

This looks like a duplicate of #217 to me.

1reaction
i-am-tomcommented, May 4, 2018

It bears repeating that these identifiers don’t have to be single letters; would it be easier if the definition were simply map :: Functor flType => flType a -> (a -> b) -> flType b?

Read more comments on GitHub >

github_iconTop Results From Across the Web

The name "Functor" can be confusing; it's a thing you apply a ...
The name "Functor" can be confusing; it's a thing you apply a function to, not a function itself. A Functor is a type...
Read more >
category theory - The definition of functor. Is a functor a function?
So, you can think about a functor as a "function"(which indeed is not) between both objects and morphisms. For your another confusion, ...
Read more >
confused about function as instance of Functor in haskell
The fmap instance for (->) r (i.e. functions) is literally just composition. From the source itself: instance Functor ((->) r) where fmap ...
Read more >
Functors - Bartosz Milewski's Programming Cafe
Just like functions, functors may do both collapsing and embedding. The embedding aspect is more prominent when the source category is much ...
Read more >
Functors, Applicative Functors and Monoids
Calling fmap on a functor should just map a function over the functor, nothing more. This behavior is described in the functor laws....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found