Skip to content

Instantly share code, notes, and snippets.

@dyokomizo
Last active January 3, 2016 09:39
Show Gist options
  • Save dyokomizo/8443850 to your computer and use it in GitHub Desktop.
Save dyokomizo/8443850 to your computer and use it in GitHub Desktop.
module Fix where
left :: a -> (a -> c) -> (b -> c) -> c
left a l r = l a
right :: b -> (a -> c) -> (b -> c) -> c
right b l r = r b
fix f a = f a (fix f) id
@dyokomizo
Copy link
Author

-- ghci output
Fix> fix (\x -> if x > 0 then left (x - 1) else right True) 10
True

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment