hs-cryptohash
hs-cryptohash copied to clipboard
Is cryptohash as high-level as it could be?
We were just looking at toHex
and wondering whether it's necessary to write such a low-level concatMap
.
Couldn't bytestring
provide an inlinable combinator with which this could be expressed in a completely memory-safe fashion?
@vincenthz Have you had tries in the past to do this?
a concatMap approach will have quite a different profile, in term of memory usage and cpu usage. Also note that this is the same approach taken in base16-bytestring for performance reasons.
@vincenthz I'm not suggesting to literally use concatMap
, I'm rather asking whether you think that bytestring
could provide a concatMap
-like function which allows you to write toHex
in a safe way (i.e. only providing a Char -> ByteString
or Char -> Storable something
function) with the same performance characteristics.