[Haskell-cafe] casting

Thomas Conway drtomc at gmail.com
Tue Oct 10 18:33:23 EDT 2006


On 10/11/06, Bulat Ziganshin <bulat.ziganshin at gmail.com> wrote:

> it's a sort of problem that bites me many times when i start to wrote
> Streams library :)  although you said that you discovered the
> dictionaries mechanism, i propose you to read
> http://haskell.org/haskellwiki/OOP_vs_type_classes page where you can
> find something that you don't yet know

Yes, I did actually know this stuff, it was just paged out, and I
posted before thinking. :-)

Something to do with having two small kids, one of whom gets up
waaaaay too early in the morning (i.e. 5 - 5:30am). :-)

In theory, however, there is no particular reason why a runtime type
cast couldn't be implemented to allow downcasting, but it does require
the runtime system to have a repository of instance declarations, or
associate with static data for a type the classes of which it is an
instance. It's been a few years, but if my recallection is correct,
the Mercury runtime system does this.

T.


More information about the Haskell-Cafe mailing list