Skip to content

Instantly share code, notes, and snippets.

@jez
Created May 18, 2015 19:38
Show Gist options
  • Save jez/6f398bfd294305863d32 to your computer and use it in GitHub Desktop.
Save jez/6f398bfd294305863d32 to your computer and use it in GitHub Desktop.
Haskell's $ operator in SML
infixr 0 $
fun f $ x = f x
fun compute NONE = "No value"
| compute (SOME x) = "The value is " ^ Int.toString x
fun println str = print $ str ^ "\n"
val _ = println $ compute $ SOME 42
val _ = println $ compute NONE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment