algebric types and db integration
Wed, 5 Sep 2001 09:50:32 +0300
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
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?