| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Weigh
Description
Framework for seeing how much a function allocates.
- mainWith :: Weigh a -> IO ()
- data Weigh a
- data Weight = Weight {
- weightLabel :: !String
- weightAllocatedBytes :: !Int64
- weightGCs :: !Int64
- action :: NFData a => String -> IO a -> Weigh ()
- func :: NFData a => String -> (b -> a) -> b -> Weigh ()
- value :: NFData a => String -> a -> Weigh ()
- validateAction :: NFData a => String -> (b -> IO a) -> b -> (Weight -> Maybe String) -> Weigh ()
- validateFunc :: NFData a => String -> (b -> a) -> b -> (Weight -> Maybe String) -> Weigh ()
- maxAllocs :: Int64 -> Weight -> Maybe String
- commas :: (Num a, Integral a, Show a) => a -> String
Main entry point.
Types
Weigh specification monad.
How much a computation weighed in at.
Constructors
| Weight | |
Fields
| |
Simple combinators
action :: NFData a => String -> IO a -> Weigh () Source
Weigh an IO action.
Implemented in terms of validateAction.
func :: NFData a => String -> (b -> a) -> b -> Weigh () Source
Weigh a function applied to an argument.
Implemented in terms of validateFunc.
Validating combinators
validateAction :: NFData a => String -> (b -> IO a) -> b -> (Weight -> Maybe String) -> Weigh () Source
Weigh an IO action, validating the result.
validateFunc :: NFData a => String -> (b -> a) -> b -> (Weight -> Maybe String) -> Weigh () Source
Weigh a function, validating the result
Validators
maxAllocs :: Int64 -> Weight -> Maybe String Source
Make a validator that set sthe maximum allocations.