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: Gabriel Dos Reis
Subject: Re: [Axiom-mail] Spad and inductive types
Date: Tue, 8 May 2007 15:18:39 -0500 (CDT)

On Tue, 8 May 2007, Ralf Hemmecke wrote:

| But I thought that the Haskell
| 
| data Expr = MkInt Int
|           | MkAdd Expr Expr
|           | MkMul Expr Expr
| 
| is more like
| 
| Union(Cross(Tag, Int),
|       Cross(Tag, Expr, Expr),
|       Cross(Tag, Exrp, Expr)).


yes, conceptually, that is the case.

[...]

| As I understood Gaby, he wanted to define just the data structure without any
| additional features like eval or coercion to OutputForm.

You understood right.

The data constructors

   MkInt: Integer -> Expr
   MkAdd: Expr -> Expr -> Expr
   MkMul: Expr -> Expr -> Expr

are essentially the only thing people need to know about the
Expr data type in order to write more operations on it. 
That realization has been taken furthermore to the notion of
"Generalized Algebraic Data Type" (or GADT for short).

Many thanks for your answers.

-- Gaby




reply via email to

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