data-pprint-0.1: Prettyprint and compare Data values

System.SimpleTimeout.Limits

Description

Time and size limits

Synopsis

Documentation

type TimeLimit = DoubleSource

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

type SizeLimit = IntSource

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 BudgetSource

Create a new budget.

checkBudgetSource

Arguments

:: 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.

decSizeBudgetSource

Arguments

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

funtion to modify free size and produce a value

-> IO a 

Decrement free size in a budget.