-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Prettyprint and compare Data values
--   
--   Prettyprint and compare Data values.
--   
--   <ul>
--   <li>Size limit for the output</li>
--   <li>Time limit for the computation</li>
--   <li>Escape exceptions</li>
--   <li>Do not escape unicode characters</li>
--   <li>Comparison: Highlight the first difference</li>
--   <li>Comparison: Yes, No or Maybe results</li>
--   </ul>
--   
--   Probably you need only the <a>pprint</a> and '(===)' functions from
--   the <a>Data.PPrint</a> module.
--   
--   Usage examples:
--   
--   <pre>
--   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!"
--   </pre>
--   
--   See also <a>http://pnyf.inf.elte.hu/fp/Show_en.xml</a>
--   
--   Changes since 0.1: Refactoring, proper handling of nested errors
@package data-pprint
@version 0.2.3


-- | 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
--   <a>Test.ChasingBottoms.IsBottom</a> 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: Simple timeout mechanism
module System.SimpleTimeout

-- | Abstract data structure used by <a>TimeoutHandle</a> and
--   <a>timeout</a>.
data TimeoutHandle

-- | Creates a <a>TimeoutHandle</a>.
--   
--   The <tt>Double</tt> parameter is the time limit in seconds. All
--   operations behind <a>timeout</a> will be stopped at the current time
--   plus the time limit.
timeoutHandle :: Double -> IO TimeoutHandle

-- | Stop an operation at a time given by <a>timeoutHandle</a>.
--   
--   The <tt>Double</tt> parameter is a percent between 0 and 1.
--   
--   <ul>
--   <li>0: <a>timeout</a> was called right after the <a>TimeoutHandle</a>
--   was created.</li>
--   <li>1: <a>timeout</a> was called after the time of the timeout.</li>
--   <li>near to 1: <a>timeout</a> was called right before the time of the
--   timeout.</li>
--   <li>Other values: proportional to the time spend by the
--   operation.</li>
--   </ul>
timeout :: TimeoutHandle -> (Double -> IO a) -> IO a -> IO a
instance Typeable TimeOutException
instance Eq TimeOutException
instance Exception TimeOutException
instance Show TimeOutException


-- | Time and size limits
module System.SimpleTimeout.Limits

-- | Time limit is a <a>Double</a> which is the allowed time in seconds.
type TimeLimit = Double

-- | Size limit is an <a>Int</a> which meaning is given by
--   <a>checkBudget</a> and <a>decSizeBudget</a>.
type SizeLimit = Int

-- | A <a>Budget</a> 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: Parallel evaluation of <tt>IO</tt> values
module System.IO.Parallel

-- | Run two <tt>IO</tt> computations in parallel and wait for the results.
twoParallel :: IO a -> IO b -> IO (a, b)

-- | Run three <tt>IO</tt> computations in parallel and wait for the
--   results.
threeParallel :: IO a -> IO b -> IO c -> IO (a, b, c)

-- | Run four <tt>IO</tt> 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: Generic representation of <a>Data</a>
--   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 <a>Data</a> 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 <tt>Double</tt> is between 0 and 1.
--   
--   <ul>
--   <li>0: evaluation of subexpression started at the beginning</li>
--   <li>towards 1: evaluation of subexpression started near the end of
--   time limit</li>
--   <li>1: evaluation of subexpression started after time limit
--   (rare)</li>
--   </ul>
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 <a>Data</a> value to <a>GenericData</a> given the
--   <a>GenericData</a> 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 Typeable ConstructorName
instance Typeable GenericData
instance Eq ConstructorName
instance Show ConstructorName
instance Show GenericData
instance NFData GenericData
instance NFData ConstructorName


-- | Conversion from <a>GenericData</a> to <a>Doc</a>
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 :: *

-- | <tt>IsString</tt> instance for <a>Doc</a> 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 <a>GenericData</a> to <a>Doc</a>.
toDoc :: GenericData -> Doc


-- | Intended for internal use: Generic representation of <tt>Data</tt>
--   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 <a>Error</a> 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 <a>GenericData</a> 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 <a>Data</a> value with time and size limit
module Data.Data.Compare

-- | Answer with possibility
--   
--   <ul>
--   <li><a>No</a>: no</li>
--   <li><tt><a>Maybe</a> d</tt>: maybe with d possibility (0-1, 1 denotes
--   yes)</li>
--   <li><a>Yes</a>: yes</li>
--   </ul>
data Answer
No :: Answer
Maybe :: Double -> Answer
Yes :: Answer

-- | Show an <a>Answer</a> as an equality operator.
showAnswer :: Answer -> String

-- | Compare two <a>Data</a> value with time and size limit.
compareData :: Data a => TimeLimit -> TimeLimit -> SizeLimit -> a -> a -> IO (Answer, GenericData, GenericData)
instance Typeable Answer
instance Eq Answer
instance Ord Answer
instance Show Answer
instance Data Answer
instance NFData Answer


-- | Prettyprint and compare <a>Data</a> values.
module Data.PPrint

-- | Prettyprint a <a>Data</a> 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

-- | Compare two <a>Data</a> 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
