{-# LANGUAGE StandaloneDeriving #-}
module Util.Limit (set, Resource(..)) where
import System.Posix.Resource
deriving instance Show ResourceLimit
deriving instance Show ResourceLimits
set :: Resource -> Integer -> IO ()
set :: Resource -> Integer -> IO ()
set Resource
resource Integer
soft = do
ResourceLimits
old <- Resource -> IO ResourceLimits
getResourceLimit Resource
resource
Resource -> ResourceLimits -> IO ()
setResourceLimit Resource
resource forall a b. (a -> b) -> a -> b
$ ResourceLimits
{ softLimit :: ResourceLimit
softLimit = Integer -> ResourceLimit
ResourceLimit Integer
soft
, hardLimit :: ResourceLimit
hardLimit = ResourceLimits -> ResourceLimit
hardLimit ResourceLimits
old
}