fsel :: Int -> Int -> x
fsel x y = $(sel x y) ...
Imagine a stupid case for
fsel :: Int -> Int -> Int
fsel x y = $(sel x y) (x,y)
The compiler complains that
GHC stage restriction: `x'
is used in a top-level splice, and must be imported, not defined locally
In the first argument of `sel', namely `x'
In the expression: $[splice](sel x y) (x, y)
In the definition of `fsel': fsel x y = $[splice](sel x y) (x, y)
what, indeed, makes sense.
However, is there a possible way to generate Haskell functions from TH without having to instanciate its arguments?