Skip to content

Instantly share code, notes, and snippets.

@aavogt
Created March 5, 2015 03:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aavogt/c894be768539ac9feb06 to your computer and use it in GitHub Desktop.
Save aavogt/c894be768539ac9feb06 to your computer and use it in GitHub Desktop.
dynamic binding is confusing
{-# 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