hood-0.2: Debugging by observing in placeContentsIndex
Debug.Hood.Observe
Contents
The main Hood API
For advanced users, that want to render their own datatypes.
For users that want to write there own render drivers.
Synopsis
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
observer :: a -> Parent -> a
observers :: String -> (Observer -> a) -> a
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
= CDSNamed String CDSSet
| CDSCons Int String [CDSSet]
| CDSFun Int CDSSet CDSSet
| CDSEntered Int
The main Hood API
observe :: Observable a => String -> a -> a

observe observes data structures in flight.

An example of use is map (+1) . observe "intermeduate" . map (+2)

In this example, we observe the value that flows from the producer map (+2) to the consumer map (+1).

observe can also observe functions as well a structural values.

newtype Observer
Constructors
O (forall a. Observable a => String -> a -> a)
type Observing a = a -> a
class Observable a where
Methods
observer :: a -> Parent -> a
observers :: String -> (Observer -> a) -> a
show/hide Instances
runO :: IO a -> IO ()

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 : [].

printO :: Show a => a -> IO ()
print a value, with debugging
putStrO :: String -> IO ()
print a string, with debugging
For advanced users, that want to render their own datatypes.
(<<) :: 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
For users that want to write there own render drivers.
debugO :: IO a -> IO [CDS]
run some code and return the CDS structure (for when you want to write your own debugger).
data CDS
Constructors
CDSNamed String CDSSet
CDSCons Int String [CDSSet]
CDSFun Int CDSSet CDSSet
CDSEntered Int
show/hide Instances
Produced by Haddock version 2.7.2