Hacker News new | ask | show | jobs
by tikhonj 4640 days ago
This is why we have Data.Dynamic which does safe dynamic types.

It almost never comes up because it turns out to be virtually useless, but that's a story for another time.

1 comments

> it turns out to be virtually useless

That's debatable, however Data.Dynamic is built on top of Data.Typeable, which provides a lower level runtime type safety facility. I think we can both agree Typable has lots of interesting uses.

Typeable is interesting in theory and generic traversals are a godsend, but usually I find that when I'm reaching for that particular hammer I should check twice.
I'll agree it's best to avoid fully open unions when you can, but some (super useful) things truly don't work that way. Check out http://okmij.org/ftp/Computation/monads.html#ExtensibleDS for a cool example.
I always think of Control.Exception as the poster child for open unions.
Perfect, since exceptions are a subset of effects! Check out http://math.andrej.com/eff/ and its literature.