Opened 8 years ago

Closed 8 years ago

#2817 closed merge (fixed)

Template Haskell conversion fails with "malformed type"

Reported by: simonpj Owned by: igloo
Priority: normal Milestone: 6.10.2
Component: Compiler Version: 6.10.1
Keywords: Cc: nicolas.frisby@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: th/T2817
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Nicholas Frisby writes: When using Template Taskell (via Derive) to generate this (exact) instance:

  instance Foldable ((->) Int) => Foldable Data.Derivable.InterpreterLib.Test.List
      where foldMap f (Cons x0 x1) = (const mempty Cons `mappend` foldMap f x0)
                                      `mappend` foldMap f x1
            foldMap f (Nil) = const mempty Nil

I realize the context is unsatisfiable. My issue, is that I can't even reach that "challenge". I get this error instead:

   Malformed type AppT ArrowT (ConT GHC.Base.Int)
    When splicing generated code into the program

Change History (3)

comment:1 Changed 8 years ago by simonpj

Good bug. Here is a small test case:

module TH( x ) where 
import Language.Haskell.TH

data T f = MkT (f Int)

x = $(return (SigE (VarE 'x) (AppT (ConT ''T) (AppT ArrowT (ConT ''Int)))))

The bug is in the conversion from TH syntax to HsSyn in Convert.hs.

comment:2 Changed 8 years ago by simonpj

Owner: set to igloo
Test Case: th/T2817
Type: bugmerge

Fixed by

Wed Nov 26 15:40:22 GMT 2008
  * Fix Trac #2817 (TH syntax -> HsSyn conversion)

Pls merge


comment:3 Changed 8 years ago by igloo

Resolution: fixed
Status: newclosed


Note: See TracTickets for help on using tickets.