-ddump-splices missing parentheses in pattern
Main.hs
{-# LANGUAGE TemplateHaskell #-}
import Language.Haskell.TH
import Control.Monad
data Cons a b = Cons a b
data Nil = Nil
nestedTuple n = do
xs <- replicateM n (newName "x")
return $ LamE [foldr (\v prev -> ConP 'Cons [VarP v,prev]) (ConP 'Nil []) xs]
(TupE $ map VarE xs)
Load Main into ghci:
*Main> :set -XTemplateHaskell
*Main> :set -ddump-splices
*Main> :t $(nestedTuple 3)
<interactive>:1:2:
<interactive>:1:2-14: Splicing expression
nestedTuple 3
======>
\ Cons x[aYQ] Cons x[aYR] Cons x[aYS] Nil
-> (x[aYQ], x[aYR], x[aYS])
In the expression: $(nestedTuple 3)
$(nestedTuple 3) :: Cons t (Cons t1 (Cons t2 Nil)) -> (t, t1, t2)
However the inferred type and behavior of the function suggests that the Cons constructors are associated to the right.
Trac metadata
Trac field | Value |
---|---|
Version | 6.12.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Template Haskell |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | vogt.adam@gmail.com |
Operating system | |
Architecture |