Skip to content

Instantly share code, notes, and snippets.

@TheSeamau5
Created August 30, 2015 23:39
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 TheSeamau5/5cd3271ace64176bc43d to your computer and use it in GitHub Desktop.
Save TheSeamau5/5cd3271ace64176bc43d to your computer and use it in GitHub Desktop.
type alias Continuation a r = (a -> r) -> r
andThen : Continuation a r -> (a -> Continuation b r) -> Continuation b r
andThen cont f br =
cont (flip f br)
constant : a -> Continuation a r
constant a f = f a
test : Continuation Float a
test =
constant 4
`andThen` \x -> constant (5 * x)
`andThen` \y -> constant (y / 6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment