[darcs-users] darcs patch: Add Repository IO monad, RIO. (and 31 more)

Jason Dagit dagit at codersbase.com
Fri Sep 5 11:06:27 UTC 2008


On Fri, Sep 5, 2008 at 3:47 AM, David Roundy <droundy at darcs.net> wrote:
> On Fri, Sep 5, 2008 at 5:09 AM, Eric Kow <kowey at darcs.net> wrote:
>> On Thu, Sep 04, 2008 at 11:07:25 -0700, Jason Dagit wrote:
>>> >> +  withRepository [] $ do
>>> >> +    r <- getRepository
>>> >> +    s <- rIO $ slurp_pending r
>>> >> +    return $ (map drop_dotslash . list_slurpy) s
>>> >
>>> > I wonder if something like a withRepositoryRIO could have helped us
>>> > here, and in the rest of the code.  Oh well :-)
>>>
>>> What is withRepositoryRIO?
>>
>> I'm sorry.  I had hallucinated some kind of re-arrangement of things, so
>> higher order function which would let pass a repository to an IO action
>> via rIO.  But now I can't work out quite what I meant.  Maybe something
>> like
>>
>>  thingy job = withRepository [] (getRepository >>= rIO . job)
>>
>> But now it doesn't seem like it would be all that helpful :-(
>
> Actually, that was the transition that I was envisioning, to leave all
> the Commands code (and withRepository) untouched, and introduce a new
> way of doing things that allows type witnesses.  Then we could
> gradually convert code over to use RIO (and support type witnesses
> correctly at the same time).

Ah, I went by the types you suggested in the RIO thread, perhaps too
literally.  I didn't understand that you wanted to create with*
variants for RIO and slip them into place incrementally.  Now that
I've done it the other way, I hope you're not expecting me to redo
that aspect.  With the approach I've taken it seems that the
incremental refinement is in removing the uses of getRepository.

Jason


More information about the darcs-users mailing list