Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type UID = Int
- data Event = Event {
- eventParent :: !Parent
- change :: !Change
- data EventWithId = EventWithId {}
- data Change
- type ParentPosition = Word8
- data Parent = Parent {
- parentUID :: !UID
- parentPosition :: !ParentPosition
- root :: Parent
- isRootEvent :: Event -> Bool
- type Trace = Vector Event
- endEventStream :: IO Trace
- sendEvent :: Int -> Parent -> Change -> IO ()
- lookupOrAddString :: Text -> IO Int
- events :: Rope IO MVector Event
- strings :: MVar (Pair Int (CuckooHashTable Text Int))
- stringsLookupTable :: IORef (Vector Text)
- lookupString :: Int -> Text
- initUniq :: IO ()
- getUniq :: IO UID
- peepUniq :: IO UID
- uniq :: IORef UID
- 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 :: Text -> a -> Parent -> 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) -> Text -> a -> (a, Int)
- observe :: Observable a => Text -> 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) -> Text -> a -> (a, Int)
- send :: Text -> 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
- ourCatchAllIO :: IO a -> (SomeException -> IO a) -> IO a
- handleExc :: Parent -> SomeException -> IO a
Documentation
Event | |
|
type ParentPosition = Word8 Source #
Parent | |
|
isRootEvent :: Event -> Bool Source #
endEventStream :: IO Trace Source #
lookupString :: Int -> Text Source #
class Observable a where Source #
A type class for observable values.
- For
Generic
datatypes it can be derived automatically. - For opaque datatypes, use
observeOpaque
or rely on the catch-all?
instance. - Custom implementations can exclude one or more fields from the observation:
instance (Observable a, Observable b) => Observable (excluded, a,b) where observe (excluded,a,b) = send "(,,)" (return (,,) excluded << a << b)
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 -> Text 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 :: Text -> a -> Parent -> a Source #
gthunk :: GObservable f => f a -> ObserverM (f a) Source #
observe :: Observable a => Text -> 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 #
ourCatchAllIO :: IO a -> (SomeException -> IO a) -> IO a Source #