Created
August 14, 2019 08:55
-
-
Save chrisdone/b9aa8c7f05851f678c970d45d7eeadba to your computer and use it in GitHub Desktop.
File embed expansion demo
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
> :set -XOverloadedStrings | |
> :set -XTemplateHaskell | |
> import Language.Haskell.TH | |
> $(bsToExp "Hello, World" >>= stringE . show) | |
"AppE (VarE GHC.IO.Unsafe.unsafePerformIO) (AppE (AppE (VarE Data.ByteString.Unsafe.unsafePackAddressLen) \ | |
\(LitE (IntegerL 12))) (LitE (StringPrimL [72,101,108,108,111,44,32,87,111,114,108,100])))" | |
> | |
> :set -ddump-splices | |
> $(bsToExp "Hello, World") | |
<interactive>:12:3-24: Splicing expression | |
bsToExp "Hello, World" | |
======> | |
unsafePerformIO ((unsafePackAddressLen 12) "Hello, World"#) | |
"Hello, World" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment