Contexts in Existential Types

Simon Peyton-Jones simonpj@microsoft.com
Wed, 14 Mar 2001 02:10:27 -0800


Yes, with your modification, it works just fine in GHC, and I guess
therefore hbc. Documentatino in the user manual.
		http://haskell.cs.yale.edu/ghc/

Simon

| -----Original Message-----
| From: Ashley Yakeley [mailto:ashley@semantic.org]
| Sent: 14 March 2001 04:22
| To: Haskell List
| Subject: Re: Contexts in Existential Types
| 
| 
| At 2001-03-13 19:36, I wrote:
| 
| >Would it be appropriate for Haskell to be able to remember 
| contexts in 
| >existential types? For instance, currently this does not 
| work in Hugs:
| >
| >--
| >class Charable a where
| >	obtainChar :: a -> Char
| >
| >instance Charable Char where
| >	obtainChar c = c
| >
| >data AnyCharable = forall c. (Charable c) => MkAnyCharable c
| >
| >anyA = MkAnyCharable 'a'
| >recoverA = obtainChar ((\(MkAnyCharable c) -> c) anyA)
| >--
| 
| Whoops, my error. It is possible to do this:
| 
| --
| recoverA = (\(MkAnyCharable c) -> obtainChar c) anyA
| --
| 
| Sorry...
| 
| -- 
| Ashley Yakeley, Seattle WA
| 
| 
| _______________________________________________
| Haskell mailing list
| Haskell@haskell.org
| http://www.haskell.org/mailman/listinfo/haskell
|