| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
Debug.Hood.Observe
Contents
- observe :: Observable a => String -> a -> a
- newtype Observer = O (forall a. Observable a => String -> a -> a)
- type Observing a = a -> a
- class Observable a where
- runO :: IO a -> IO ()
- printO :: Show a => a -> IO ()
- putStrO :: String -> IO ()
- (<<) :: Observable a => ObserverM (a -> b) -> a -> ObserverM b
- thunk :: Observable a => a -> ObserverM a
- send :: String -> ObserverM a -> Parent -> a
- observeBase :: Show a => a -> Parent -> a
- observeOpaque :: String -> a -> Parent -> a
- debugO :: IO a -> IO [CDS]
- data CDS
- type CDSSet = [CDS]
The main Hood API
observe :: Observable a => String -> a -> a Source #
class Observable a where Source #
The Observable class defines how data types are observed.
For Generic data types, this can be derived. For example:
data MyType = MyConstr Int String derivingGenericinstanceObservableMyType
Methods
observer :: a -> Parent -> a Source #
observer :: (Generic a, GObservable (Rep a)) => a -> Parent -> a Source #
Instances
| Observable Bool Source # | |
| Observable Char Source # | |
| Observable Double Source # | |
| Observable Float Source # | |
| Observable Int Source # | |
| Observable Integer Source # | |
| Observable () Source # | |
| Observable Dynamic Source # | |
| Observable SomeException Source # | |
| Observable a => Observable [a] Source # | |
| Observable a => Observable (Maybe a) Source # | |
| Observable a => Observable (IO a) Source # | |
| (Observable a, Observable b) => Observable (a -> b) Source # | |
| (Observable a, Observable b) => Observable (Either a b) Source # | |
| (Observable a, Observable b) => Observable (a, b) Source # | |
| (Ix a, Observable a, Observable b) => Observable (Array a b) Source # | |
| (Observable a, Observable b, Observable c) => Observable (a, b, c) Source # | |
| (Observable a, Observable b, Observable c, Observable d) => Observable (a, b, c, d) Source # | |
| (Observable a, Observable b, Observable c, Observable d, Observable e) => Observable (a, b, c, d, e) Source # | |
runO :: IO a -> IO () Source #
The main entry point; run some IO code, and debug inside it.
An example of using this debugger is
runO (print [ observe "+1" (+1) x | x <- observe "xs" [1..3]])
[2,3,4]
-- +1
{ 1 -> 2
}
-- +1
{ 2 -> 3
}
-- +1
{ 3 -> 4
}
-- xs
1 : 2 : 3 : []Which says, the return is [2,3,4], there were 3 calls to +1
(showing arguments and results), and xs, which was the list
1 : 2 : 3 : [].
For advanced users, that want to render their own datatypes.
(<<) :: Observable a => ObserverM (a -> b) -> a -> ObserverM b infixl 9 Source #
thunk :: Observable a => a -> ObserverM a Source #
observeBase :: Show a => a -> Parent -> a Source #
observeOpaque :: String -> a -> Parent -> a Source #
For users that want to write there own render drivers.
debugO :: IO a -> IO [CDS] Source #
run some code and return the CDS structure (for when you want to write your own debugger).