
I have tried the examples as well and, indeed, I get a shadowing warning for the first example (along with an unused warning). ghci> :set -XTemplateHaskell -Wall ghci> let f x $([p| x |]) = x in f 1 2 warning: This binding for 'x' shadows... warning: Defined but not used: 'x' However, for the second example I only get the unused warning. ghci> let f $([p| x |]) x = x in f 1 2 warning: Defined but not used: 'x' This still seems to be a bit inconsistent (not mentioning that I would also expect both examples to fail because of non-linear occurrences of 'x'). Cheers, Finn On 27/04/2021 16:28, Tom Ellis wrote:
On Tue, Apr 27, 2021 at 04:06:27PM +0200, Kai-Oliver Prott wrote:
Moreover, it seems odd that the "x" on the right side always refers to the rightmost pattern variable "x" (regardless if quoted or not).
I guess this comes from the translation
f x x = <rhs>
->
f = \x -> \x -> <rhs>
I'm not familiar enough with TH to say whether one should expect a warning though.
Tom _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.