Re: Spad and inductive types
Ralf Hemmecke <[email protected]>
| Newsgroups | gmane.comp.mathematics.axiom.user |
|---|---|
| Message-ID | <[email protected]> |
> Well, I did not interepret it as a slur against Haskell. However, it did > appear to me to be fundamentally incorrect to miss the core ideas of > algebraic data typea and how they lead to GADT: > > data Expr where > MkInt:: Integer -> Expr > MkAdd:: Expr -> Expr -> Expr > MkMul:: Expr -> Expr -> Expr > > That is all that is needed to define more operations on values of > type Expr. Gaby, I think I must disagree with your last sentence. It might probably be correct for Haskell, because there is the pattern matching thing, but in general one would need also functions like apply: (%, 'MkInt') -> Integer; apply: (%, 'MkAdd') -> % case: (%, 'MkInt') -> Boolean; etc. Accessor functions seem to be somewhat hidden in Haskell, but in Aldor they would have to be explicit. Anyway, that GADT example above looks already surprisingly like Aldor (although it probably means something else --- what exactly?). Ralf