[Top][All Lists]
[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
Re: [Axiom-mail] Spad and inductive types, Gabriel Dos Reis, 2007/05/07
Re: [Axiom-mail] Spad and inductive types, Bill Page, 2007/05/08
Re: [Axiom-mail] Spad and inductive types, Bill Page, 2007/05/09
Re: [Axiom-mail] Spad and inductive types, Bill Page, 2007/05/09