GHC tries to typecheck quotations.  In this case it's trying to typecheck the 
declaration
        type Bar = FooT $t
Part of type checking is rejecting recursive type synonyms.  Here GHC is 
rejecting it because it *might* be recursive, depending on how $t is filled in.

The trouble is that we really *can't*  typecheck partial declarations like this 
one.  All this will be fixed when we fold in the new Template Haskell story 
(it'll be in 7.8).  See my blog post on the GHC Trac (from about 2 yrs ago) 
describing the change.  (I'm on a train so don't know the URL.)  Geoff has made 
the change... it just needs to be merged in.

Simon

|  -----Original Message-----
|  From: Haskell-Cafe [mailto:haskell-cafe-boun...@haskell.org] On Behalf Of 
David
|  Fox
|  Sent: 20 August 2013 22:00
|  To: Haskell Cafe
|  Subject: [Haskell-cafe] What am I missing? Cycle in type synonym declarations
|  
|  This file gives me the error "Cycle in type synonym declarations"  Can
|  anyone tell me why?  I'm just trying to write a function to create a
|  type that is a FooT with the type parameter fixed.
|  
|  {-# LANGUAGE TemplateHaskell #-}
|  import Language.Haskell.TH (Q, Dec, TypeQ)
|  
|  data FooT a = FooT a
|  
|  foo :: TypeQ -> Q [Dec]
|  foo t = [d| type Bar = FooT $t |]
|  
|  _______________________________________________
|  Haskell-Cafe mailing list
|  Haskell-Cafe@haskell.org
|  http://www.haskell.org/mailman/listinfo/haskell-cafe


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to