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

-- | Framework for seeing how much a function allocates.
--   
--   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)
--   
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 ([(Weight, Maybe String)], Config)

-- | Set the config. Default is: defaultConfig.
setColumns :: [Column] -> Weigh ()

-- | Table column.
data Column
Case :: Column
Allocated :: Column
GCs :: Column
Live :: Column
Check :: Column
Max :: Column

-- | 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 ()

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

-- | Weigh a set of actions. The value of the actions are forced completely
--   to ensure they are fully allocated.
weighDispatch :: [String] -> [(String, Action)] -> IO (Maybe [Weight])

-- | Weigh a pure function. This function is heavily documented inside.
weighFunc :: (NFData a) => (b -> a) -> b -> IO (Int64, Int64, Int64, Int64)

-- | Weigh a pure function. This function is heavily documented inside.
weighAction :: (NFData a) => (b -> IO a) -> b -> IO (Int64, Int64, Int64, Int64)
instance GHC.Base.Applicative Weigh.Weigh
instance GHC.Base.Functor Weigh.Weigh
instance GHC.Base.Monad Weigh.Weigh
instance GHC.Show.Show Weigh.Weight
instance GHC.Read.Read Weigh.Weight
instance GHC.Show.Show Weigh.Config
instance GHC.Enum.Enum Weigh.Column
instance GHC.Classes.Eq Weigh.Column
instance GHC.Show.Show Weigh.Column
