GHC sometimes ignores ' vs '' when quoting built-in names in TH
If I have
{-# LANGUAGE TemplateHaskell #-}
module Bug where
import Language.Haskell.TH
list = $( conE ''(:) `appE` litE (IntegerL 5) `appE` conE '[] )
this compiles, and evaluating list gives me [5].
But I would expect a failure, because no type exists named (:). (Important: I've used '' there, not ', which should work.)
I think that the problem is that isBuiltInOcc_maybe does not always check the namespace of the OccName it is looking up.