[Haskell-beginners] Type constructors sharing a common field

Benjamin Edwards edwards.benj at gmail.com
Wed Apr 30 13:51:56 UTC 2014

> Hmm, what does the <$> mean here?  I know it for functor application, but
> I don't
> understand how that works in this example.

It's a synonym for fmap. Lens' is a type synonym. age really has function
 type forall Functor f. (Int -> f Int)  -> Person -> f Person. Applying k x
gives me f Int and fmapping the constructor gives me f Person. If you want
to read an excellent but challenging article on why lenses work this way
click here <https://www.fpcomplete.com/user/tel/lenses-from-scratch>.
Otherwise the signature should give you enough to be able to play type
tetris to figure out where the fmap comes in (hopefully). This isn't super
beginner friendly, but it's where haskell seems to be headed these days.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20140430/94bb94ad/attachment.html>

More information about the Beginners mailing list