
30 Jan
2001
30 Jan
'01
8:13 a.m.
At 2001-01-17 17:03, Lennart Augustsson wrote:
You seem to want dynamic type tests. This is another feature, and sometimes a useful one. But it requires carrying around types at runtime.
Yes. I tried to do that myself by adding a field, but it seems it can't be done.
You might want to look at existential types; it is a similar feature.
I seem to run into a similar problem: -- class BaseClass s data Base = forall a. BaseClass a => Base a class (BaseClass s) => DerivedClass s data Derived = forall a. DerivedClass a => Derived a upcast :: Derived -> Base upcast (Derived d) = Base d downcast :: Base -> Maybe Derived -- How do I define downcast? -- Ashley Yakeley, Seattle WA