
8 Jan
2012
8 Jan
'12
2:58 p.m.
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