Re: Extensible data types?

2000-09-25 Thread S.J.Thompson
Erik Poll ([EMAIL PROTECTED]) did some nice theoretical work on this a couple of years ago. I took a quick look on his web site but couldn't see anything on it there. Maybe he can help? Simon

Re: Extensible data types?

2000-09-25 Thread Peter Ljunglof
Perhaps the subtyping of O'Haskell is interesting: http://www.cs.chalmers.se/~nordland/ohaskell/ /Peter Ljunglöf On Mon, 25 Sep 2000, Jose Romildo Malaquias wrote: > Is there any Haskell implementation that supports > extensible data types, in which new value constructors > can be added t

Re: Extensible data types?

2000-09-25 Thread Axel Simon
On Mon, 25 Sep 2000, Jose Romildo Malaquias wrote: > Is there any Haskell implementation that supports > extensible data types, in which new value constructors > can be added to a previously declared data type? I think this is what the TREX (extensible records) in Hugs are about. Take a look at

Re: Extensible data types?

2000-09-25 Thread Jose Romildo Malaquias
On Mon, Sep 25, 2000 at 11:37:24AM +0100, Chris Angus wrote: > I've not seen this before, > > out of interest, why would you want/need such a thing? > > > > Is there any Haskell implementation that supports > > extensible data types, in which new value constructors > > can be added to a previous

Re: Extensible data types?

2000-09-25 Thread Jose Romildo Malaquias
On Mon, Sep 25, 2000 at 01:01:25PM +0200, Axel Simon wrote: > On Mon, 25 Sep 2000, Jose Romildo Malaquias wrote: > > > Is there any Haskell implementation that supports > > extensible data types, in which new value constructors > > can be added to a previously declared data type? > > I think thi

Re: Extensible data types?

2000-09-25 Thread Ch. A. Herrmann
Hi, Jose> I am working on an Computer Algebra system to transform Jose> mathematic expressions, possibly simplifing them. There is a Jose> data type to represent the expressions: Jose> data Expr = Int Integer | Cte String | Var String | App Fn [Expr] Jose> An expression may

Re: Extensible data types?

2000-09-25 Thread Rob MacAulay
There is an interesting paper which includes a method of performing this extension in Gofer: "Monad Transformers and Monad Interpreters" by Liang, Hudak and Jones I think this should be available from Mark Jones' web site at OGI. Rob MacAulay > > > > > Is there any Haskell implementation

Re: Extensible data types?

2000-09-25 Thread Axel Simon
> > > Is there any Haskell implementation that supports > > > extensible data types, in which new value constructors > > > can be added to a previously declared data type? > > > > I think this is what TREX (extensible records) in Hugs are about. Take > > a look at > > > > http://www.cse.ogi.edu

RE: Extensible data types?

2000-09-25 Thread Chris Angus
Just wondering if you'd seen the dynamic datatype which basically gives you an "Any" in ghc/hugs > -Original Message- > From: Jose Romildo Malaquias [mailto:[EMAIL PROTECTED]] > Sent: 25 September 2000 12:14 > To: Chris Angus > Cc: [EMAIL PROTECTED] > S

Re: Extensible data types?

2000-09-25 Thread John Hörnkvist
If you use Hugs -- and possibly GHC -- you might be able to use the "Either" constructor for subtyping. I first saw this pattern in "Modular Monadic Interpreters" (or something like that) by Jones, Liang and Hudak. [Apologies if I didn't get the attribution right.] data Expr a = Int Integer

Re: Extensible data types?

2000-09-25 Thread Peter Achten
At 07:46 25-9-00 -0300, Prof. José Romildo Malaquias wrote: >Hello. > >Is there any Haskell implementation that supports >extensible data types, in which new value constructors >can be added to a previously declared data type, >like > > data Fn = Sum | Pro | Pow > ... > ex

RE: Extensible data types?

2000-09-25 Thread Chris Angus
PROTECTED] > Subject: Re: Extensible data types? > > > At 07:46 25-9-00 -0300, Prof. José Romildo Malaquias wrote: > > >Hello. > > > >Is there any Haskell implementation that supports > >extensible data types, in which new value constructors

Re: Extensible data types?

2000-09-25 Thread Jose Romildo Malaquias
On Mon, Sep 25, 2000 at 03:33:54PM -0700, Peter Achten wrote: > At 07:46 25-9-00 -0300, Prof. José Romildo Malaquias wrote: > > >Hello. > > > >Is there any Haskell implementation that supports > >extensible data types, in which new value constructors > >can be added to a previously declared data

Re: Extensible data types?

2000-09-25 Thread Keith Wansbrough
> In the Clean Object I/O library we encountered a similar challenge and > solved it using type constructor classes. The solution can also be used in > Haskell. The basic idea is as follows: > I didn't read your message in detail, but I wonder if this is related to the trick TclHaskell / FranT

Re: Extensible data types?

2000-09-25 Thread Carl R. Witty
Jose Romildo Malaquias <[EMAIL PROTECTED]> writes: > Hello. > > Is there any Haskell implementation that supports > extensible data types, in which new value constructors > can be added to a previously declared data type, > like > > data Fn = Sum | Pro | Pow > ... > extend dat

Re: Extensible data types?

2000-09-26 Thread Peter Achten
At 11:18 25-9-00 -0300, Prof. José Romildo Malaquias wrote: [...skip...] >And then how would I define data types based on Fn ? The math expressions >my system has to deal is expressed as something like > > data Expr = Int > | App Fn [Expr] > >I cannot just define > >

Re: Extensible data types?

2000-09-26 Thread Jose Romildo Malaquias
On Mon, Sep 25, 2000 at 02:42:20PM +0200, John Hörnkvist wrote: > If you use Hugs -- and possibly GHC -- you might be able to use the > "Either" constructor for subtyping. I first saw this pattern in > "Modular Monadic Interpreters" (or something like that) by Jones, > Liang and Hudak. > [..

Re: Extensible data types?

2000-09-26 Thread Jose Romildo Malaquias
On Tue, Sep 26, 2000 at 09:56:18AM -0700, Peter Achten wrote: > At 11:18 25-9-00 -0300, Prof. José Romildo Malaquias wrote: > > [...skip...] > >And then how would I define data types based on Fn ? The math expressions > >my system has to deal is expressed as something like > > > > data Ex

Re: Extensible data types?

2000-09-28 Thread Peter Achten
At 12:55 26-9-00 -0300, Prof. José Romildo Malaquias wrote: [...skip...] This solution works great for the data type, but, at least to me, it seems to make it too dificult to write functions over ExprExt. Consider for example the original version of the addition operation (somehow simplified) on

RE: Extensible data types?

2000-09-28 Thread Chris Angus
diff fn | match fn sine = cosine diff fn | match fn cosine = neg `compose` cosine > -Original Message- > From: Jose Romildo Malaquias [mailto:[EMAIL PROTECTED]] > Sent: 25 September 2000 12:14 > To: Chris Angus > Cc: [EMAIL PROTECTED] > Subject: Re: Extensible data typ

Re: Extensible data types?

2000-09-28 Thread Jose Romildo Malaquias
On Thu, Sep 28, 2000 at 12:00:11PM +0100, Chris Angus wrote: > How about defining a Datatype Fn which defines all functions > and building in terms of this > > data Expr = Int Integer > | Cte String > | Var String > | App Fn [Expr] deriving (Show) > > data Fn = Fn S

Re: Extensible data types?

2000-10-20 Thread José Romildo Malaquias
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

Re: Extensible data types?

2000-10-20 Thread Jose Emilio Labra Gayo
> > 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 t

Re: Extensible data types?

2000-10-20 Thread S. Doaitse Swierstra
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

Correction: Re: Extensible data types?

2000-09-25 Thread John Hörnkvist
I wrote: > You may find these handy: > class SubType a b where > inj :: a -> b > prj :: b -> Maybe a > > instance SubType a (Either a b) where > inj a = Left a > prj (Left a) = a > prj (_) = Nothing This should be: instance SubType a (Either a b) where inj a