# [darcs-users] Institutional knowledge: Darcs/IO.hs

Reinier Lamers tux_rocker at reinier.de
Mon Jan 11 17:01:18 UTC 2010

Hi Jason,

Op zondag 10 januari 2010 02:47 schreef Jason Dagit:
> That leads to a function like this:
> \begin{code}
> readHunkHandle :: HunkHandle -> IO HunkContent
> \end{code}
>
> I've made this change all throughout the code base and inserted comments and
> undefined everywhere that I didn't know how to make an immediate fix.  I'm
> going through and trying to fix those less obvious places.  In the Apply
> class we use WriteableDirectory m instead of directly using IO in the
> types.  This makes me think that readHunkHandle should have type:
> \begin{code}
> readHunkHandle :: WriteableDirectory m => HunkHandle -> m HunkContent
> \end{code}
>
> Does this look right to anyone else?  Since WriteableDirectory has an
> instance for IO, I think the first type would work but maybe if I use IO
> directly I'm violating some design principle here?

It looks like you have to use IO directly. Just from grepping the source tree,
it looks like the WriteableDirectory class is used for the IO monad and the
monads of slurpies and hashed storage. In this case, however, the IO in the
type stands for the IO necessary to read the hunk contents from the patch
file, which I think is not supposed to be done using slurpies or hashed
storage.

Reinier
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.osuosl.org/pipermail/darcs-users/attachments/20100111/48eee699/attachment.pgp>