data-pprint- Prettyprint and compare Data values

Safe HaskellSafe



Time and size limits



type TimeLimit = Double Source

Time limit is a Double which is the allowed time in seconds.

type SizeLimit = Int Source

Size limit is an Int which meaning is given by checkBudget and decSizeBudget.

data Budget Source

A Budget contains a time and size limit.

newBudget :: TimeLimit -> SizeLimit -> IO Budget Source

Create a new budget.

checkBudget Source


:: Budget 
-> Int

decrement size budget with this value

-> (Double -> IO a)

what to do in case of timeout (Double: percent when the thread was started)

-> IO a

what to do in case there is no more space

-> IO a

what to do in a normal case

-> IO a 

Check budget and take another action if there is no more resource.

decSizeBudget Source


:: Budget 
-> (SizeLimit -> (SizeLimit, a))

funtion to modify free size and produce a value

-> IO a 

Decrement free size in a budget.