HeinrichApfelmus/vault — pull request #4 by ehird (2012-01-05 03:58:47+00:00)
Title: unsafeCoerce bug fix(!), specialised single-element Vault, performance

These commits:

1. Fix the definition of `adjust` (it used `Map.alter` instead of `Map.adjust`, which slipped through the cracks because of the use of `unsafeCoerce`; ouch!)
2. Switch to a custom `Key` source and an `IntMap`; this should be faster, since `Unique` uses STM and an Integer, whereas this generator uses `atomicModifyIORef` and an Int. The reason `Unique` doesn't do that is because of a [now-fixed GHC bug](http://hackage.haskell.org/trac/ghc/ticket/3838). Ideally, this would be in Data.Unique itself.
3. Add a `Box` type, analogous to a `Vault` with exactly one element. This is the `Universe` type previously discussed; I saw an equivalent in the [develop branch of reactive-banana](https://github.com/HeinrichApfelmus/reactive-banana/blob/develop/reactive-banana/src/Reactive/Banana/Input.hs), and figured an efficient implementation couldn't hurt. The name is by analogy with safe deposit box; it's a little overly-generic for my tastes, but `Universe` doesn't say much.