diff options
Diffstat (limited to 'Alpha.hs')
-rw-r--r-- | Alpha.hs | 35 |
1 files changed, 27 insertions, 8 deletions
@@ -17,6 +17,11 @@ -- -- It seems unnecessarily different at first but it makes things easier -- to read quickly. +-- +-- Pronunciations are given for operators and are taken from +-- [Hoon](https://urbit.org/docs/tutorials/hoon/hoon-school/hoon-syntax/). +-- Pronouncing operators as you write the code is actually a nice way to +-- interact with the codebase, and I do recommend it. module Alpha ( -- * Re-export Protolude module X, @@ -75,44 +80,58 @@ compose :: (a -> b) -> (b -> c) -> (a -> c) compose f g x = g (f x) -- | Right-composition operator -infixl 9 .> - +-- +-- Pronunciation: dot-gar (.>) :: (a -> b) -> (b -> c) -> (a -> c) f .> g = compose f g --- | Left-composition operator -infixr 9 <. +infixl 9 .> +-- | Left-composition operator +-- +-- Pronunciation: gal-dot (<.) :: (b -> c) -> (a -> b) -> (a -> c) g <. f = compose f g +infixr 9 <. + -- | Alias for map, fmap, <$> +-- +-- Pronunciation: gal-fas (</) :: Functor f => (a -> b) -> f a -> f b f </ g = fmap f g -- | 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 -- | Normal function application. Do the right side, then pass the -- return value to the function on the left side. -infixr 0 <| - +-- +-- Pronunciation: gal-bar (<|) :: (a -> b) -> a -> b f <| g = f g +infixr 0 <| + -- | Reverse function application. Do the left side, then pass the -- return value to the function on the right side. -infixl 0 |> - +-- +-- Pronunciation: bar-gar (|>) :: a -> (a -> b) -> b f |> g = g f +infixl 0 |> + -- | Alias for <&>. Can be read as "and then". Basically does into a -- functor, does some computation, then returns the same kind of -- functor. Could also be defined as `f >>= return <. g` +-- +-- Pronunciation: fas-gar (/>) :: Functor f => f a -> (a -> b) -> f b f /> g = fmap g f |