
Aristid Breitkreuz
To use the hash, I have to convert it to a ByteString, and then I suddenly have lost all this safety. I don't really see how there is any real safety gained.
But that isn't true for all users. Sometimes a hash is computed long before it is transmitted, so while you're passing it around you can be sure it won't be confused with other raw data (basically, what Vincent said). Also, some users never want to convert to a bytestring - using the Eq and Ord instances are enough.
That said, just exposing a direct method of getting to that ByteString without cereal (as Thomas proposed) would be an improvement.
I'll do this and release crypto-api 0.9 soonish. Cheers, Thomas
Aristid
2012/1/8 Vincent Hanquez
: On 01/08/2012 04:12 AM, Aristid Breitkreuz wrote:
Why? I don't actually need the hash object for anything, usually. All I need is the ByteString, and then I need to learn how to use the cereal package to get it...
The whole rationale i believe, is having meaningful types associated to your values so that the type checker can do its job. i.e. you don't start mixing a hash (in binary form) and a random piece of file.
My only problem with the Serialize instance, is that dependencies (cereal in this case) trickle through to the user of the API, which would be solved by Thomas' suggestion.
-- Vincent
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe