Skip to content

Instantly share code, notes, and snippets.

@cacilhas
Created October 16, 2018 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cacilhas/0aff1367b75d97d48819597fa668c862 to your computer and use it in GitHub Desktop.
Save cacilhas/0aff1367b75d97d48819597fa668c862 to your computer and use it in GitHub Desktop.
Eml and Haskell style pipelines in Standard ML
local
(* http://mlton.org/InfixingOperators *)
infix 3 <\ fun x <\ f = fn y => f (x, y) (* Left section *)
infix 3 \> fun f \> y = f y (* Left application *)
infixr 3 /> fun f /> y = fn x => f (x, y) (* Right section *)
infixr 3 </ fun x </ f = f x (* Right application *)
in
infix 2 o
infix 0 :=
infix 1 |> val op|> = op</ (* Elm and Julia pipeline style *)
infixr 1 $ val op$ = op\> (* Haskell pipeline style *)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment