Opened 5 years ago

Closed 5 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: Difficulty: Unknown
Test Case: th/T2817 Blocked By:
Blocking: Related Tickets:

Description

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 5 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 5 years ago by simonpj

  • Owner set to igloo
  • Test Case set to th/T2817
  • Type changed from bug to merge

Fixed by

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

Pls merge

Simon

comment:3 Changed 5 years ago by igloo

  • Resolution set to fixed
  • Status changed from new to closed

Merged

Note: See TracTickets for help on using tickets.