[Haskell] problem building syb-generics

Simon Peyton-Jones simonpj at microsoft.com
Tue Jul 4 08:20:19 EDT 2006


[Redirecting to ghc-users]

Matthew

Lexically-scoped type variables are undergoing a slight upheaval in GHC 6.6 that has not quite settled, and that is what you are running into.

Pattern-bound lexically-scoped type variables are particularly problematic
	f (x::a) = ...

The ones that are totally safe are
	f :: forall a. a->a
	f x = ...
In this, 'a' is in scope in the whole of f's right-hand side.

Maybe you can refactor the code a little to use this?  I'm sorry about this.   We need to get the rules for lexically scoped type variables nailed down (for Haskell Prime as well as GHC) but it keeps slipping down my priority list.  It's important but unrewarding!

Simon

| -----Original Message-----
| From: haskell-bounces at haskell.org [mailto:haskell-bounces at haskell.org] On Behalf Of Matthew Pocock
| Sent: 04 July 2006 12:38
| To: haskell at haskell.org
| Subject: [Haskell] problem building syb-generics
| 
| Hi,
| 
| I had some trouble getting syb-generics 2.9 to compile with ghc 6.5 (don't
| ask - I should probably be waiting for a stable release). I fixed the first
| problem by replacing a definition with in-line type info by splitting the
| type out, although I am not sure that I have done it right. Can anybody shed
| some light on this?
| 
| Matthew
| 
| 
| ---------the error--------
| Building syb-generics-2.9...
| [1 of 7] Compiling Data.Context     ( Data/Context.hs,
| dist/build/Data/Context.o )
| 
| Data/Context.hs:48:9:
|     A pattern type signature cannot bind scoped type variables `l'
|       unless the pattern has a rigid type context
|     In the pattern: l :: l ()
|     In the definition of `pairCtx':
|         pairCtx (l :: l ()) (r :: r ()) = undefined :: PairCtx l r ()
| 
| --------original code------
| pairCtx (l::l ()) (r::r ())
|   = undefined::PairCtx l r ()
| 
| --------my code-------------
| pairCtx :: l () -> r () -> PairCtx l r ()
| pairCtx l r
|   = undefined
| _______________________________________________
| Haskell mailing list
| Haskell at haskell.org
| http://www.haskell.org/mailman/listinfo/haskell


More information about the Glasgow-haskell-users mailing list