-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Simple evaluation trace -- -- The module defines a type constructor Traced, which allows evaluation -- of values to be traced. Instances for all numeric types make tracing -- numeric evaluation especially easy. @package traced @version 2008.7.4 -- | The Traced module provides a simple way of tracing expression -- evaluation. A value of type Traced a has both a value of type -- a and an expression tree that describes how the value was -- computed. -- -- There are instances for the Traced type for all numeric classes -- to make it simple to trace numeric expressions. -- -- The expression tree associated with a traced value is exactly that: a -- tree. But evaluation of expressions in Haskell typically has sharing -- to avoid recomputation. This sharing can be recovered by the (impure) -- reShare function. -- -- $examples module Debug.Traced -- | Traced values of some type. data Traced t a -- | Create a traced value. traced :: (Show a, Typeable a) => a -> Traced t a -- | Create a named traced value. named :: (Show a, Typeable a) => String -> a -> Traced t a -- | Add a named to a traced value. nameTraced :: String -> Traced t a -> Traced t a -- | Create a named thing with no value. Cannot be used where a real value -- is needed. unknown :: (Show a, Typeable a) => String -> Traced t a -- | Extract the real value from a traced value. unTraced :: Traced t a -> a -- | Extract the expression tree from a traced value. tracedD :: Traced t a -> TracedD type TracedV a = Traced AsValue a -- | Expression tree for a traced value. data TracedD -- | unknown value NoValue :: TracedD -- | value with a name Name :: Bool -> Name -> TracedD -> TracedD -- | constant Con :: a -> TracedD -- | application Apply :: a -> Name -> Fixity -> [TracedD] -> TracedD -- | (recovered) let expression Let :: [(Name, TracedD)] -> TracedD -> TracedD -- | Convert an expression tree to a traced value, if the types are -- correct. unTracedD :: (Typeable a) => TracedD -> Maybe (Traced t a) liftT :: (Liftable a b) => Name -> Fixity -> a -> b liftFun :: (Liftable a b) => Name -> a -> b class Liftable a b | a -> b -- | The class Typeable allows a concrete representation of a type -- to be calculated. class Typeable a -- | Traced version of if. ifT :: (Show a, Typeable a) => Traced t Bool -> Traced t a -> Traced t a -> Traced t a (%==) :: (Eq a) => Traced t a -> Traced t a -> Traced t Bool -- | Comparisons generating traced booleans. (%/=) :: (Eq a) => Traced t a -> Traced t a -> Traced t Bool (%<) :: (Ord a) => Traced t a -> Traced t a -> Traced t Bool (%<=) :: (Ord a) => Traced t a -> Traced t a -> Traced t Bool (%>) :: (Ord a) => Traced t a -> Traced t a -> Traced t Bool (%>=) :: (Ord a) => Traced t a -> Traced t a -> Traced t Bool -- | Fixity for identifier. data Fixity InfixL :: Int -> Fixity InfixR :: Int -> Fixity Infix :: Int -> Fixity Nonfix :: Fixity -- | Show the expression tree of a traced value. showAsExp :: (Show a) => Traced t a -> String -- | Show the expression tree of a traced value, also show the value of -- each variable. showAsExpFull :: (Show a) => Traced t a -> String reShare :: (Typeable a) => Traced t a -> Traced t a -- | Simplify an expression tree. simplify :: Traced t a -> Traced t a type AsValue = Integer data AsExp data AsFullExp asValue :: Traced t a -> Traced AsValue a asExp :: Traced t a -> Traced AsExp a asFullExp :: Traced t a -> Traced AsFullExp a asSharedExp :: (Typeable a) => Traced t a -> Traced AsExp a instance Typeable TracedD instance Typeable2 Traced instance Eq AsFullExp instance Show AsFullExp instance Num AsFullExp instance Eq AsExp instance Show AsExp instance Num AsExp instance (Num t, Typeable a, RealFloat a) => RealFloat (Traced t a) instance (Num t, Typeable a, Floating a) => Floating (Traced t a) instance (Num t, Typeable a, RealFrac a) => RealFrac (Traced t a) instance (Num t, Typeable a, Real a) => Real (Traced t a) instance (Show a, Typeable a, Enum a) => Enum (Traced t a) instance (Num t, Typeable a, Integral a) => Integral (Traced t a) instance (Num t, Typeable a, Fractional a) => Fractional (Traced t a) instance (Num t, Typeable a, Num a) => Num (Traced t a) instance (Num t, Show a) => Show (Traced t a) instance (Ord a) => Ord (Traced t a) instance (Eq a) => Eq (Traced t a) instance Liftable () (Traced t ()) instance Liftable Ordering (Traced t Ordering) instance Liftable Bool (Traced t Bool) instance Liftable Float (Traced t Float) instance Liftable Double (Traced t Double) instance Liftable Int (Traced t Int) instance Liftable Integer (Traced t Integer) instance (Typeable a, Show a, Liftable b tb) => Liftable (a -> b) (Traced t a -> tb) instance Show TracedD