-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Measure allocations of a Haskell functions/values -- -- Please see README.md @package weigh @version 0.0.13 -- | Framework for seeing how much a function allocates. -- -- WARNING: weigh is incompatible with profiling. It reports much more -- allocations with profiling turned on. -- -- Example: -- --
-- import Weigh -- main = -- mainWith (do func "integers count 0" count 0 -- func "integers count 1" count 1 -- func "integers count 2" count 2 -- func "integers count 3" count 3 -- func "integers count 10" count 10 -- func "integers count 100" count 100) -- where count :: Integer -> () -- count 0 = () -- count a = count (a - 1) ---- -- Use wgroup to group sets of tests. module Weigh -- | Just run the measuring and print a report. Uses weighResults. mainWith :: Weigh a -> IO () -- | Run the measuring and return all the results, each one may have an -- error. weighResults :: Weigh a -> IO ([Grouped (Weight, Maybe String)], Config) -- | Set the columns to display in the config setColumns :: [Column] -> Weigh () -- | Table column. data Column Case :: Column Allocated :: Column GCs :: Column Live :: Column Check :: Column Max :: Column -- | Set the output format in the config setFormat :: Format -> Weigh () data Format Plain :: Format Markdown :: Format -- | Set the config. Default is: defaultConfig. setConfig :: Config -> Weigh () -- | Weigh configuration. data Config Config :: [Column] -> String -> !Format -> Config [configColumns] :: Config -> [Column] [configPrefix] :: Config -> String [configFormat] :: Config -> !Format -- | Default config. defaultConfig :: Config -- | Weigh a function applied to an argument. -- -- Implemented in terms of validateFunc. func :: NFData a => String -> (b -> a) -> b -> Weigh () -- | Weigh an action applied to an argument. -- -- Implemented in terms of validateAction. io :: NFData a => String -> (b -> IO a) -> b -> Weigh () -- | Weigh a value. -- -- Implemented in terms of action. value :: NFData a => String -> a -> Weigh () -- | Weigh an IO action. -- -- Implemented in terms of validateAction. action :: NFData a => String -> IO a -> Weigh () -- | Make a grouping of tests. wgroup :: String -> Weigh () -> Weigh () -- | Weigh an IO action, validating the result. validateAction :: NFData a => String -> (b -> IO a) -> b -> (Weight -> Maybe String) -> Weigh () -- | Weigh a function, validating the result validateFunc :: NFData a => String -> (b -> a) -> b -> (Weight -> Maybe String) -> Weigh () -- | Make a validator that set sthe maximum allocations. maxAllocs :: Int64 -> Weight -> Maybe String -- | Weigh specification monad. data Weigh a -- | How much a computation weighed in at. data Weight Weight :: !String -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> Weight [weightLabel] :: Weight -> !String [weightAllocatedBytes] :: Weight -> !Int64 [weightGCs] :: Weight -> !Int64 [weightLiveBytes] :: Weight -> !Int64 [weightMaxBytes] :: Weight -> !Int64 -- | Formatting an integral number to 1,000,000, etc. commas :: (Num a, Integral a, Show a) => a -> String reportGroup :: Config -> [Char] -> [Grouped (Weight, Maybe String)] -> [Char] -- | Weigh a set of actions. The value of the actions are forced completely -- to ensure they are fully allocated. weighDispatch :: Maybe String -> [Grouped Action] -> IO (Maybe [Grouped Weight]) -- | Weigh a pure function. This function is built on top of -- weighFuncResult, which is heavily documented inside weighFunc :: NFData a => (b -> a) -> b -> IO (Int64, Int64, Int64, Int64) -- | Weigh a pure function and return the result. This function is heavily -- documented inside. weighFuncResult :: NFData a => (b -> a) -> b -> IO (a, (Int64, Int64, Int64, Int64)) -- | Weigh an IO action. This function is based on -- weighActionResult, which is heavily documented inside. weighAction :: NFData a => (b -> IO a) -> b -> IO (Int64, Int64, Int64, Int64) -- | Weigh an IO action, and return the result. This function is heavily -- documented inside. weighActionResult :: NFData a => (b -> IO a) -> b -> IO (a, (Int64, Int64, Int64, Int64)) -- | Some grouped thing. data Grouped a Grouped :: String -> [Grouped a] -> Grouped a Singleton :: a -> Grouped a instance GHC.Base.Applicative Weigh.Weigh instance GHC.Base.Functor Weigh.Weigh instance GHC.Base.Monad Weigh.Weigh instance GHC.Generics.Generic (Weigh.Grouped a) instance Data.Foldable.Foldable Weigh.Grouped instance Data.Traversable.Traversable Weigh.Grouped instance GHC.Base.Functor Weigh.Grouped instance GHC.Show.Show a => GHC.Show.Show (Weigh.Grouped a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Weigh.Grouped a) instance GHC.Show.Show Weigh.Weight instance GHC.Read.Read Weigh.Weight instance GHC.Show.Show Weigh.Config instance GHC.Show.Show Weigh.Format instance GHC.Enum.Enum Weigh.Column instance GHC.Classes.Eq Weigh.Column instance GHC.Show.Show Weigh.Column instance Control.DeepSeq.NFData Weigh.Action instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Weigh.Grouped a)