[Haskell-cafe] Type level sets with GADTs, fundeps etc
Jeff Polakow
jeff.polakow at db.com
Tue Jul 15 10:02:23 EDT 2008
Hello,
> > > data LSet t where
> > > Nil :: LSet Nil
> > > --either add the new element or do nothing
> > > Ins :: (Member a t b
> > > , If b (LSet t) (LSet (a ::: t)) r)
> > > => L a -> LSet t -> r
> > >
> > The constructor Ins needs to return an LSet. Maybe try replacing
> occurrences of r with (LSet r).
> >
>
> I expected that r would be an LSet, as its the output of If which
> returns its 2nd or 3rd argument:
>
> class If p x y z | p x y -> z
> where if' :: p -> x -> y -> z
> instance If T x y x
> instance If F x y y
>
Type classes are open so there is nothing to prevent you from adding
another instance for If, perhaps in a different module, which returns some
arbitrary type.
-Jeff
---
This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080715/3e2c239c/attachment-0001.htm
More information about the Haskell-Cafe
mailing list