From 8b9ec04c25e2ddf34c9e0b925fb4283f40f54468 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Wed, 20 Jan 2021 10:16:19 -0500 Subject: Load Alpha in ghci startup and add pronunciations --- Alpha.hs | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) (limited to 'Alpha.hs') 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 ( (a -> b) -> f a -> f b f (a -> b) -> f0 (f1 a) -> f0 (f1 b) ( 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 -- cgit v1.2.3