diff options
author | Chris Martin <ch.martin@gmail.com> | 2016-03-11 10:40:16 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-03-11 13:20:19 +0100 |
commit | 06b70ffc7b17bd34ea771b8be11574c4002db6c8 (patch) | |
tree | 9aa293457c92a79880fcd84bf398e949ae042ee0 | |
parent | 90b8af05660dc2b36c62a07ff86703cbb9e04766 (diff) | |
download | haskell-06b70ffc7b17bd34ea771b8be11574c4002db6c8.tar.gz |
Add doc to (<$>) explaining its relationship to ($)
Reviewers: bgamari, hvr, austin
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1989
-rw-r--r-- | libraries/base/Data/Functor.hs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libraries/base/Data/Functor.hs b/libraries/base/Data/Functor.hs index 72ee9653e1..8eba29e0c7 100644 --- a/libraries/base/Data/Functor.hs +++ b/libraries/base/Data/Functor.hs @@ -33,6 +33,15 @@ infixl 4 <$> -- | An infix synonym for 'fmap'. -- +-- The name of this operator is an allusion to '$'. +-- Note the similarities between their types: +-- +-- > ($) :: (a -> b) -> a -> b +-- > (<$>) :: Functor f => (a -> b) -> f a -> f b +-- +-- Whereas '$' is function application, '<$>' is function +-- application lifted over a 'Functor'. +-- -- ==== __Examples__ -- -- Convert from a @'Maybe' 'Int'@ to a @'Maybe' 'String'@ using 'show': |