Created
September 14, 2013 08:38
-
-
Save qoelet/6560034 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Another day in #haskell | |
-- (fix $ \goto x -> case x of Nothing -> "hello"; Just _ -> goto Nothing) (Just ()) | |
-- lambdabot: "hello" | |
import Data.Function (fix) | |
goto :: Maybe t -> [Char] | |
goto t = (fix (\goto x -> case x of Nothing -> "hello"; Just _ -> goto Nothing)) t | |
-- ghci> goto (Just 5) | |
-- "hello" | |
-- fix: what does it do? | |
-- ghci> :type fix | |
-- fix :: (a -> a) -> a | |
-- (def?) | |
-- fix f = let x = f x in x | |
-- see: http://stackoverflow.com/questions/4787421/how-do-i-use-fix-and-how-does-it-work | |
-- what is domain theory? | |
-- ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment