em is possibly solved by
inheritance in the class system, but that only works for pre-defined
classes. Or does it?
Maybe subtypes don't fit elegantly into the functional model. Maybe
they aren't necessary anyway.
Thoughts appreciated.
Rob
--
--
Rob Turner, Dept. of Computer Science, Uni
In article <[EMAIL PROTECTED]> [EMAIL PROTECTED] writes:
>
>datatype weekday = mon | tue | wed | thu | fri;
>datatype weekend = sat | sun;
>datatype day = wd of weekday | we of weekend;
>
>Essentially, if you think of your subtypes as "disjoint unions", then
d + weekday
|
| It springs to mind that this kind of problem is possibly solved by
| inheritance in the class system, but that only works for pre-defined
| classes. Or does it?
|
| Maybe subtypes don't fit elegantly into the functional model. Maybe
| they aren't necessary anyway.
|
|
> How do you get a subtype in Haskell (or any other functional language
> come to that)? I'm thinking along the lines of (pseudo-notation):
>
> type weekday = {Mon, Tue, Wed, Thur, Fri}
> type weekend = {Sat, Sun}
> type day = weekend + weekday
>