In "Rolling Your Own Mutable ADT: A Connection Between Linear Types
and Monads", p. 1, Chen and Hudak write:
There are few formal connections between monads and
single-threaded state... For any state-transformer monad... there
is a trivial operation... that will instantly destroy any hope for
single-threadedness: getState s = (s, s)
In day-to-day Haskell 1.3 programming what is the solution to this
problem? If a program is using a C interface to create a mutable
state, say an external database, what is the simplest way of
encapsulating the state so that this "trivial operation" cannot be
defined except by the original author?
One problem I have with the hanful of papers I have read so far is
separating the reports about what is possible to implement in some
hypothetical language from the reports about what is possible in some
existing implementation of, say, Haskell 1.3.
If I attempt to do something in Haskell, and I fail, I am not sure
whether it is the compiler telling me my goal is impossible or if it
is telling me I haven't stated my goal correctly.
Thanks from a beginner.
--
Patrick Logan mailto:[EMAIL PROTECTED]
Voice 503-533-3365 Fax 503-629-8556
Gemstone Systems, Inc http://www.gemstone.com