[Haskell-cafe] Template Haskell question
Kai-Oliver Prott
kai.prott at hotmail.de
Tue Apr 27 14:06:27 UTC 2021
Dear Cafe,
what is the reasoning behind the behavior of the following two Haskell
expressions:
ghci> :set -XTemplateHaskell
ghci> let f x ($([p| x |])) = x in f 1 2
2
ghci> let f ($([p| x |])) x = x in f 1 2
2
I'd have guessed that they should both fail compilation with
"Conflicting definitions for ‘x’" like the following expression.
ghci> let f x x = x in f 1 2
error: ...
Moreover, it seems odd that the "x" on the right side always refers to
the rightmost pattern variable "x" (regardless if quoted or not).
Cheers,
Kai
More information about the Haskell-Cafe
mailing list