#8625 closed bug (fixed)

GHCi does not support some TH elements, while those elemenst are working in hs files

Reported by: danilo2 Owned by:
Priority: normal Milestone:
Component: GHCi Version: 7.7
Keywords: Cc: hvr
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: th/T8625
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

Hello. Below is a code, which works when using runhaskell, but does not work in GHCi.

In GHCi we get following error: runQ [d| instance ( y ~ (t->t) ) => Member Vector y where member v = test |] <interactive>:19:6:

Exotic predicate type not (yet) handled by Template Haskell

y ~ (t -> t)

code:

{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TemplateHaskell #-} module Main where

import Language.Haskell.TH

class a ~ b => HEq a b

test :: a -> a test x = x

data Vector class Member a b where member :: a -> b

main :: IO () main = print =<< runQ [d| instance y ~ (t->t) => Member Vector y where member v = test |]

Change History (4)

comment:1 Changed 21 months ago by danilo2

We discovered now, that the error not always appears in GHCi session. It appears if we use following commands:

:set -XTypeFamilies :set -XTemplateHaskell :set -XUndecidableInstances :set -XFlexibleInstances :set -XMultiParamTypeClasses :m + Language.Haskell.TH

data Vector = Vector let test x = x class Member a f where member :: a -> f runQ [d| instance ( y ~ (t->t) ) => Member Vector y where member v = test |]

<interactive>:19:6:

Exotic predicate type not (yet) handled by Template Haskell

y ~ (t -> t)

comment:2 Changed 20 months ago by Simon Peyton Jones <simonpj@…>

In 053a9d15031b0b33adc77eaadc5536a43dc7de33/ghc:

Handle parens in predicates when converting to TH

This fixes Trac #8625

comment:3 Changed 20 months ago by Simon Peyton Jones <simonpj@…>

comment:4 Changed 20 months ago by simonpj

  • Resolution set to fixed
  • Status changed from new to closed
  • Test Case set to th/T8625

Thank you. This one was easy, happily.

Simon

Note: See TracTickets for help on using tickets.