Created
July 11, 2014 16:38
-
-
Save gclaramunt/ebabc4afb67afdec2df4 to your computer and use it in GitHub Desktop.
Dangeours haskell
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
{-# LANGUAGE MagicHash #-} | |
-- | Main entry point to the application. | |
module Main where | |
import GHC.Exts | |
-- | The main entry point. | |
main :: IO () | |
main = do | |
putStrLn $ showUnboxedInt 1# | |
putStrLn $ showUnboxedInt (unbox 1) | |
putStrLn $ showUnboxedInt (unbox undefined) | |
unbox :: Int -> Int# | |
unbox undefined = 0# | |
unbox (I# n) = n | |
showUnboxedInt n = (show $ I# n) ++ "#" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment