-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Prettyprint and compare Data values -- -- Prettyprint and compare Data values. -- -- -- -- Probably you need only the pprint and (===) functions -- from the Data.PPrint module. -- -- Usage examples: -- --
--   pprint [1..]
--   pprintTo 10000 $ repeat [1..]
--   pprint $ iterate (*10) 1
--   pprint $ map length $ replicate 5 [1..] ++ repeat []
--   pprint [2 `div` 0, error "xxx", 18, 4 `div` 0]
--   [1..10] === reverse [10,9..1]
--   [1..10] === reverse [10..1]
--   reverse [10..] === [1..]
--   [1..] === [1..99] ++ [101..]
--   ([1..], [1..]) === ([1..], [1..100])
--   (error "x", [1..]) === (0 `div` 0, reverse [1..])
--   error ("xx" ++ show (length [1..])) === 1
--   error ("xx" ++ error "yy") === 1
--   (error $ unlines $ replicate 300 "xxxxxxxxxxxxxxxxxxxxxxxxxxx") === 1
--   pprint ['a'..]
--   pprint $ "hello" ++ [error "x"] ++ "world!"
--   
-- -- See also http://pnyf.inf.elte.hu/fp/Show_en.xml -- -- Changes since 0.1: Refactoring, proper handling of nested errors @package data-pprint @version 0.2.4.2 -- | Catch exceptions produced in pure code module Control.Exception.Pure -- | Evaluate to weak head normal form and catch exceptions which can be -- raised by errors in pure computation. See also the -- Test.ChasingBottoms.IsBottom module in ChasingBottoms package. catchPureErrors :: a -> IO (Either String a) -- | Make sure that the error message is a concrete String. catchPureErrorsSafe :: a -> IO (Either String a) -- | Intended for internal use: Parallel evaluation of IO values module System.IO.Parallel -- | Run two IO computations in parallel and wait for the results. twoParallel :: IO a -> IO b -> IO (a, b) -- | Run three IO computations in parallel and wait for the -- results. threeParallel :: IO a -> IO b -> IO c -> IO (a, b, c) -- | Run four IO computations in parallel and wait for the -- results. fourParallel :: IO a -> IO b -> IO c -> IO d -> IO (a, b, c, d) -- | Run computations in parallel and wait for the results. manyParallel :: [IO a] -> IO [a] -- | Intended for internal use: Simple timeout mechanism module System.SimpleTimeout -- | Abstract data structure used by TimeoutHandle and -- timeout. data TimeoutHandle -- | Creates a TimeoutHandle. -- -- The Double parameter is the time limit in seconds. All -- operations behind timeout will be stopped at the current time -- plus the time limit. timeoutHandle :: Double -> IO TimeoutHandle -- | Stop an operation at a time given by timeoutHandle. -- -- The Double parameter is a percent between 0 and 1. -- -- timeout :: TimeoutHandle -> (Double -> IO a) -> IO a -> IO a instance GHC.Classes.Eq System.SimpleTimeout.TimeOutException instance GHC.Show.Show System.SimpleTimeout.TimeOutException instance GHC.Exception.Type.Exception System.SimpleTimeout.TimeOutException -- | Time and size limits module System.SimpleTimeout.Limits -- | Time limit is a Double which is the allowed time in seconds. type TimeLimit = Double -- | Size limit is an Int which meaning is given by -- checkBudget and decSizeBudget. type SizeLimit = Int -- | A Budget contains a time and size limit. data Budget -- | Create a new budget. newBudget :: TimeLimit -> SizeLimit -> IO Budget -- | Check budget and take another action if there is no more resource. checkBudget :: Budget -> Int -> (Double -> IO a) -> IO a -> IO a -> IO a -- | Decrement free size in a budget. decSizeBudget :: Budget -> (SizeLimit -> (SizeLimit, a)) -> IO a showTimeout :: Double -> String -- | Intended for internal use: Generic representation of Data -- vales. module Data.Data.GenRep -- | Name and precedence of constructors. data ConstructorName -- | used also for literals except characters Prefix :: String -> ConstructorName -- | character literal Char :: Char -> ConstructorName Infix :: Int -> String -> ConstructorName Infixr :: Int -> String -> ConstructorName Infixl :: Int -> String -> ConstructorName -- | tuple with n elements Tuple :: Int -> ConstructorName -- | nonempty list constructor Cons :: ConstructorName -- | empty list constructor Nil :: ConstructorName -- | Representation of Data values. data GenericData Constructor :: ConstructorName -> [GenericData] -> GenericData -- | exception error message Error :: String -> GenericData -- | error message which may contain further errors NestedError :: GenericData -> GenericData -- | timeout, the Double is between 0 and 1. -- -- Timeout :: Double -> GenericData -- | this is caused space shortage, shown as three dots Hole :: GenericData -- | also caused by space shortage but this omission a relevant part Detail :: GenericData -> GenericData -- | used during show ListHole :: GenericData -- | Convert a Data value to GenericData given the -- GenericData representations of the value's children. constructor :: Data a => Budget -> a -> IO [GenericData] -> IO GenericData -- | Arity of the toplevel constructor. arity :: Data a => a -> Int instance GHC.Show.Show Data.Data.GenRep.ConstructorName instance GHC.Classes.Eq Data.Data.GenRep.ConstructorName instance GHC.Show.Show Data.Data.GenRep.GenericData instance Control.DeepSeq.NFData Data.Data.GenRep.GenericData instance Control.DeepSeq.NFData Data.Data.GenRep.ConstructorName -- | Conversion from GenericData to Doc module Data.Data.GenRep.Doc -- | The abstract type of documents. A Doc represents a set of -- layouts. A Doc with no occurrences of Union or NoDoc represents just -- one layout. data Doc -- | IsString instance for Doc instance IsString Doc where -- fromString = text -- -- Show a character literal. Unicode characters are not escaped. showLitCharInChar :: Char -> String -- | Show a character in a string literal. Unicode characters are not -- escaped. showLitCharInString :: Char -> String -- | Convert GenericData to Doc. toDoc :: GenericData -> Doc -- | Intended for internal use: Generic representation of Data -- vales. module Data.Data.GenRep.Functions -- | Try to hide some part of the value. -- -- This is used in the evaluation of exercises, when the result is wrong. -- We would like to show the erroneous part but not the whole result. mistify :: GenericData -> GenericData -- | Collect and number Error values and replace them by an indexed -- bottom sign. Repeated errors will get the same number. numberErrors :: [GenericData] -> ([GenericData], [(String, String)]) getErrorIndex :: String -> State (Int, [(String, String)]) String -- | Conversion to GenericData with time and space limit. module Data.Data.Eval -- | Evaluation with time an size limit. eval :: Data a => TimeLimit -> SizeLimit -> a -> IO GenericData -- | Gives more control over the resources evalWithBudget :: Data a => Budget -> a -> IO GenericData -- | Compare two Data value with time and size limit module Data.Data.Compare -- | Answer with possibility -- -- data Answer No :: Answer Maybe :: Double -> Answer Yes :: Answer -- | Show an Answer as an equality operator. showAnswer :: Answer -> String -- | Compare two Data value with time and size limit. compareData :: Data a => TimeLimit -> TimeLimit -> SizeLimit -> a -> a -> IO (Answer, GenericData, GenericData) instance Data.Data.Data Data.Data.Compare.Answer instance GHC.Show.Show Data.Data.Compare.Answer instance GHC.Classes.Ord Data.Data.Compare.Answer instance GHC.Classes.Eq Data.Data.Compare.Answer instance Control.DeepSeq.NFData Data.Data.Compare.Answer -- | Prettyprint and compare Data values. module Data.PPrint -- | Prettyprint a Data value. -- -- There is a 1 second time limit and the output contains at most -- approximately 500 characters. -- -- The exceptions are shown as bottom signs followed by explanations. pprint :: Data a => a -> IO Doc -- | Prettyprint a Data value, showing up to approximately the -- specified number of characters. Use this to show more than the default -- pprint allows. pprintTo :: Data a => Int -> a -> IO Doc -- | Compare two Data values. -- -- The can be yes, no or maybe. The differences are highlighted. -- -- There is a 1 second time limit and the output contains at most -- approximately 500 characters. -- -- The exceptions are shown as bottom signs followed by explanations. (===) :: Data a => a -> a -> IO Doc infix 0 ===