[Haskell-cafe] Making type-incompatible strategies interchangeable
Heinrich Apfelmus
apfelmus at quantentunnel.de
Sat Dec 18 14:31:54 CET 2010
Jacek Generowicz wrote:
> # 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 ?
>
> # To demonstrate what I mean, I offer the following concrete toy
> # example, in Python.
>
> # It's a harness for playing the trivial higher-lower number guessing
> # game, with interchangeable strategies for either player. In this
> # example I provide two strategies (Computer / ask Human via IO) for
> # each role (asker and guesser).
>
> # How can this sort of interchangeability of computations which are
> # conceptually identical, but incompatible from the types perspective,
> # be expressed in Haskell?
Have a look at my operational package, in particular the TicTacToe.hs
example on the examples page.
http://hackage.haskell.org/package/operational
(Unfortunately, the haskell.org domain is seized at the moment, so
this link won't work for a while. Also, please yell if you can't find
the examples page once the link works again.)
Regards,
Heinrich Apfelmus
--
http://apfelmus.nfshost.com
More information about the Haskell-Cafe
mailing list