Skip to content

Instantly share code, notes, and snippets.

@friedbrice
Last active October 28, 2019 16:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save friedbrice/d0e94b9e81ee1436a0f21da7913a511c to your computer and use it in GitHub Desktop.
Save friedbrice/d0e94b9e81ee1436a0f21da7913a511c to your computer and use it in GitHub Desktop.
{-# LANGUAGE FlexibleInstances, OverloadedStrings #-}
import Data.Function ((&))
import Data.String (IsString)
data X
data Y
data Z
data M a
instance Eq Y
instance IsString Y
instance Eq Z
instance IsString Z
instance Eq (X -> Z)
instance IsString (X -> Z)
instance Functor M
instance Applicative M
instance Monad M
instance Eq (M Y)
instance IsString (M Y)
f = undefined
g = undefined
p = undefined
x = undefined
xs = undefined
fs = undefined
f :: X -> Y
g :: Y -> Z
p :: X -> M Y
x :: X
xs :: M X
fs :: M (X -> Y)
pronounce =
let
"f of x" = f $ x
"g of the f of x" = g . f $ x
"g of the f" = g . f
"x into f" = x & f
"f mapped over xs" = f <$> xs
"p bind xs" = p =<< xs
"xs processed by p" = xs >>= p
"fs join xs" = fs <*> xs
in
pronounce
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment