[Haskell-cafe] Scope of type variables in associated types

Bertram Felgenhauer bertram.felgenhauer at googlemail.com
Mon May 21 13:28:49 EDT 2007


Matthew Sackman wrote:
> >         class G a where
> >           data E a :: *
> >           wrap :: a -> E a
> >           unwrap :: E a -> a
> 
> I'm afraid not. I really need wrap to take a 'b' and unwrap to return a 'b'.
> Talking on #haskell to sjanssen last night, he came up with:

How does

  class F a where
      data B a :: *
      data E a :: *
      wrap :: B a -> E a
      unwrap :: E a -> B a

sound? 'B a' would represent the 'b' in your previous attempt,

  class F a b | a -> b where
  ...

Bertram


More information about the Haskell-Cafe mailing list