summaryrefslogtreecommitdiff
path: root/Alpha.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2021-01-20 10:16:19 -0500
committerBen Sima <ben@bsima.me>2021-01-22 08:00:27 -0500
commit8b9ec04c25e2ddf34c9e0b925fb4283f40f54468 (patch)
tree8b3b0fbae94eec5912130da1ba2e7ab362bc9d72 /Alpha.hs
parent92d3ab89ffd6e65d5a79de0cf5907aad3786ce44 (diff)
Load Alpha in ghci startup and add pronunciations
Diffstat (limited to 'Alpha.hs')
-rw-r--r--Alpha.hs35
1 files changed, 27 insertions, 8 deletions
diff --git a/Alpha.hs b/Alpha.hs
index 113c85a..93308a0 100644
--- a/Alpha.hs
+++ b/Alpha.hs
@@ -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