algebric types and db integration

Cagdas Ozgenc co19@cornell.edu
Wed, 5 Sep 2001 09:50:32 +0300


Hi,

I am wondering how one would store instances of algebric types in a
database. For example:

data Shape = Circle Float | Rectangle Float Float | Triangle Float Float
Float

All three constructors are representing different schemas. Hence I won't be
able to store them in a single table. I think algebric types seem to
represent an inheritance hierarchy in terms of OO terms, Shape being the
base class, and Circle, Rectangle, Triangle being its subclasses. Is this a
correct way of looking at it?

How do you suggest I conceptually map it to a relational database?

Thanks