I could not figure out why I am getting "GHC stage restriction" in the following code:
import Language.Haskell.TH
rules :: [ExpQ]
rules = [ [| \a -> a |], [| \_ -> 1 |] ]
findTransforms :: Int -> [ExpQ] -> Bool
findTransforms _ [] = False
findTransforms e (r:rs) = if ($r e) == 1 then True else findTransforms e rs
(Do not worry if code does not make anything useful - it is extracted minimal example obfuscated for clarity).
I do not call any functions from spliced code. Why stage restriction?
EDIT1: edited to give even simpler code example