[darcs-devel] [issue1895] create a customised monad for Darcs to do IO in
Ganesh Sittampalam
bugs at darcs.net
Tue Jul 20 22:31:24 UTC 2010
New submission from Ganesh Sittampalam <ganesh at earth.li>:
We should replace direct use of the IO monad in Darcs with a customised
monad that abstracts away various things. This is important to make the
Darcs library properly usable.
- The use of global IORefs (use ReaderT instead? - still with IORefs,
but not ones defined using the global variables hack)
- The use of exit/exitWith and atexit handlers (replace with a custom
exception type and finally blocks?)
- (perhaps) things like progress reports
- The mechanism for working with directories (see issue1774 and related
discussion)
- output to stdout/stderr
- (perhaps) all the other IO Darcs does
A good starting point would be to newtype wrap the IO monad, and
implement MonadIO. The downside is that this would involve putting
liftIO in all over the place, which would be quite ugly, but the
advantage is that it would be essentially mechanical.
Once that's in place we could gradually move things into the monad.
One thing to keep a close eye at each step on would be performance.
----------
messages: 11805
nosy: dmitry.kurochkin, ganesh
status: need-implementation
title: create a customised monad for Darcs to do IO in
topic: Core, Library
__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/issue1895>
__________________________________
More information about the darcs-devel
mailing list