.net and haskell
I was reading some .net stuff (ducks) on microsoft, and they mentioned haskell as one of the languages someone was targetting for it. Anyone know anything about this project? Cheers! + Ron Legere -- http://www.its.caltech.edu/~legere Caltech Quantum Optics MC 12-33 Pasadena CA 91125 626-395-8343 FAX: 626-793-9506 + ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Re: Extensible data types?
It is exactly for reasons like these that we developped our small attribute grammar system: http://www.cs.uu.nl/groups/ST/Software/UU_AG/index.html Doaitse Swiesrtra At 7:21 AM -0200 10/20/00, José Romildo Malaquias wrote: >Hello. > >I am back with the issue of extensible union types. Basically >I want to extend a data type with new value constructors. >Some members of the list pointed me to the paper > >"Monad Transformers and Modular Interpreters" >Sheng Liang, Paul Hudak and Mark Jones > >The authors suggest using a type constructor to express >the disjoint union of two other types: > >data Either a b = Left a | Right b > >which indeed is part of the Haskell 98 Prelude. Then they introduce >a subtype relationship using multiparameter type classes: > >class SubType sub sup where > inj :: sub -> sup -- injection > prj :: sup -> Maybe sub -- projection > >The Either data type consructor is then used to express >the desired subtype relationshipe: > >instance SubType a (Either a b) where > inj = Left > prj (Left x) = Just x > prj _ = Nothing > >instance SubType a b => SubType a (Either c b) where > inj = Right . inj > prj (Right x) = prj x > prj _ = Nothing > >The authors implemented their system in Gofer, due to >restrictions in the type class system of Haskell. >But now that there are Haskell extensions to support >multiparametric type classes, that could be implemented >in Haskell. > >The above code fails to type check due to instances >overlapping. Hugs gives the following error message: > >ERROR "SubType.hs" (line 10): Overlapping instances for class "SubType" >*** This instance : SubType a (Either b c) >*** Overlaps with : SubType a (Either a b) >*** Common instance : SubType a (Either a b) > >(I did not check Gofer, but is there a way to solve these >overlapping of instances in it?) > >So this is scheme is not going to work with Haskell (extended >with multiparameter type classes). > >I would like hear any comments from the Haskell comunity on >this subject. Is there a workaround for the overlapping instances? > >Regards. > >Romildo >-- >Prof. José Romildo Malaquias <[EMAIL PROTECTED]> >Departamento de Computação >Universidade Federal de Ouro Preto >Brasil > >___ >Haskell mailing list >[EMAIL PROTECTED] >http://www.haskell.org/mailman/listinfo/haskell -- __ S. Doaitse Swierstra, Department of Computer Science, Utrecht University P.O.Box 80.089, 3508 TB UTRECHT, the Netherlands Mail: mailto:[EMAIL PROTECTED] WWW: http://www.cs.uu.nl/ PGP Public Key: http://www.cs.uu.nl/people/doaitse/ tel: +31 (30) 253 3962, fax: +31 (30) 2513791 __ ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Re: Extensible data types?
> > The above code fails to type check due to instances > overlapping. Hugs gives the following error message: > In Hugs, there is a flag that you can set to allow overlapping instances :s +o In GHC, you can also set -fallow-overlapping-instances BTW, I use extensible union types in a "Language prototyping System" that I am implementing and which compiles with GHC and Hugs (it is based on Liang, Hudak and Jones paper). You can download the source code from "http://lsi.uniovi.es/~labra/LPS/LPS.html" Best regards, Jose Labra http://lsi.uniovi.es/~labra ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Re: Extensible data types?
Hello. I am back with the issue of extensible union types. Basically I want to extend a data type with new value constructors. Some members of the list pointed me to the paper "Monad Transformers and Modular Interpreters" Sheng Liang, Paul Hudak and Mark Jones The authors suggest using a type constructor to express the disjoint union of two other types: data Either a b = Left a | Right b which indeed is part of the Haskell 98 Prelude. Then they introduce a subtype relationship using multiparameter type classes: class SubType sub sup where inj :: sub -> sup -- injection prj :: sup -> Maybe sub -- projection The Either data type consructor is then used to express the desired subtype relationshipe: instance SubType a (Either a b) where inj = Left prj (Left x) = Just x prj _ = Nothing instance SubType a b => SubType a (Either c b) where inj = Right . inj prj (Right x) = prj x prj _ = Nothing The authors implemented their system in Gofer, due to restrictions in the type class system of Haskell. But now that there are Haskell extensions to support multiparametric type classes, that could be implemented in Haskell. The above code fails to type check due to instances overlapping. Hugs gives the following error message: ERROR "SubType.hs" (line 10): Overlapping instances for class "SubType" *** This instance : SubType a (Either b c) *** Overlaps with : SubType a (Either a b) *** Common instance : SubType a (Either a b) (I did not check Gofer, but is there a way to solve these overlapping of instances in it?) So this is scheme is not going to work with Haskell (extended with multiparameter type classes). I would like hear any comments from the Haskell comunity on this subject. Is there a workaround for the overlapping instances? Regards. Romildo -- Prof. José Romildo Malaquias <[EMAIL PROTECTED]> Departamento de Computação Universidade Federal de Ouro Preto Brasil ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell