Re: [Haskell-cafe] how to nicely implement phantom type coersion?

2005-12-09 Thread David Roundy
On Thu, Dec 08, 2005 at 05:31:37PM -0500, Thomas Jger wrote: > Since you're already using GADTs, why not also use them to witness type > equality: Thanks for the suggestion! This just illustrates the rule that when using GADTs the solution to every problem is to introduce another GADT. It amazes

[Haskell-cafe] how to nicely implement phantom type coersion?

2005-12-08 Thread oleg
David Roundy wrote: ] The basic idea is that a patch will have type (Patch a b) where "a" and "b" ] are phantom types. Sequential patches will have identical ending and ] beginning types. So that a sequential pair, for example, can be written as ] ] data Sequential a c where ] Sequential ::

Re: [Haskell-cafe] how to nicely implement phantom type coersion?

2005-12-08 Thread Thomas Jäger
Hello, Since you're already using GADTs, why not also use them to witness type equality: import GHC.Exts data Patch a b = Patch Int Int data Sequential a c where Sequential :: Patch a b -> Patch b c -> Sequential a c data MaybeEq :: * -> * -> * where NotEq :: MaybeEq a b IsEq :: Maybe

[Haskell-cafe] how to nicely implement phantom type coersion?

2005-12-08 Thread David Roundy
Hello all, I've been working on a sort of static consistency-checking framework for darcs patches using GADTs and phantom existential types, and am looking for a bit of advice on whether I might be able to create a class to avoid some tedious coding overhead. The basic idea is that a patch will h