diff options
author | Ben Sima <ben@bsima.me> | 2021-02-03 09:32:16 -0500 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2021-02-03 09:33:36 -0500 |
commit | c88c088f22abd64101163980c334b9a4102d5f71 (patch) | |
tree | 956ceb02853c19ded01c55da9bb6987187468276 /Alpha.hs | |
parent | 7417b1c2c29dcf2b48ecdd6b283c506e9ec23230 (diff) |
Rename double-fmap operator and remove extra comments
Diffstat (limited to 'Alpha.hs')
-rw-r--r-- | Alpha.hs | 23 |
1 files changed, 12 insertions, 11 deletions
@@ -39,7 +39,8 @@ module Alpha -- * Mapping (/>), (</), - (<//), + (<%), + (%>), -- * inding bind, @@ -98,33 +99,33 @@ compose f g x = g (f x) (.>) :: (a -> b) -> (b -> c) -> (a -> c) f .> g = compose f g --- infixl 0 .> - -- | Left-composition operator -- -- Pronunciation: gal-dot (<.) :: (b -> c) -> (a -> b) -> (a -> c) g <. f = compose f g --- infixr 0 <. - -- | Alias for map, fmap, <$> -- -- Pronunciation: gal-fas (</) :: Functor f => (a -> b) -> f a -> f b f </ g = fmap f g --- infixr 1 </ +-- | Double fmap. A function on the right goes "into" two functors +-- (i.e. it goes "two levels deep"), applies the function to the inner +-- values, then returns the result wrapped in the two functors. +-- +-- Pronunciation: gal-cen +(<%) :: (Functor f0, Functor f1) => (b -> a) -> f0 (f1 b) -> f0 (f1 a) +(<%) = fmap <. fmap -- | Double fmap. A function on the left goes "into" two functors -- (i.e. it goes "two levels deep"), applies the function to the inner -- values, then returns the result wrapped in the two functors. -- --- Pronunciation: gal-fas-fas -(<//) :: (Functor f0, Functor f1) => (a -> b) -> f0 (f1 a) -> f0 (f1 b) -(<//) = fmap .> fmap - --- infixr 1 <// +-- Pronunciation: cen-gar +(%>) :: (Functor f0, Functor f1) => (a -> b) -> f0 (f1 a) -> f0 (f1 b) +(%>) = fmap .> fmap -- | Normal function application. Do the right side, then pass the -- return value to the function on the left side. |