TomMD/DRBG — pull request #4 by dmwit (2014-11-25 23:17:27+00:00)
Title: don't store a function in the HMAC state

It looks like `HMAC.State` doesn't actually use the function it stores -- just treats it as a way to get at the phantom type variable. This is unfortunate, because it means there's lots of things you can't do with a `State` that would be nice (like serialize it). The patch below fixes this: it removes the `hashAlg` function from the `State`, and calls appropriate type-restricted functions on the state itself to get at the type variable instead.

This doesn't change the public API of the package (since the constructor and fields of `State` are not exported), but it changes just enough that Template Haskell can derive some handy classes. Not sure what you want to do about version number given that.

This also requires a somewhat newer copy of `tagged`, though this could be avoided by reimplementing the trivial `proxy` function if desired.