Hello,<br><br>My question:<br>~~~~~~~~~~<br>Is there anyone around who remembers the purpose of the Darcs.IO module and/or history?  I&#39;d like to learn more about the why and how before I dive in and make changes.<br><br>
<br>Background on my question:<br>~~~~~~~~~~~~~~~~~~~~~~~<br>I modified some of the basic darcs types like this:<br><br>\begin{code}<br>data Prim C(x y) where<br>    Move :: !FileName -&gt; !FileName -&gt; Prim C(x y)<br>
    DP :: !FileName -&gt; !(DirPatchType C(x y)) -&gt; Prim C(x y)<br>    FP :: !FileName -&gt; !(FilePatchType C(x y)) -&gt; Prim C(x y)<br>    Split :: FL Prim C(x y) -&gt; Prim C(x y)<br>    Identity :: Prim C(x x)<br>
    ChangePref :: !String -&gt; !String -&gt; !String -&gt; Prim C(x y)<br><br>data FilePatchType C(x y) = RmFile | AddFile<br>                          | Hunk !Int !HunkHandle<br>                          | TokReplace !String !String !String<br>
                          | Binary !HunkHandle<br>                            deriving (Eq,Ord)<br><br>data DirPatchType C(x y) = RmDir | AddDir<br>                           deriving (Eq,Ord)<br><br>data HunkHandle = HH { hhFile      :: !FileName<br>
                     , hhOffset    :: !Int<br>                     , hhOldLength :: !Int<br>                     , hhNewLength :: !Int<br>                     }<br>     deriving (Eq, Ord)<br><br>data HunkContent = HC { hcOffset :: !Int<br>
                      , hcOld :: ![B.ByteString]<br>                      , hcNew :: ![B.ByteString]<br>                      }<br>\end{code}<br><br>This means that when you have a list of Prims you are holding only enough information to go retrieve the HunkContent from the patch file (which presumably has been scanned once to calculate the hunk handles).<br>
<br>That leads to a function like this:<br>\begin{code}<br>readHunkHandle :: HunkHandle -&gt; IO HunkContent<br>\end{code}<br><br>I&#39;ve made this change all throughout the code base and inserted comments and undefined everywhere that I didn&#39;t know how to make an immediate fix.  I&#39;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:<br>
\begin{code}<br>readHunkHandle :: WriteableDirectory m =&gt; HunkHandle -&gt; m HunkContent<br>\end{code}<br><br>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&#39;m violating some design principle here?<br>
<br>Thanks,<br>Jason<br>