[Haskell-cafe] Type synonym family inside type class

Simon Peyton-Jones simonpj at microsoft.com
Wed Dec 2 09:45:49 EST 2009


I agree this is wrong. I've created a Trac bug report http://hackage.haskell.org/trac/ghc/ticket/3714

Thanks for pointing it out

Simon

| -----Original Message-----
| From: haskell-cafe-bounces at haskell.org [mailto:haskell-cafe-
| bounces at haskell.org] On Behalf Of Martijn van Steenbergen
| Sent: 27 November 2009 10:35
| To: Haskell Cafe
| Subject: [Haskell-cafe] Type synonym family inside type class
| 
| Hello,
| 
| I have a type family and a type class:
| 
| > type family ErrorAlg (f :: (* -> *) -> * -> *) e ix :: *
| 
| > class MkErrorAlg f where
| >   mkErrorAlg :: ErrorAlg f e a -> f (K0 a) ix -> Either e a
| 
| Instances for these two really go hand in hand, so I thought I would
| move the type family into the type class. However, this causes GHC to
| complain about the type variables that are bound on the LHS of the type
| synonym:
| 
| > Not in scope: type variable `e'
| > Not in scope: type variable `ix'
| 
| In function types, using new type variables (i.e. type variables not
| bound by the type class header) implicitly means universal
| quantification over these variables. Why is this disallowed in type
| families inside type classes?
| 
| Thanks,
| 
| Martijn.
| _______________________________________________
| Haskell-Cafe mailing list
| Haskell-Cafe at haskell.org
| http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list