[Haskell-cafe] Please explain the Lazy type differences
developer at live.com
Mon Jan 17 05:39:52 CET 2011
I wrote this little clip, and haven't been able to figure out why the L.ByteString is different type than Data.ByteString.Internal.ByteString, or if I am just doing everything wrong here.
import qualified Data.ByteString.Lazy as L
import qualified Crypto.Hash.SHA1 as SH
import Data.Hex (hex)
hashFile :: FilePath -> IO L.ByteString
hashFile f = do
content <- L.readFile f
let hasher = SH.init
bhsh = SH.update hasher content
return (hex (SH.finalize bhsh))
I really just want to get the digest of a file as a [Char], but then of course, SH.update is not very happy about the type I am passing to it either.
Can't wait till this becomes easy!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe