axiom-mail
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Axiom-mail] Spad and inductive types


From: Ralf Hemmecke
Subject: Re: [Axiom-mail] Spad and inductive types
Date: Wed, 09 May 2007 16:55:58 +0200
User-agent: Thunderbird 2.0.0.0 (X11/20070326)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]