Discussion: Can we make evaluate easier to find?

David Feuer david.feuer at gmail.com
Wed Jan 7 04:36:34 UTC 2015


The evaluate function is defined in GHC.IO, and exported publicly by
Control.Exception. This strikes me as an extremely strange place for
it. Can we find another place to put it that would seem more sensible?
I don't think it should be removed from Control.Exception, but rather
that maybe it should be added somewhere else as well.

Digging all around, I've come up with one idea that might work, if we
give evaluate a more general type:

evaluate :: PrimMonad m => a -> m a
evaluate a = primitive (\s -> seq# a s)

With this type, we could easily put it in Control.Monad.Primitive.
There may be some challenges wiggling module dependencies around, but
hopefully not huge ones.

David


More information about the Libraries mailing list