data-pprint-0.2.4.2: Prettyprint and compare Data values
Safe HaskellSafe-Inferred
LanguageHaskell2010

System.SimpleTimeout.Limits

Description

Time and size limits

Synopsis

Documentation

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 #

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.

decSizeBudget Source #

Arguments

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

funtion to modify free size and produce a value

-> IO a 

Decrement free size in a budget.