[Haskell-cafe] ANNOUNCE: hs-cryptohash 0.4

Vincent Hanquez tab at snarc.org
Fri Jul 2 07:23:43 EDT 2010

On Fri, Jul 02, 2010 at 08:10:19PM +1000, Ivan Lazar Miljenovic wrote:
> > i.e.
> > 	update : ctx -> bytestring -> IO ()
> > becomes:
> > 	update : ctx -> bytestring -> ctx
> So you're using explicit state parsing?  Any particular reason for not
> using the State monad or something like that?

hm, I'm basically just hiding the C call (IO) to %hash%_update.
This is up to the user to put a state monad around it if he wants to.

I'm not sure exactly what the API would looks like, but I think basically you
would enter/leave the state monad quite frequently in incremental mode,
since the whole point of the incremental api is having this context built
partially. for this reason, you end up with something really close to explicit
state keeping, isn't it ?

also doing a bunch of update calls in a row is very practical at the moment:

"foldl HASH.update ctx [list,of,bytestrings,to,update,ctx,with]"

I don't think a state monad would make it *that* more practical ? unless maybe
for scattered calls to update.

If you have a better idea of how it could looks like, let me know.


More information about the Haskell-Cafe mailing list