A realization I had tonight: the monadic IO construct Haskell uses to enforce purity does not require static types—it works perfectly fine in a dynamically-typed language, too. This seems obvious in retrospect but clearly isn’t, given that I hadn’t thought about it until now!
-
Show this thread
-
Replying to @lexi_lambda
how does stuff like return/pure work in a dynamic language? Is there a way to recover Haskell's typeclass-based implicit dispatching? Or maybe I'm missing a detail here
1 reply 0 retweets 1 like -
Replying to @rtpg_
It’s true that you can’t (easily) get the return-type polymorphism of return/pure, but they are not essential to monadic I/O. You can easily introduce mapIO, pureIO, bindIO, and doIO operations, all monomorphic and specialized to IO.
1 reply 1 retweet 4 likes
Or you can dispatch on explicit dynamic objects rather than static implicit dictionaries. That's how my Lisp Interface Library implements parametric polymorphism in Common Lisp, and with it, data structures and monads, etc.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
Read my blog!