Created
March 11, 2020 12:58
-
-
Save monadplus/28f079800d8c7a57e93cbfd9256df64f to your computer and use it in GitHub Desktop.
Unboxed Types in GHC (Example)
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 #-} | |
module Main where | |
-- More on https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#unboxed-types-and-primitive-operations | |
import GHC.Exts | |
showUnboxedInt :: Int# -> String | |
showUnboxedInt n = (show $ I# n) ++ "#" | |
main :: IO () | |
main = putStrLn (showUnboxedInt 42#) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment