Closed dmitriz closed 6 years ago
Suggestions? g(h(x))
?
@davidchambers
Suggestions?
g(h(x))
?
It is less confusing, but g
and h
still look too similar to f
.
Here the meaning of f
is different from anything else.
It would be nice to make it look fundamentally different, e.g. as the capital F
instead of f
,
as in the math books.
Capitalized identifiers refer to concrete types, such as Boolean
in filter :: Filterable f => f a ~> (a -> Boolean) -> f a
.
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
?
Capitalized identifiers refer to concrete types, such as
Boolean in filter :: Filterable f => f a ~> (a -> Boolean) -> f a
.
Since Boolean
is written fully and F
an abbreviation, that would still look different.
@dmitriz The point is that, in Haskell, a capital letter always indicates a concrete type, class, family, etc - never a variable. It would be a shame to diverge, imo
@i-am-tom
The point is that, in Haskell, a capital letter always indicates a concrete type, class, family, etc - never a variable. It would be a shame to diverge, imo
Haskell suffers from the same confusion - functors and functions are called f
. I have never understood why. As if they run out of letters :)
Also both syntax and even operator names (return
vs of
) are already different in Haskell.
In Haskell, types and values live in different namespaces. This allows punning such as Identity :: a -> Identity a
, which is very nice in my opinion.
They live in different namespaces in FL as well.
This looks like a duplicate of #217 to me.
@davidchambers
In Haskell, types and values live in different namespaces. This allows punning such as Identity :: a -> Identity a, which is very nice in my opinion.
Do you mean using the same word to mean different things, depending on the context? Does that not expose the code to more bugs due to possible messed up context e.g. by mistake? I always find it harder to read, as it requires additional mental effort to recoginize the context.
@gabejohnson
This looks like a duplicate of #217 to me.
True, was long time ago, I forgot it ;)
Which, however, lead to PR with many more suggestions, that was closed by @davidchambers for reasons not related to this issue
Per @gabejohnson's comment, closing in favor of #217. If there's more to discuss, let's reopen #217 and continue the discussion there. If that's wrong, and this issue is different from #217, let's re-open and continue discussion here.
EDIT: @dmitriz sorry, we were typing at about the same time :). Didn't mean to reply almost immediately after you.
@joneshf I will leave it at that, I feel it does create some extra confusion for the newcomers, but if no one feels the need to change it, I'm not going to press it ;)
In https://github.com/fantasyland/fantasy-land#map-method the letter
f
denotes a functor:But in the next line the same
f
is a function:Would it be less confusing to use different letters perhaps?