Safe Haskell | None |
---|---|
Language | Haskell2010 |
- class Observable a where
- class GObservable f where
- constrainBase :: (Show a, Eq a) => a -> a -> a
- class GConstrain f where
- gdmFunObserver :: (Observable a, Observable b) => Parent -> (a -> b) -> a -> b
- observeBase :: Show a => a -> Parent -> a
- observeOpaque :: String -> a -> Parent -> a
- type Observing a = a -> a
- newtype Observer = O (forall a. Observable a => String -> a -> a)
- newtype ObserverM a = ObserverM {}
- thunk :: (a -> Parent -> a) -> a -> ObserverM a
- gthunk :: GObservable f => f a -> ObserverM (f a)
- (<<) :: Observable a => ObserverM (a -> b) -> a -> ObserverM b
- gdMapM :: Monad m => (a -> m a) -> m (a -> b) -> a -> m b
- gobserve :: (a -> Parent -> a) -> String -> a -> (a, Int)
- observe :: Observable a => String -> a -> a
- observer_ :: (a -> Parent -> a) -> a -> Parent -> a
- gdmobserver_ :: GObservable f => f a -> Parent -> f a
- unsafeWithUniq :: (Int -> IO a) -> a
- generateContext :: (a -> Parent -> a) -> String -> a -> (a, Int)
- send :: String -> ObserverM a -> Parent -> a
- sendEnterPacket :: (a -> Parent -> a) -> a -> Parent -> a
- gsendEnterPacket :: GObservable f => f a -> Parent -> f a
- evaluate :: a -> IO a
- sendObserveFnPacket :: ObserverM a -> Parent -> a
- type Trace = [Event]
- data Event = Event {}
- data Change
- type ParentPosition = Int
- data Parent = Parent {
- parentUID :: !UID
- parentPosition :: !ParentPosition
- root :: Parent
- isRootEvent :: Event -> Bool
- startEventStream :: IO ()
- endEventStream :: IO Trace
- sendEvent :: Int -> Parent -> Change -> IO ()
- events :: IORef Trace
- badEvents :: Trace
- type UID = Int
- initUniq :: IO ()
- getUniq :: IO UID
- peepUniq :: IO UID
- uniq :: IORef UID
- ourCatchAllIO :: IO a -> (SomeException -> IO a) -> IO a
- handleExc :: Parent -> SomeException -> IO a
Documentation
class Observable a where Source #
observer :: a -> Parent -> a Source #
observer :: (Generic a, GObservable (Rep a)) => a -> Parent -> a Source #
constrain :: a -> a -> a Source #
constrain :: (Generic a, GConstrain (Rep a)) => a -> a -> a Source #
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 # | |
class GObservable f where Source #
gdmobserver :: f a -> Parent -> f a Source #
gdmObserveArgs :: f a -> ObserverM (f a) Source #
gdmShallowShow :: f a -> String Source #
GObservable (U1 *) Source # | |
Observable a => GObservable (K1 * i a) Source # | |
(GObservable a, GObservable b) => GObservable ((:+:) * a b) Source # | |
(GObservable a, GObservable b) => GObservable ((:*:) * a b) Source # | |
(FieldLimit (S (S (S (S (S (S Z)))))) a, GObservable a) => GObservable (M1 * D d a) Source # | |
(GObservable a, Constructor Meta c) => GObservable (M1 * C c a) Source # | |
(GObservable a, Selector Meta s) => GObservable (M1 * S s a) Source # | |
constrainBase :: (Show a, Eq a) => a -> a -> a Source #
class GConstrain f where Source #
gconstrain :: f a -> f a -> f a Source #
GConstrain (U1 *) Source # | |
Observable a => GConstrain (K1 * i a) Source # | |
(GConstrain a, GConstrain b) => GConstrain ((:+:) * a b) Source # | |
(GConstrain a, GConstrain b) => GConstrain ((:*:) * a b) Source # | |
GConstrain a => GConstrain (M1 * D d a) Source # | |
(GConstrain a, Constructor Meta c) => GConstrain (M1 * C c a) Source # | |
(GConstrain a, Selector Meta s) => GConstrain (M1 * S s a) Source # | |
gdmFunObserver :: (Observable a, Observable b) => Parent -> (a -> b) -> a -> b Source #
observeBase :: Show a => a -> Parent -> a Source #
observeOpaque :: String -> a -> Parent -> a Source #
gthunk :: GObservable f => f a -> ObserverM (f a) Source #
observe :: Observable a => String -> a -> a Source #
Functions which you suspect of misbehaving are annotated with observe and should have a cost centre set. The name of the function, the label of the cost centre and the label given to observe need to be the same.
Consider the following function:
triple x = x + x
This function is annotated as follows:
triple y = (observe "triple" (\x -> {# SCC "triple" #} x + x)) y
To produce computation statements like:
triple 3 = 6
To observe a value its type needs to be of class Observable. We provided instances for many types already. If you have defined your own type, and want to observe a function that takes a value of this type as argument or returns a value of this type, an Observable instance can be derived as follows:
data MyType = MyNumber Int | MyName String deriving Generic instance Observable MyType
gdmobserver_ :: GObservable f => f a -> Parent -> f a Source #
unsafeWithUniq :: (Int -> IO a) -> a Source #
sendEnterPacket :: (a -> Parent -> a) -> a -> Parent -> a Source #
gsendEnterPacket :: GObservable f => f a -> Parent -> f a Source #
sendObserveFnPacket :: ObserverM a -> Parent -> a Source #
type ParentPosition = Int Source #
Parent | |
|
isRootEvent :: Event -> Bool Source #
startEventStream :: IO () Source #
endEventStream :: IO Trace Source #
ourCatchAllIO :: IO a -> (SomeException -> IO a) -> IO a Source #