[Haskell-cafe] Please explain the Lazy type differences
Roderick Ford
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 System.FilePath
import System.Environment
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!
Roderick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110116/63218ed0/attachment.htm>
More information about the Haskell-Cafe
mailing list