[Haskell-cafe] Making type-incompatible strategies interchangeable

Edward Z. Yang ezyang at MIT.EDU
Sat Dec 18 19:49:58 CET 2010


Excerpts from Jacek Generowicz's message of Fri Dec 17 20:17:30 -0500 2010:
> Imagine an activity which may be performed either by a computer, or
> by a human (alternatively, either locally, or remotely across a
> network). From Haskell's type system's perspective, these two will
> look completely different (most obviously, the human (or the
> network) is wrapped in IO). How can they be made interchangeable ?

This particular example can be resolved from lifting the pure, computer
computation into IO.  One way of abstracting this interaction is to use the Prompt
monad. [1]

This doesn't work in general, and indeed types do have the unfortunate property
of reducing modularity.  This is especially evident when you work with dat
structures that have their invariants encoded in the type system.  [2]
Or maybe this is a good thing, since you don't want IO leaking into your test
suite without you knowing about it...

[1] http://web.mit.edu/~ezyang/Public/threemonads.pdf
[2] http://www.cis.upenn.edu/~bcpierce/papers/harmful-mfps.pdf



More information about the Haskell-Cafe mailing list