[darcs-users] [PATCH, RESEND] Move Hashed IO stuff out of Darcs.Repository.Prefs

David Roundy droundy at darcs.net
Tue Aug 12 14:21:38 UTC 2008


On Sat, Aug 09, 2008 at 03:53:40AM -0400, Nathaniel W Filardo wrote:
> Split the material dealing with hashed repository formats and caches mostly
> out of Prefs (into InternalTypes and HashedIO).  This restores Prefs to
> being mostly _darcs/prefs/* handling code.  Compiles and passes tests, but
> not sure it's the maximally right answer.
> 
> Thoughts, as always, welcome.

Not a bad idea, but I'd move the cache code into a new module, rather
than expanding HashIO.

> Thu Aug  7 05:49:18 EDT 2008  nwf at cs.jhu.edu
>   * Make Darcs.Repository.Prefs export the cache hash function
> 
> Fri Aug  8 10:53:30 EDT 2008  nwf at cs.jhu.edu
>   * Move hashed repository IO out of Darcs.Repository.Prefs

> hunk ./src/Darcs/Repository/HashedIO.lhs 75
> -                                    HashDir { permissions = RW, cache = c,
> -                                              options = fs, rootHash = h }
> -                          return $ rootHash hd
> +                                    HashDir { _hd_permissions = RW, cache = c,
> +                                              options = fs, _hd_rootHash = h }
> +                          return $ _hd_rootHash hd

I'm not sure what motivated this change of names, but I strongly
oppose using underscores at the beginning of variable names.  ghc
doesn't warn about unused variables if their names begin with
underscores.

Also, why add the hd_ prefix at all?

I'll accept a rewrite of this patch if it just moves the Cache into
its own module, and is a minimal refactor (i.e. making no change other
than moving code into a different module and changing imports to
match).

David


More information about the darcs-users mailing list