Created
March 5, 2015 03:31
-
-
Save aavogt/c894be768539ac9feb06 to your computer and use it in GitHub Desktop.
dynamic binding is confusing
This file contains 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 TemplateHaskell #-} | |
module MJ where | |
import Language.Haskell.TH | |
x = False | |
xE = varE (mkName "x") -- dyn "x" | |
xE' = varE 'x | |
{- | | |
>>> :set -XTemplateHaskell | |
>>> $f True | |
True | |
>>> $f' True | |
False | |
-} | |
f = [| \x -> $xE |] | |
f' = [| \x -> $xE' |] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment