Limiting resources on a per-function basis?

Jeff Newbern jnewbern at
Fri Jan 2 22:07:05 EST 2004

Hi all,

I would really like to be able to set resource limits on a per-function
basis.  I am envisioning something like:

limit :: l -> (a -> b) -> (a -> Maybe b)
limit lim fn = ...

which would convert a function so that it returns Nothing if a limit
(on stack, heap, time, etc.) is exceeded during evaluation of that
function.  Is there any hope of being able to do this within the
existing GHC libraries?

If not, is it even possible to determine after-the-fact how much
stack or heap space a function evaluation required?

Jeff Newbern

Jeff Newbern <jnewbern at>
Nomaware, Inc.

More information about the Haskell-Cafe mailing list