HN2new | past | comments | ask | show | jobs | submitlogin

I think in that case, for clarity, I'd rather write:

    f (Just (i, cs)) = Just (i, map toUpper cs)
    f x = x
Especially because I find the instances that apply fmap to the second item of a two-item tuple confusing.

But in general I don't mind that kind of use of '.'; I was talking more about any expression like "g . (f .)" or similarly inscrutable curries.



The chained Functors, Traversables etc are useful when you are still writing and changing your code---it's really easy to add or remove a layer.

Yes, some of the instances can be confusing. Adding type signatures afterwards usually clears it up. (The types will tell the reader that for tuples, fmap operates on the second element.)

Yes, "g . (f .)" might be a bit harder to read. Though when I first discovered functor-composition by myself, I was just playing around with exactly that kind of point-less nonsense for fun.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: