HeinrichApfelmus / vault

A typed, persistent store for values of arbitrary types

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

code duplication

Changaco opened this issue · comments

The code of this package is very redundant, I suggest using CPP to refactor it, like this: Changaco/vault@master...factorize

Any thoughts on this ? Should I create a pull request ?

I finally found the time to take a look. I'm not entirely sure about it.

  1. I like to use GHCi from my editor, but this doesn't work well with the CPP magic. I can use ghci from the command line if I remember to use the -XCPP flag. I think that's ok.
  2. Haddock works fine, that's important.
  3. The type signatures in Data.Vault.* are now a copy of the signature for Data.Vault.ST.*. However, the intention was that the API in the IO monad should not involve the extra parameter s at all, so some type signatures just have to be duplicated. It's a bit like how IORef duplicates STRef.
  4. There was an issue with unlock having an extraneous type signature in IORef.hs

I haven't quite made up my mind yet, but if 3 and 4 are fixed, I think I might be willing to accept the changes.

I fixed 3 and 4 and made a pull request. #13