(Untyped) TemplateHaskell should allow 'z for unbound z because it allows [| z |]
The following program is accepted
{-# LANGUAGE TemplateHaskell #-}
import Language.Haskell.TH
main = print =<< [| z |]
while the following is not
{-# LANGUAGE TemplateHaskell #-}
import Language.Haskell.TH
main = print 'z
Not only is this quite inconsistent, it also makes it much harder to encode binding forms with TemplateHaskell (which is pretty uncomfortable anyway given that we lack the syntactic quoting/splicing sugar of macros):
{-# LANGUAGE TemplateHaskell #-}
import Language.Haskell.TH
lam :: Name -> Q Exp -> Q Exp
lam x e = [| \($x) -> e |]
main = print $ $(lam 'x [| x |]) 42
See also Section 10.2 of Template Meta-programming for Haskell.
Edited by Sebastian Graf