[Haskell-cafe] [web-devel] [ANNOUNCE] First release of crypto-conduit

Vincent Hanquez tab at snarc.org
Sun Jan 8 15:58:02 CET 2012


On 01/08/2012 02:35 PM, Aristid Breitkreuz wrote:
> 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.
Using the hash and carrying it around are two different things. You don't get 
any usefulness once you have converted it indeed, but before hand this is quite 
handy sometimes. It's very similar to phantom types or newtype-ing.

It also have a useful self-documentation factor, for example the later tell the 
user of "myFunction" more information than the former:

myFunction :: ByteString -> ByteString -> SomeType
myFunction :: ByteString -> Hash SHA1 -> SomeType

-- 
Vincent



More information about the Haskell-Cafe mailing list