diff --git a/Debug/Trace.hs b/Debug/Trace.hs
index f5839ee..0c017da 100644
|
a
|
b
|
|
| 22 | 22 | -- * Tracing |
| 23 | 23 | -- $tracing |
| 24 | 24 | trace, |
| | 25 | traceId, |
| 25 | 26 | traceShow, |
| | 27 | traceShowId, |
| 26 | 28 | traceStack, |
| 27 | 29 | traceIO, |
| | 30 | traceM, |
| | 31 | traceShowM, |
| 28 | 32 | putTraceMsg, |
| 29 | 33 | |
| 30 | 34 | -- * Eventlog tracing |
| … |
… |
|
| 109 | 113 | return expr |
| 110 | 114 | |
| 111 | 115 | {-| |
| | 116 | Like 'trace' but returns the message instead of a third value. |
| | 117 | -} |
| | 118 | traceId :: String -> String |
| | 119 | traceId a = trace a a |
| | 120 | |
| | 121 | {-| |
| 112 | 122 | Like 'trace', but uses 'show' on the argument to convert it to a 'String'. |
| 113 | 123 | |
| 114 | 124 | This makes it convenient for printing the values of interesting variables or |
| … |
… |
|
| 124 | 134 | traceShow :: (Show a) => a -> b -> b |
| 125 | 135 | traceShow = trace . show |
| 126 | 136 | |
| | 137 | {-| |
| | 138 | Like 'traceShow' but returns the shown value instead of a third value. |
| | 139 | -} |
| | 140 | traceShowId :: (Show a) => a -> a |
| | 141 | traceShowId a = trace (show a) a |
| | 142 | |
| | 143 | {-| |
| | 144 | Like 'trace' but returning unit in an arbitrary monad. Allows for convenient |
| | 145 | use in do-notation. Note that the application of 'trace' is not an action in the |
| | 146 | monad, as 'traceIO' is in the 'IO' monad. |
| | 147 | |
| | 148 | > ... = do |
| | 149 | > x <- ... |
| | 150 | > traceM $ "x: " ++ show x |
| | 151 | > y <- ... |
| | 152 | > traceM $ "y: " ++ show y |
| | 153 | -} |
| | 154 | traceM :: (Monad m) => String -> m () |
| | 155 | traceM string = trace string $ return () |
| | 156 | |
| | 157 | {-| |
| | 158 | Like 'traceM', but uses 'show' on the argument to convert it to a 'String'. |
| | 159 | |
| | 160 | > ... = do |
| | 161 | > x <- ... |
| | 162 | > traceMShow $ x |
| | 163 | > y <- ... |
| | 164 | > traceMShow $ x + y |
| | 165 | -} |
| | 166 | traceShowM :: (Show a, Monad m) => a -> m () |
| | 167 | traceShowM = traceM . show |
| | 168 | |
| 127 | 169 | -- | like 'trace', but additionally prints a call stack if one is |
| 128 | 170 | -- available. |
| 129 | 171 | -- |