Skip to content

Instantly share code, notes, and snippets.

@gclaramunt
Created July 11, 2014 16:38
Show Gist options
  • Save gclaramunt/ebabc4afb67afdec2df4 to your computer and use it in GitHub Desktop.
Save gclaramunt/ebabc4afb67afdec2df4 to your computer and use it in GitHub Desktop.
Dangeours haskell
{-# 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