{-# LANGUAGE FlexibleContexts, FlexibleInstances, UndecidableInstances, ExistentialQuantification #-}

-- |
-- Module     : Simulation.Aivika.Results
-- Copyright  : Copyright (c) 2009-2017, David Sorokin <david.sorokin@gmail.com>
-- License    : BSD3
-- Maintainer : David Sorokin <david.sorokin@gmail.com>
-- Stability  : experimental
-- Tested with: GHC 8.0.1
--
-- The module allows exporting the simulation results from the model.
--
module Simulation.Aivika.Results
       (-- * Definitions Focused on Modeling
        Results,
        ResultTransform,
        ResultName,
        ResultProvider(..),
        results,
        expandResults,
        resultSummary,
        resultByName,
        resultByProperty,
        resultById,
        resultByIndex,
        resultBySubscript,
        ResultComputing(..),
        ResultComputation(..),
        ResultListWithSubscript(..),
        ResultArrayWithSubscript(..),
        ResultVectorWithSubscript(..),
        -- * Definitions Focused on Using the Library
        ResultValue(..),
        resultsToIntValues,
        resultsToIntListValues,
        resultsToIntStatsValues,
        resultsToIntStatsEitherValues,
        resultsToIntTimingStatsValues,
        resultsToDoubleValues,
        resultsToDoubleListValues,
        resultsToDoubleStatsValues,
        resultsToDoubleStatsEitherValues,
        resultsToDoubleTimingStatsValues,
        resultsToStringValues,
        ResultPredefinedSignals(..),
        newResultPredefinedSignals,
        resultSignal,
        pureResultSignal,
        -- * Definitions Focused on Extending the Library 
        ResultSourceMap,
        ResultSource(..),
        ResultItem(..),
        ResultItemable(..),
        resultItemAsIntStatsEitherValue,
        resultItemAsDoubleStatsEitherValue,
        resultItemToIntValue,
        resultItemToIntListValue,
        resultItemToIntStatsValue,
        resultItemToIntStatsEitherValue,
        resultItemToIntTimingStatsValue,
        resultItemToDoubleValue,
        resultItemToDoubleListValue,
        resultItemToDoubleStatsValue,
        resultItemToDoubleStatsEitherValue,
        resultItemToDoubleTimingStatsValue,
        resultItemToStringValue,
        ResultObject(..),
        ResultProperty(..),
        ResultVector(..),
        memoResultVectorSignal,
        memoResultVectorSummary,
        ResultSeparator(..),
        ResultContainer(..),
        resultContainerPropertySource,
        resultContainerConstProperty,
        resultContainerIntegProperty,
        resultContainerProperty,
        resultContainerMapProperty,
        resultValueToContainer,
        resultContainerToValue,
        ResultData,
        ResultSignal(..),
        maybeResultSignal,
        textResultSource,
        timeResultSource,
        resultSourceToIntValues,
        resultSourceToIntListValues,
        resultSourceToIntStatsValues,
        resultSourceToIntStatsEitherValues,
        resultSourceToIntTimingStatsValues,
        resultSourceToDoubleValues,
        resultSourceToDoubleListValues,
        resultSourceToDoubleStatsValues,
        resultSourceToDoubleStatsEitherValues,
        resultSourceToDoubleTimingStatsValues,
        resultSourceToStringValues,
        resultSourceMap,
        resultSourceList,
        composeResults,
        computeResultValue) where

import Control.Monad
import Control.Monad.Trans

import qualified Data.Map as M
import qualified Data.Array as A
import qualified Data.Vector as V

import Data.Ix
import Data.Maybe
import Data.Monoid hiding ((<>))
import Data.Semigroup (Semigroup(..))

import Simulation.Aivika.Parameter
import Simulation.Aivika.Simulation
import Simulation.Aivika.Dynamics
import Simulation.Aivika.Event
import Simulation.Aivika.Signal
import Simulation.Aivika.Statistics
import Simulation.Aivika.Statistics.Accumulator
import Simulation.Aivika.Ref
import qualified Simulation.Aivika.Ref.Base as BR
import Simulation.Aivika.Var
import Simulation.Aivika.QueueStrategy
import qualified Simulation.Aivika.Queue as Q
import qualified Simulation.Aivika.Queue.Infinite as IQ
import Simulation.Aivika.Arrival
import Simulation.Aivika.Server
import Simulation.Aivika.Activity
import Simulation.Aivika.Resource
import qualified Simulation.Aivika.Resource.Preemption as PR
import Simulation.Aivika.Operation
import Simulation.Aivika.Results.Locale.Types

-- | Represents a provider of the simulation results. It is usually something, or
-- an array of something, or a list of such values which can be simulated to get data.
class ResultProvider p where
  
  -- | Return the source of simulation results by the specified name, description and provider. 
  resultSource :: ResultName -> ResultDescription -> p -> ResultSource
  resultSource ResultName
name ResultName
descr = forall p.
ResultProvider p =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> p -> ResultSource
resultSource' ResultName
name [ResultName
name] ResultId
i [ResultId
i]
    where i :: ResultId
i = (UserDefinedResult -> ResultId
UserDefinedResultId forall a b. (a -> b) -> a -> b
$ ResultName -> ResultName -> ResultName -> UserDefinedResult
UserDefinedResult ResultName
name ResultName
descr ResultName
title)
          title :: ResultName
title = ResultName -> ResultName
resultNameToTitle ResultName
name
  
  -- | Return the source of simulation results by the specified name, description, title and provider. 
  resultSource3 :: ResultName -> ResultDescription -> ResultDescription -> p -> ResultSource
  resultSource3 ResultName
name ResultName
descr ResultName
title = forall p.
ResultProvider p =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> p -> ResultSource
resultSource' ResultName
name [ResultName
name] ResultId
i [ResultId
i]
    where i :: ResultId
i = (UserDefinedResult -> ResultId
UserDefinedResultId forall a b. (a -> b) -> a -> b
$ ResultName -> ResultName -> ResultName -> UserDefinedResult
UserDefinedResult ResultName
name ResultName
descr ResultName
title)

  -- | Return the source of simulation results by the specified name, its name path,
  -- identifier, the corresponding indentifier path and provider. 
  resultSource' :: ResultName -> [ResultName] -> ResultId -> [ResultId] -> p -> ResultSource

-- | It associates the result sources with their names.
type ResultSourceMap = M.Map ResultName ResultSource

-- | Encapsulates the result source.
data ResultSource = ResultItemSource ResultItem
                    -- ^ The source consisting of a single item.
                  | ResultObjectSource ResultObject
                    -- ^ An object-like source.
                  | ResultVectorSource ResultVector
                    -- ^ A vector-like structure.
                  | ResultSeparatorSource ResultSeparator
                    -- ^ This is a separator text.

-- | The simulation results represented by a single item.
data ResultItem = forall a. ResultItemable a => ResultItem a

-- | Represents a type class for actual representing the items.
class ResultItemable a where

  -- | The item name.
  resultItemName :: a -> ResultName

  -- | The item name path.
  resultItemNamePath :: a -> [ResultName]
  
  -- | The item identifier.
  resultItemId :: a -> ResultId

  -- | The item identifier path.
  resultItemIdPath :: a -> [ResultId]

  -- | Whether the item emits a signal.
  resultItemSignal :: a -> ResultSignal

  -- | Return an expanded version of the item, for example,
  -- when the statistics item is exanded to an object
  -- having the corresponded properties for count, average,
  -- deviation, minimum, maximum and so on.
  resultItemExpansion :: a -> ResultSource
  
  -- | Return usually a short version of the item, i.e. its summary,
  -- but values of some data types such as statistics can be
  -- implicitly expanded to an object with the corresponded
  -- properties.
  resultItemSummary :: a -> ResultSource
  
  -- | Try to return integer numbers in time points.
  resultItemAsIntValue :: a -> Maybe (ResultValue Int)

  -- | Try to return lists of integer numbers in time points. 
  resultItemAsIntListValue :: a -> Maybe (ResultValue [Int])

  -- | Try to return statistics based on integer numbers.
  resultItemAsIntStatsValue :: a -> Maybe (ResultValue (SamplingStats Int))

  -- | Try to return timing statistics based on integer numbers.
  resultItemAsIntTimingStatsValue :: a -> Maybe (ResultValue (TimingStats Int))

  -- | Try to return double numbers in time points.
  resultItemAsDoubleValue :: a -> Maybe (ResultValue Double)
  
  -- | Try to return lists of double numbers in time points. 
  resultItemAsDoubleListValue :: a -> Maybe (ResultValue [Double])

  -- | Try to return statistics based on double numbers.
  resultItemAsDoubleStatsValue :: a -> Maybe (ResultValue (SamplingStats Double))

  -- | Try to return timing statistics based on integer numbers.
  resultItemAsDoubleTimingStatsValue :: a -> Maybe (ResultValue (TimingStats Double))

  -- | Try to return string representations in time points.
  resultItemAsStringValue :: a -> Maybe (ResultValue String)

-- | Try to return a version optimised for fast aggregation of the statistics based on integer numbers.
resultItemAsIntStatsEitherValue :: ResultItemable a => a -> Maybe (ResultValue (Either Int (SamplingStats Int)))
resultItemAsIntStatsEitherValue :: forall a.
ResultItemable a =>
a -> Maybe (ResultValue (Either Int (SamplingStats Int)))
resultItemAsIntStatsEitherValue a
x =
  case Maybe (ResultValue Int)
x1 of
    Just ResultValue Int
a1 -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a b. a -> Either a b
Left ResultValue Int
a1
    Maybe (ResultValue Int)
Nothing ->
      case Maybe (ResultValue (SamplingStats Int))
x2 of
        Just ResultValue (SamplingStats Int)
a2 -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a b. b -> Either a b
Right ResultValue (SamplingStats Int)
a2
        Maybe (ResultValue (SamplingStats Int))
Nothing -> forall a. Maybe a
Nothing
  where
    x1 :: Maybe (ResultValue Int)
x1 = forall a. ResultItemable a => a -> Maybe (ResultValue Int)
resultItemAsIntValue a
x
    x2 :: Maybe (ResultValue (SamplingStats Int))
x2 = forall a.
ResultItemable a =>
a -> Maybe (ResultValue (SamplingStats Int))
resultItemAsIntStatsValue a
x

-- | Try to return a version optimised for fast aggregation of the statistics based on double floating point numbers.
resultItemAsDoubleStatsEitherValue :: ResultItemable a => a -> Maybe (ResultValue (Either Double (SamplingStats Double)))
resultItemAsDoubleStatsEitherValue :: forall a.
ResultItemable a =>
a -> Maybe (ResultValue (Either Double (SamplingStats Double)))
resultItemAsDoubleStatsEitherValue a
x =
  case Maybe (ResultValue Double)
x1 of
    Just ResultValue Double
a1 -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a b. a -> Either a b
Left ResultValue Double
a1
    Maybe (ResultValue Double)
Nothing ->
      case Maybe (ResultValue (SamplingStats Double))
x2 of
        Just ResultValue (SamplingStats Double)
a2 -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a b. b -> Either a b
Right ResultValue (SamplingStats Double)
a2
        Maybe (ResultValue (SamplingStats Double))
Nothing -> forall a. Maybe a
Nothing
  where
    x1 :: Maybe (ResultValue Double)
x1 = forall a. ResultItemable a => a -> Maybe (ResultValue Double)
resultItemAsDoubleValue a
x
    x2 :: Maybe (ResultValue (SamplingStats Double))
x2 = forall a.
ResultItemable a =>
a -> Maybe (ResultValue (SamplingStats Double))
resultItemAsDoubleStatsValue a
x

-- | Return integer numbers in time points.
resultItemToIntValue :: ResultItemable a => a -> ResultValue Int
resultItemToIntValue :: forall a. ResultItemable a => a -> ResultValue Int
resultItemToIntValue a
x =
  case forall a. ResultItemable a => a -> Maybe (ResultValue Int)
resultItemAsIntValue a
x of
    Just ResultValue Int
a -> ResultValue Int
a
    Maybe (ResultValue Int)
Nothing ->
      forall a. HasCallStack => ResultName -> a
error forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " forall a. [a] -> [a] -> [a]
++ forall a. ResultItemable a => a -> ResultName
resultItemName a
x forall a. [a] -> [a] -> [a]
++
      ResultName
" as a source of integer numbers: resultItemToIntValue"

-- | Return lists of integer numbers in time points. 
resultItemToIntListValue :: ResultItemable a => a -> ResultValue [Int]
resultItemToIntListValue :: forall a. ResultItemable a => a -> ResultValue [Int]
resultItemToIntListValue a
x =
  case forall a. ResultItemable a => a -> Maybe (ResultValue [Int])
resultItemAsIntListValue a
x of
    Just ResultValue [Int]
a -> ResultValue [Int]
a
    Maybe (ResultValue [Int])
Nothing ->
      forall a. HasCallStack => ResultName -> a
error forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " forall a. [a] -> [a] -> [a]
++ forall a. ResultItemable a => a -> ResultName
resultItemName a
x forall a. [a] -> [a] -> [a]
++
      ResultName
" as a source of lists of integer numbers: resultItemToIntListValue"

-- | Return statistics based on integer numbers.
resultItemToIntStatsValue :: ResultItemable a => a -> ResultValue (SamplingStats Int)
resultItemToIntStatsValue :: forall a. ResultItemable a => a -> ResultValue (SamplingStats Int)
resultItemToIntStatsValue a
x =
  case forall a.
ResultItemable a =>
a -> Maybe (ResultValue (SamplingStats Int))
resultItemAsIntStatsValue a
x of
    Just ResultValue (SamplingStats Int)
a -> ResultValue (SamplingStats Int)
a
    Maybe (ResultValue (SamplingStats Int))
Nothing ->
      forall a. HasCallStack => ResultName -> a
error forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " forall a. [a] -> [a] -> [a]
++ forall a. ResultItemable a => a -> ResultName
resultItemName a
x forall a. [a] -> [a] -> [a]
++
      ResultName
" as a source of statistics based on integer numbers: resultItemToIntStatsValue"

-- | Return a version optimised for fast aggregation of the statistics based on integer numbers.
resultItemToIntStatsEitherValue :: ResultItemable a => a -> ResultValue (Either Int (SamplingStats Int))
resultItemToIntStatsEitherValue :: forall a.
ResultItemable a =>
a -> ResultValue (Either Int (SamplingStats Int))
resultItemToIntStatsEitherValue a
x =
  case forall a.
ResultItemable a =>
a -> Maybe (ResultValue (Either Int (SamplingStats Int)))
resultItemAsIntStatsEitherValue a
x of
    Just ResultValue (Either Int (SamplingStats Int))
a -> ResultValue (Either Int (SamplingStats Int))
a
    Maybe (ResultValue (Either Int (SamplingStats Int)))
Nothing ->
      forall a. HasCallStack => ResultName -> a
error forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " forall a. [a] -> [a] -> [a]
++ forall a. ResultItemable a => a -> ResultName
resultItemName a
x forall a. [a] -> [a] -> [a]
++
      ResultName
" as an optimised source of statistics based on integer numbers: resultItemToIntStatsEitherValue"

-- | Return timing statistics based on integer numbers.
resultItemToIntTimingStatsValue :: ResultItemable a => a -> ResultValue (TimingStats Int)
resultItemToIntTimingStatsValue :: forall a. ResultItemable a => a -> ResultValue (TimingStats Int)
resultItemToIntTimingStatsValue a
x =
  case forall a.
ResultItemable a =>
a -> Maybe (ResultValue (TimingStats Int))
resultItemAsIntTimingStatsValue a
x of
    Just ResultValue (TimingStats Int)
a -> ResultValue (TimingStats Int)
a
    Maybe (ResultValue (TimingStats Int))
Nothing ->
      forall a. HasCallStack => ResultName -> a
error forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " forall a. [a] -> [a] -> [a]
++ forall a. ResultItemable a => a -> ResultName
resultItemName a
x forall a. [a] -> [a] -> [a]
++
      ResultName
" as a source of timing statistics based on integer numbers: resultItemToIntTimingStatsValue"

-- | Return double numbers in time points.
resultItemToDoubleValue :: ResultItemable a => a -> ResultValue Double
resultItemToDoubleValue :: forall a. ResultItemable a => a -> ResultValue Double
resultItemToDoubleValue a
x =
  case forall a. ResultItemable a => a -> Maybe (ResultValue Double)
resultItemAsDoubleValue a
x of
    Just ResultValue Double
a -> ResultValue Double
a
    Maybe (ResultValue Double)
Nothing ->
      forall a. HasCallStack => ResultName -> a
error forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " forall a. [a] -> [a] -> [a]
++ forall a. ResultItemable a => a -> ResultName
resultItemName a
x forall a. [a] -> [a] -> [a]
++
      ResultName
" as a source of double-precision floating-point numbers: resultItemToDoubleValue"
  
-- | Return lists of double numbers in time points. 
resultItemToDoubleListValue :: ResultItemable a => a -> ResultValue [Double]
resultItemToDoubleListValue :: forall a. ResultItemable a => a -> ResultValue [Double]
resultItemToDoubleListValue a
x =
  case forall a. ResultItemable a => a -> Maybe (ResultValue [Double])
resultItemAsDoubleListValue a
x of
    Just ResultValue [Double]
a -> ResultValue [Double]
a
    Maybe (ResultValue [Double])
Nothing ->
      forall a. HasCallStack => ResultName -> a
error forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " forall a. [a] -> [a] -> [a]
++ forall a. ResultItemable a => a -> ResultName
resultItemName a
x forall a. [a] -> [a] -> [a]
++
      ResultName
" as a source of lists of double-precision floating-point numbers: resultItemToDoubleListValue"

-- | Return statistics based on double numbers.
resultItemToDoubleStatsValue :: ResultItemable a => a -> ResultValue (SamplingStats Double)
resultItemToDoubleStatsValue :: forall a.
ResultItemable a =>
a -> ResultValue (SamplingStats Double)
resultItemToDoubleStatsValue a
x =
  case forall a.
ResultItemable a =>
a -> Maybe (ResultValue (SamplingStats Double))
resultItemAsDoubleStatsValue a
x of
    Just ResultValue (SamplingStats Double)
a -> ResultValue (SamplingStats Double)
a
    Maybe (ResultValue (SamplingStats Double))
Nothing ->
      forall a. HasCallStack => ResultName -> a
error forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " forall a. [a] -> [a] -> [a]
++ forall a. ResultItemable a => a -> ResultName
resultItemName a
x forall a. [a] -> [a] -> [a]
++
      ResultName
" as a source of statistics based on double-precision floating-point numbers: resultItemToDoubleStatsValue"

-- | Return a version optimised for fast aggregation of the statistics based on double floating point numbers.
resultItemToDoubleStatsEitherValue :: ResultItemable a => a -> ResultValue (Either Double (SamplingStats Double))
resultItemToDoubleStatsEitherValue :: forall a.
ResultItemable a =>
a -> ResultValue (Either Double (SamplingStats Double))
resultItemToDoubleStatsEitherValue a
x =
  case forall a.
ResultItemable a =>
a -> Maybe (ResultValue (Either Double (SamplingStats Double)))
resultItemAsDoubleStatsEitherValue a
x of
    Just ResultValue (Either Double (SamplingStats Double))
a -> ResultValue (Either Double (SamplingStats Double))
a
    Maybe (ResultValue (Either Double (SamplingStats Double)))
Nothing ->
      forall a. HasCallStack => ResultName -> a
error forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " forall a. [a] -> [a] -> [a]
++ forall a. ResultItemable a => a -> ResultName
resultItemName a
x forall a. [a] -> [a] -> [a]
++
      ResultName
" as an optimised source of statistics based on double-precision floating-point numbers: resultItemToDoubleStatsEitherValue"

-- | Return timing statistics based on integer numbers.
resultItemToDoubleTimingStatsValue :: ResultItemable a => a -> ResultValue (TimingStats Double)
resultItemToDoubleTimingStatsValue :: forall a. ResultItemable a => a -> ResultValue (TimingStats Double)
resultItemToDoubleTimingStatsValue a
x =
  case forall a.
ResultItemable a =>
a -> Maybe (ResultValue (TimingStats Double))
resultItemAsDoubleTimingStatsValue a
x of
    Just ResultValue (TimingStats Double)
a -> ResultValue (TimingStats Double)
a
    Maybe (ResultValue (TimingStats Double))
Nothing ->
      forall a. HasCallStack => ResultName -> a
error forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " forall a. [a] -> [a] -> [a]
++ forall a. ResultItemable a => a -> ResultName
resultItemName a
x forall a. [a] -> [a] -> [a]
++
      ResultName
" as a source of timing statistics based on double-precision floating-point numbers: resultItemToDoubleTimingStatsValue"

-- | Return string representations in time points.
resultItemToStringValue :: ResultItemable a => a -> ResultValue String
resultItemToStringValue :: forall a. ResultItemable a => a -> ResultValue ResultName
resultItemToStringValue a
x =
  case forall a. ResultItemable a => a -> Maybe (ResultValue ResultName)
resultItemAsStringValue a
x of
    Just ResultValue ResultName
a -> ResultValue ResultName
a
    Maybe (ResultValue ResultName)
Nothing ->
      forall a. HasCallStack => ResultName -> a
error forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " forall a. [a] -> [a] -> [a]
++ forall a. ResultItemable a => a -> ResultName
resultItemName a
x forall a. [a] -> [a] -> [a]
++
      ResultName
" as a source of strings: resultItemToStringValue"

-- | The simulation results represented by an object having properties.
data ResultObject =
  ResultObject { ResultObject -> ResultName
resultObjectName :: ResultName,
                 -- ^ The object name.
                 ResultObject -> ResultId
resultObjectId :: ResultId,
                 -- ^ The object identifier.
                 ResultObject -> ResultId
resultObjectTypeId :: ResultId,
                 -- ^ The object type identifier.
                 ResultObject -> [ResultProperty]
resultObjectProperties :: [ResultProperty],
                 -- ^ The object properties.
                 ResultObject -> ResultSignal
resultObjectSignal :: ResultSignal,
                 -- ^ A combined signal if present.
                 ResultObject -> ResultSource
resultObjectSummary :: ResultSource
                 -- ^ A short version of the object, i.e. its summary.
               }

-- | The object property containing the simulation results.
data ResultProperty =
  ResultProperty { ResultProperty -> ResultName
resultPropertyLabel :: ResultName,
                   -- ^ The property short label.
                   ResultProperty -> ResultId
resultPropertyId :: ResultId,
                   -- ^ The property identifier.
                   ResultProperty -> ResultSource
resultPropertySource :: ResultSource
                   -- ^ The simulation results supplied by the property.
                 }

-- | The simulation results represented by a vector.
data ResultVector =
  ResultVector { ResultVector -> ResultName
resultVectorName :: ResultName,
                 -- ^ The vector name.
                 ResultVector -> ResultId
resultVectorId :: ResultId,
                 -- ^ The vector identifier.
                 ResultVector -> Array Int ResultSource
resultVectorItems :: A.Array Int ResultSource,
                 -- ^ The results supplied by the vector items.
                 ResultVector -> Array Int ResultName
resultVectorSubscript :: A.Array Int ResultName,
                 -- ^ The subscript used as a suffix to create item names.
                 ResultVector -> ResultSignal
resultVectorSignal :: ResultSignal,
                 -- ^ A combined signal if present.
                 ResultVector -> ResultSource
resultVectorSummary :: ResultSource
                 -- ^ A short version of the vector, i.e. summary.
               }

-- | Calculate the result vector signal and memoize it in a new vector.
memoResultVectorSignal :: ResultVector -> ResultVector
memoResultVectorSignal :: ResultVector -> ResultVector
memoResultVectorSignal ResultVector
x =
  ResultVector
x { resultVectorSignal :: ResultSignal
resultVectorSignal =
         forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr forall a. Semigroup a => a -> a -> a
(<>) forall a. Monoid a => a
mempty forall a b. (a -> b) -> a -> b
$ forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> ResultSignal
resultSourceSignal forall a b. (a -> b) -> a -> b
$ forall i e. Array i e -> [e]
A.elems forall a b. (a -> b) -> a -> b
$ ResultVector -> Array Int ResultSource
resultVectorItems ResultVector
x }

-- | Calculate the result vector summary and memoize it in a new vector.
memoResultVectorSummary :: ResultVector -> ResultVector
memoResultVectorSummary :: ResultVector -> ResultVector
memoResultVectorSummary ResultVector
x =
  ResultVector
x { resultVectorSummary :: ResultSource
resultVectorSummary =
         ResultVector -> ResultSource
ResultVectorSource forall a b. (a -> b) -> a -> b
$
         ResultVector
x { resultVectorItems :: Array Int ResultSource
resultVectorItems =
                forall i e. Ix i => (i, i) -> [(i, e)] -> Array i e
A.array (Int, Int)
bnds [(Int
i, ResultSource -> ResultSource
resultSourceSummary ResultSource
e) | (Int
i, ResultSource
e) <- [(Int, ResultSource)]
ies] } }
  where
    arr :: Array Int ResultSource
arr  = ResultVector -> Array Int ResultSource
resultVectorItems ResultVector
x
    bnds :: (Int, Int)
bnds = forall i e. Array i e -> (i, i)
A.bounds Array Int ResultSource
arr
    ies :: [(Int, ResultSource)]
ies  = forall i e. Ix i => Array i e -> [(i, e)]
A.assocs Array Int ResultSource
arr

-- | It separates the simulation results when printing.
data ResultSeparator =
  ResultSeparator { ResultSeparator -> ResultName
resultSeparatorText :: String
                    -- ^ The separator text.
                  }

-- | A parameterised value that actually represents a generalised result item that have no parametric type.
data ResultValue e =
  ResultValue { forall e. ResultValue e -> ResultName
resultValueName :: ResultName,
                -- ^ The value name.
                forall e. ResultValue e -> [ResultName]
resultValueNamePath :: [ResultName],
                -- ^ The value name path.
                forall e. ResultValue e -> ResultId
resultValueId :: ResultId,
                -- ^ The value identifier.
                forall e. ResultValue e -> [ResultId]
resultValueIdPath :: [ResultId],
                -- ^ The value identifier path.
                forall e. ResultValue e -> ResultData e
resultValueData :: ResultData e,
                -- ^ Simulation data supplied by the value.
                forall e. ResultValue e -> ResultSignal
resultValueSignal :: ResultSignal
                -- ^ Whether the value emits a signal when changing simulation data.
              }

instance Functor ResultValue where
  fmap :: forall a b. (a -> b) -> ResultValue a -> ResultValue b
fmap a -> b
f ResultValue a
x = ResultValue a
x { resultValueData :: ResultData b
resultValueData = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> b
f (forall e. ResultValue e -> ResultData e
resultValueData ResultValue a
x) }

-- | Transform the result value.
apResultValue :: ResultData (a -> b) -> ResultValue a -> ResultValue b
apResultValue :: forall a b. ResultData (a -> b) -> ResultValue a -> ResultValue b
apResultValue ResultData (a -> b)
f ResultValue a
x = ResultValue a
x { resultValueData :: ResultData b
resultValueData = forall (m :: * -> *) a b. Monad m => m (a -> b) -> m a -> m b
ap ResultData (a -> b)
f (forall e. ResultValue e -> ResultData e
resultValueData ResultValue a
x) }

-- | A container of the simulation results such as queue, server or array.
data ResultContainer e =
  ResultContainer { forall e. ResultContainer e -> ResultName
resultContainerName :: ResultName,
                    -- ^ The container name.
                    forall e. ResultContainer e -> [ResultName]
resultContainerNamePath :: [ResultName],
                    -- ^ The container name path.
                    forall e. ResultContainer e -> ResultId
resultContainerId :: ResultId,
                    -- ^ The container identifier.
                    forall e. ResultContainer e -> [ResultId]
resultContainerIdPath :: [ResultId],
                    -- ^ The container identifier path.
                    forall e. ResultContainer e -> e
resultContainerData :: e,
                    -- ^ The container data.
                    forall e. ResultContainer e -> ResultSignal
resultContainerSignal :: ResultSignal
                    -- ^ Whether the container emits a signal when changing simulation data.
                  }

instance Functor ResultContainer where
  fmap :: forall a b. (a -> b) -> ResultContainer a -> ResultContainer b
fmap a -> b
f ResultContainer a
x = ResultContainer a
x { resultContainerData :: b
resultContainerData = a -> b
f (forall e. ResultContainer e -> e
resultContainerData ResultContainer a
x) }

-- | Create a new property source by the specified container.
resultContainerPropertySource :: ResultItemable (ResultValue b)
                                 => ResultContainer a
                                 -- ^ the container
                                 -> ResultName
                                 -- ^ the property label
                                 -> ResultId
                                 -- ^ the property identifier
                                 -> (a -> ResultData b)
                                 -- ^ get the specified data from the container
                                 -> (a -> ResultSignal)
                                 -- ^ get the data signal from the container
                                 -> ResultSource
resultContainerPropertySource :: forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> ResultData b)
-> (a -> ResultSignal)
-> ResultSource
resultContainerPropertySource ResultContainer a
cont ResultName
name ResultId
i a -> ResultData b
f a -> ResultSignal
g =
  ResultItem -> ResultSource
ResultItemSource forall a b. (a -> b) -> a -> b
$
  forall a. ResultItemable a => a -> ResultItem
ResultItem forall a b. (a -> b) -> a -> b
$
  ResultValue {
    resultValueName :: ResultName
resultValueName   = (forall e. ResultContainer e -> ResultName
resultContainerName ResultContainer a
cont) forall a. [a] -> [a] -> [a]
++ ResultName
"." forall a. [a] -> [a] -> [a]
++ ResultName
name,
    resultValueNamePath :: [ResultName]
resultValueNamePath = (forall e. ResultContainer e -> [ResultName]
resultContainerNamePath ResultContainer a
cont) forall a. [a] -> [a] -> [a]
++ [ResultName
name],
    resultValueId :: ResultId
resultValueId     = ResultId
i,
    resultValueIdPath :: [ResultId]
resultValueIdPath = (forall e. ResultContainer e -> [ResultId]
resultContainerIdPath ResultContainer a
cont) forall a. [a] -> [a] -> [a]
++ [ResultId
i],
    resultValueData :: ResultData b
resultValueData   = a -> ResultData b
f (forall e. ResultContainer e -> e
resultContainerData ResultContainer a
cont),
    resultValueSignal :: ResultSignal
resultValueSignal = a -> ResultSignal
g (forall e. ResultContainer e -> e
resultContainerData ResultContainer a
cont) }

-- | Create a constant property by the specified container.
resultContainerConstProperty :: ResultItemable (ResultValue b)
                                => ResultContainer a
                                -- ^ the container
                                -> ResultName
                                -- ^ the property label
                                -> ResultId
                                -- ^ the property identifier
                                -> (a -> b)
                                -- ^ get the specified data from the container
                                -> ResultProperty
resultContainerConstProperty :: forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerConstProperty ResultContainer a
cont ResultName
name ResultId
i a -> b
f =
  ResultProperty {
    resultPropertyLabel :: ResultName
resultPropertyLabel = ResultName
name,
    resultPropertyId :: ResultId
resultPropertyId = ResultId
i,
    resultPropertySource :: ResultSource
resultPropertySource =
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> ResultData b)
-> (a -> ResultSignal)
-> ResultSource
resultContainerPropertySource ResultContainer a
cont ResultName
name ResultId
i (forall (m :: * -> *) a. Monad m => a -> m a
return forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> b
f) (forall a b. a -> b -> a
const ResultSignal
EmptyResultSignal) }
  
-- | Create by the specified container a property that changes in the integration time points, or it is supposed to be such one.
resultContainerIntegProperty :: ResultItemable (ResultValue b)
                                => ResultContainer a
                                -- ^ the container
                                -> ResultName
                                -- ^ the property label
                                -> ResultId
                                -- ^ the property identifier
                                -> (a -> Event b)
                                -- ^ get the specified data from the container
                             -> ResultProperty
resultContainerIntegProperty :: forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName -> ResultId -> (a -> Event b) -> ResultProperty
resultContainerIntegProperty ResultContainer a
cont ResultName
name ResultId
i a -> Event b
f =
  ResultProperty {
    resultPropertyLabel :: ResultName
resultPropertyLabel = ResultName
name,
    resultPropertyId :: ResultId
resultPropertyId = ResultId
i,
    resultPropertySource :: ResultSource
resultPropertySource =
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> ResultData b)
-> (a -> ResultSignal)
-> ResultSource
resultContainerPropertySource ResultContainer a
cont ResultName
name ResultId
i a -> Event b
f (forall a b. a -> b -> a
const ResultSignal
UnknownResultSignal) }
  
-- | Create a property by the specified container.
resultContainerProperty :: ResultItemable (ResultValue b)
                           => ResultContainer a
                           -- ^ the container
                           -> ResultName
                           -- ^ the property label
                           -> ResultId
                           -- ^ the property identifier
                           -> (a -> Event b)
                           -- ^ get the specified data from the container
                           -> (a -> Signal ())
                           -- ^ get a signal triggered when changing data.
                           -> ResultProperty
resultContainerProperty :: forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer a
cont ResultName
name ResultId
i a -> Event b
f a -> Signal ()
g =                     
  ResultProperty {
    resultPropertyLabel :: ResultName
resultPropertyLabel = ResultName
name,
    resultPropertyId :: ResultId
resultPropertyId = ResultId
i,
    resultPropertySource :: ResultSource
resultPropertySource =
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> ResultData b)
-> (a -> ResultSignal)
-> ResultSource
resultContainerPropertySource ResultContainer a
cont ResultName
name ResultId
i a -> Event b
f (Signal () -> ResultSignal
ResultSignal forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Signal ()
g) }

-- | Create by the specified container a mapped property which is recomputed each time again and again.
resultContainerMapProperty :: ResultItemable (ResultValue b)
                              => ResultContainer (ResultData a)
                              -- ^ the container
                              -> ResultName
                              -- ^ the property label
                              -> ResultId
                              -- ^ the property identifier
                              -> (a -> b)
                              -- ^ recompute the specified data
                              -> ResultProperty
resultContainerMapProperty :: forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData a)
cont ResultName
name ResultId
i a -> b
f =                     
  ResultProperty {
    resultPropertyLabel :: ResultName
resultPropertyLabel = ResultName
name,
    resultPropertyId :: ResultId
resultPropertyId = ResultId
i,
    resultPropertySource :: ResultSource
resultPropertySource =
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> ResultData b)
-> (a -> ResultSignal)
-> ResultSource
resultContainerPropertySource ResultContainer (ResultData a)
cont ResultName
name ResultId
i (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> b
f) (forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall e. ResultContainer e -> ResultSignal
resultContainerSignal ResultContainer (ResultData a)
cont) }

-- | Convert the result value to a container with the specified object identifier. 
resultValueToContainer :: ResultValue a -> ResultContainer (ResultData a)
resultValueToContainer :: forall a. ResultValue a -> ResultContainer (ResultData a)
resultValueToContainer ResultValue a
x =
  ResultContainer {
    resultContainerName :: ResultName
resultContainerName   = forall e. ResultValue e -> ResultName
resultValueName ResultValue a
x,
    resultContainerNamePath :: [ResultName]
resultContainerNamePath = forall e. ResultValue e -> [ResultName]
resultValueNamePath ResultValue a
x,
    resultContainerId :: ResultId
resultContainerId     = forall e. ResultValue e -> ResultId
resultValueId ResultValue a
x,
    resultContainerIdPath :: [ResultId]
resultContainerIdPath = forall e. ResultValue e -> [ResultId]
resultValueIdPath ResultValue a
x,
    resultContainerData :: ResultData a
resultContainerData   = forall e. ResultValue e -> ResultData e
resultValueData ResultValue a
x,
    resultContainerSignal :: ResultSignal
resultContainerSignal = forall e. ResultValue e -> ResultSignal
resultValueSignal ResultValue a
x }

-- | Convert the result container to a value.
resultContainerToValue :: ResultContainer (ResultData a) -> ResultValue a
resultContainerToValue :: forall a. ResultContainer (ResultData a) -> ResultValue a
resultContainerToValue ResultContainer (ResultData a)
x =
  ResultValue {
    resultValueName :: ResultName
resultValueName   = forall e. ResultContainer e -> ResultName
resultContainerName ResultContainer (ResultData a)
x,
    resultValueNamePath :: [ResultName]
resultValueNamePath = forall e. ResultContainer e -> [ResultName]
resultContainerNamePath ResultContainer (ResultData a)
x,
    resultValueId :: ResultId
resultValueId     = forall e. ResultContainer e -> ResultId
resultContainerId ResultContainer (ResultData a)
x,
    resultValueIdPath :: [ResultId]
resultValueIdPath = forall e. ResultContainer e -> [ResultId]
resultContainerIdPath ResultContainer (ResultData a)
x,
    resultValueData :: ResultData a
resultValueData   = forall e. ResultContainer e -> e
resultContainerData ResultContainer (ResultData a)
x,
    resultValueSignal :: ResultSignal
resultValueSignal = forall e. ResultContainer e -> ResultSignal
resultContainerSignal ResultContainer (ResultData a)
x }

-- | Represents the very simulation results.
type ResultData e = Event e

-- | Convert the timing statistics data to its normalised sampling-based representation.
normTimingStatsData :: TimingData a => ResultData (TimingStats a -> SamplingStats a)
normTimingStatsData :: forall a.
TimingData a =>
ResultData (TimingStats a -> SamplingStats a)
normTimingStatsData =
  do Int
n <- forall (m :: * -> *) a. DynamicsLift m => Dynamics a -> m a
liftDynamics Dynamics Int
integIteration
     forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ forall a. TimingData a => Int -> TimingStats a -> SamplingStats a
normTimingStats (forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
n)

-- | Whether an object containing the results emits a signal notifying about change of data.
data ResultSignal = EmptyResultSignal
                    -- ^ There is no signal at all.
                  | UnknownResultSignal
                    -- ^ The signal is unknown, but the entity probably changes.
                  | ResultSignal (Signal ())
                    -- ^ When the signal is precisely specified.
                  | ResultSignalMix (Signal ())
                    -- ^ When the specified signal was combined with unknown signal.

instance Semigroup ResultSignal where
  <> :: ResultSignal -> ResultSignal -> ResultSignal
(<>) ResultSignal
EmptyResultSignal ResultSignal
z = ResultSignal
z

  (<>) ResultSignal
UnknownResultSignal ResultSignal
EmptyResultSignal = ResultSignal
UnknownResultSignal
  (<>) ResultSignal
UnknownResultSignal ResultSignal
UnknownResultSignal = ResultSignal
UnknownResultSignal
  (<>) ResultSignal
UnknownResultSignal (ResultSignal Signal ()
x) = Signal () -> ResultSignal
ResultSignalMix Signal ()
x
  (<>) ResultSignal
UnknownResultSignal z :: ResultSignal
z@(ResultSignalMix Signal ()
x) = ResultSignal
z

  (<>) z :: ResultSignal
z@(ResultSignal Signal ()
x) ResultSignal
EmptyResultSignal = ResultSignal
z
  (<>) (ResultSignal Signal ()
x) ResultSignal
UnknownResultSignal = Signal () -> ResultSignal
ResultSignalMix Signal ()
x
  (<>) (ResultSignal Signal ()
x) (ResultSignal Signal ()
y) = Signal () -> ResultSignal
ResultSignal (Signal ()
x forall a. Semigroup a => a -> a -> a
<> Signal ()
y)
  (<>) (ResultSignal Signal ()
x) (ResultSignalMix Signal ()
y) = Signal () -> ResultSignal
ResultSignalMix (Signal ()
x forall a. Semigroup a => a -> a -> a
<> Signal ()
y)

  (<>) z :: ResultSignal
z@(ResultSignalMix Signal ()
x) ResultSignal
EmptyResultSignal = ResultSignal
z
  (<>) z :: ResultSignal
z@(ResultSignalMix Signal ()
x) ResultSignal
UnknownResultSignal = ResultSignal
z
  (<>) (ResultSignalMix Signal ()
x) (ResultSignal Signal ()
y) = Signal () -> ResultSignal
ResultSignalMix (Signal ()
x forall a. Semigroup a => a -> a -> a
<> Signal ()
y)
  (<>) (ResultSignalMix Signal ()
x) (ResultSignalMix Signal ()
y) = Signal () -> ResultSignal
ResultSignalMix (Signal ()
x forall a. Semigroup a => a -> a -> a
<> Signal ()
y)

instance Monoid ResultSignal where

  mempty :: ResultSignal
mempty = ResultSignal
EmptyResultSignal
  mappend :: ResultSignal -> ResultSignal -> ResultSignal
mappend = forall a. Semigroup a => a -> a -> a
(<>)

-- | Construct a new result signal by the specified optional pure signal.
maybeResultSignal :: Maybe (Signal ()) -> ResultSignal
maybeResultSignal :: Maybe (Signal ()) -> ResultSignal
maybeResultSignal (Just Signal ()
x) = Signal () -> ResultSignal
ResultSignal Signal ()
x
maybeResultSignal Maybe (Signal ())
Nothing  = ResultSignal
EmptyResultSignal

instance ResultItemable (ResultValue Int) where

  resultItemName :: ResultValue Int -> ResultName
resultItemName = forall e. ResultValue e -> ResultName
resultValueName
  resultItemNamePath :: ResultValue Int -> [ResultName]
resultItemNamePath = forall e. ResultValue e -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue Int -> ResultId
resultItemId = forall e. ResultValue e -> ResultId
resultValueId
  resultItemIdPath :: ResultValue Int -> [ResultId]
resultItemIdPath = forall e. ResultValue e -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue Int -> ResultSignal
resultItemSignal = forall e. ResultValue e -> ResultSignal
resultValueSignal
  
  resultItemAsIntValue :: ResultValue Int -> Maybe (ResultValue Int)
resultItemAsIntValue = forall a. a -> Maybe a
Just
  resultItemAsIntListValue :: ResultValue Int -> Maybe (ResultValue [Int])
resultItemAsIntListValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall (m :: * -> *) a. Monad m => a -> m a
return
  resultItemAsIntStatsValue :: ResultValue Int -> Maybe (ResultValue (SamplingStats Int))
resultItemAsIntStatsValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. SamplingData a => a -> SamplingStats a
returnSamplingStats
  resultItemAsIntTimingStatsValue :: ResultValue Int -> Maybe (ResultValue (TimingStats Int))
resultItemAsIntTimingStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing

  resultItemAsDoubleValue :: ResultValue Int -> Maybe (ResultValue Double)
resultItemAsDoubleValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a b. (Integral a, Num b) => a -> b
fromIntegral
  resultItemAsDoubleListValue :: ResultValue Int -> Maybe (ResultValue [Double])
resultItemAsDoubleListValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (forall (m :: * -> *) a. Monad m => a -> m a
return forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (Integral a, Num b) => a -> b
fromIntegral)
  resultItemAsDoubleStatsValue :: ResultValue Int -> Maybe (ResultValue (SamplingStats Double))
resultItemAsDoubleStatsValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (forall a. SamplingData a => a -> SamplingStats a
returnSamplingStats forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (Integral a, Num b) => a -> b
fromIntegral)
  resultItemAsDoubleTimingStatsValue :: ResultValue Int -> Maybe (ResultValue (TimingStats Double))
resultItemAsDoubleTimingStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing

  resultItemAsStringValue :: ResultValue Int -> Maybe (ResultValue ResultName)
resultItemAsStringValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Show a => a -> ResultName
show

  resultItemExpansion :: ResultValue Int -> ResultSource
resultItemExpansion = ResultItem -> ResultSource
ResultItemSource forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ResultItemable a => a -> ResultItem
ResultItem
  resultItemSummary :: ResultValue Int -> ResultSource
resultItemSummary = ResultItem -> ResultSource
ResultItemSource forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ResultItemable a => a -> ResultItem
ResultItem

instance ResultItemable (ResultValue Double) where

  resultItemName :: ResultValue Double -> ResultName
resultItemName = forall e. ResultValue e -> ResultName
resultValueName
  resultItemNamePath :: ResultValue Double -> [ResultName]
resultItemNamePath = forall e. ResultValue e -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue Double -> ResultId
resultItemId = forall e. ResultValue e -> ResultId
resultValueId
  resultItemIdPath :: ResultValue Double -> [ResultId]
resultItemIdPath = forall e. ResultValue e -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue Double -> ResultSignal
resultItemSignal = forall e. ResultValue e -> ResultSignal
resultValueSignal
  
  resultItemAsIntValue :: ResultValue Double -> Maybe (ResultValue Int)
resultItemAsIntValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue Double -> Maybe (ResultValue [Int])
resultItemAsIntListValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntStatsValue :: ResultValue Double -> Maybe (ResultValue (SamplingStats Int))
resultItemAsIntStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntTimingStatsValue :: ResultValue Double -> Maybe (ResultValue (TimingStats Int))
resultItemAsIntTimingStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  
  resultItemAsDoubleValue :: ResultValue Double -> Maybe (ResultValue Double)
resultItemAsDoubleValue = forall a. a -> Maybe a
Just
  resultItemAsDoubleListValue :: ResultValue Double -> Maybe (ResultValue [Double])
resultItemAsDoubleListValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall (m :: * -> *) a. Monad m => a -> m a
return
  resultItemAsDoubleStatsValue :: ResultValue Double -> Maybe (ResultValue (SamplingStats Double))
resultItemAsDoubleStatsValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. SamplingData a => a -> SamplingStats a
returnSamplingStats
  resultItemAsDoubleTimingStatsValue :: ResultValue Double -> Maybe (ResultValue (TimingStats Double))
resultItemAsDoubleTimingStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing

  resultItemAsStringValue :: ResultValue Double -> Maybe (ResultValue ResultName)
resultItemAsStringValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Show a => a -> ResultName
show
  
  resultItemExpansion :: ResultValue Double -> ResultSource
resultItemExpansion = ResultItem -> ResultSource
ResultItemSource forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ResultItemable a => a -> ResultItem
ResultItem
  resultItemSummary :: ResultValue Double -> ResultSource
resultItemSummary = ResultItem -> ResultSource
ResultItemSource forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ResultItemable a => a -> ResultItem
ResultItem

instance ResultItemable (ResultValue [Int]) where

  resultItemName :: ResultValue [Int] -> ResultName
resultItemName = forall e. ResultValue e -> ResultName
resultValueName
  resultItemNamePath :: ResultValue [Int] -> [ResultName]
resultItemNamePath = forall e. ResultValue e -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue [Int] -> ResultId
resultItemId = forall e. ResultValue e -> ResultId
resultValueId
  resultItemIdPath :: ResultValue [Int] -> [ResultId]
resultItemIdPath = forall e. ResultValue e -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue [Int] -> ResultSignal
resultItemSignal = forall e. ResultValue e -> ResultSignal
resultValueSignal
  
  resultItemAsIntValue :: ResultValue [Int] -> Maybe (ResultValue Int)
resultItemAsIntValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue [Int] -> Maybe (ResultValue [Int])
resultItemAsIntListValue = forall a. a -> Maybe a
Just
  resultItemAsIntStatsValue :: ResultValue [Int] -> Maybe (ResultValue (SamplingStats Int))
resultItemAsIntStatsValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. SamplingData a => [a] -> SamplingStats a
listSamplingStats
  resultItemAsIntTimingStatsValue :: ResultValue [Int] -> Maybe (ResultValue (TimingStats Int))
resultItemAsIntTimingStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing

  resultItemAsDoubleValue :: ResultValue [Int] -> Maybe (ResultValue Double)
resultItemAsDoubleValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleListValue :: ResultValue [Int] -> Maybe (ResultValue [Double])
resultItemAsDoubleListValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (forall a b. (a -> b) -> [a] -> [b]
map forall a b. (Integral a, Num b) => a -> b
fromIntegral)
  resultItemAsDoubleStatsValue :: ResultValue [Int] -> Maybe (ResultValue (SamplingStats Double))
resultItemAsDoubleStatsValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (SamplingStats Int -> SamplingStats Double
fromIntSamplingStats forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. SamplingData a => [a] -> SamplingStats a
listSamplingStats)
  resultItemAsDoubleTimingStatsValue :: ResultValue [Int] -> Maybe (ResultValue (TimingStats Double))
resultItemAsDoubleTimingStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing

  resultItemAsStringValue :: ResultValue [Int] -> Maybe (ResultValue ResultName)
resultItemAsStringValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Show a => a -> ResultName
show
  
  resultItemExpansion :: ResultValue [Int] -> ResultSource
resultItemExpansion = ResultItem -> ResultSource
ResultItemSource forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ResultItemable a => a -> ResultItem
ResultItem
  resultItemSummary :: ResultValue [Int] -> ResultSource
resultItemSummary = ResultItem -> ResultSource
ResultItemSource forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ResultItemable a => a -> ResultItem
ResultItem

instance ResultItemable (ResultValue [Double]) where

  resultItemName :: ResultValue [Double] -> ResultName
resultItemName = forall e. ResultValue e -> ResultName
resultValueName
  resultItemNamePath :: ResultValue [Double] -> [ResultName]
resultItemNamePath = forall e. ResultValue e -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue [Double] -> ResultId
resultItemId = forall e. ResultValue e -> ResultId
resultValueId
  resultItemIdPath :: ResultValue [Double] -> [ResultId]
resultItemIdPath = forall e. ResultValue e -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue [Double] -> ResultSignal
resultItemSignal = forall e. ResultValue e -> ResultSignal
resultValueSignal
  
  resultItemAsIntValue :: ResultValue [Double] -> Maybe (ResultValue Int)
resultItemAsIntValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue [Double] -> Maybe (ResultValue [Int])
resultItemAsIntListValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntStatsValue :: ResultValue [Double] -> Maybe (ResultValue (SamplingStats Int))
resultItemAsIntStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntTimingStatsValue :: ResultValue [Double] -> Maybe (ResultValue (TimingStats Int))
resultItemAsIntTimingStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  
  resultItemAsDoubleValue :: ResultValue [Double] -> Maybe (ResultValue Double)
resultItemAsDoubleValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleListValue :: ResultValue [Double] -> Maybe (ResultValue [Double])
resultItemAsDoubleListValue = forall a. a -> Maybe a
Just
  resultItemAsDoubleStatsValue :: ResultValue [Double] -> Maybe (ResultValue (SamplingStats Double))
resultItemAsDoubleStatsValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. SamplingData a => [a] -> SamplingStats a
listSamplingStats
  resultItemAsDoubleTimingStatsValue :: ResultValue [Double] -> Maybe (ResultValue (TimingStats Double))
resultItemAsDoubleTimingStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing

  resultItemAsStringValue :: ResultValue [Double] -> Maybe (ResultValue ResultName)
resultItemAsStringValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Show a => a -> ResultName
show
  
  resultItemExpansion :: ResultValue [Double] -> ResultSource
resultItemExpansion = ResultItem -> ResultSource
ResultItemSource forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ResultItemable a => a -> ResultItem
ResultItem
  resultItemSummary :: ResultValue [Double] -> ResultSource
resultItemSummary = ResultItem -> ResultSource
ResultItemSource forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ResultItemable a => a -> ResultItem
ResultItem

instance ResultItemable (ResultValue (SamplingStats Int)) where

  resultItemName :: ResultValue (SamplingStats Int) -> ResultName
resultItemName = forall e. ResultValue e -> ResultName
resultValueName
  resultItemNamePath :: ResultValue (SamplingStats Int) -> [ResultName]
resultItemNamePath = forall e. ResultValue e -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue (SamplingStats Int) -> ResultId
resultItemId = forall e. ResultValue e -> ResultId
resultValueId
  resultItemIdPath :: ResultValue (SamplingStats Int) -> [ResultId]
resultItemIdPath = forall e. ResultValue e -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue (SamplingStats Int) -> ResultSignal
resultItemSignal = forall e. ResultValue e -> ResultSignal
resultValueSignal
  
  resultItemAsIntValue :: ResultValue (SamplingStats Int) -> Maybe (ResultValue Int)
resultItemAsIntValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue (SamplingStats Int) -> Maybe (ResultValue [Int])
resultItemAsIntListValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntStatsValue :: ResultValue (SamplingStats Int)
-> Maybe (ResultValue (SamplingStats Int))
resultItemAsIntStatsValue = forall a. a -> Maybe a
Just
  resultItemAsIntTimingStatsValue :: ResultValue (SamplingStats Int)
-> Maybe (ResultValue (TimingStats Int))
resultItemAsIntTimingStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing

  resultItemAsDoubleValue :: ResultValue (SamplingStats Int) -> Maybe (ResultValue Double)
resultItemAsDoubleValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleListValue :: ResultValue (SamplingStats Int) -> Maybe (ResultValue [Double])
resultItemAsDoubleListValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleStatsValue :: ResultValue (SamplingStats Int)
-> Maybe (ResultValue (SamplingStats Double))
resultItemAsDoubleStatsValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap SamplingStats Int -> SamplingStats Double
fromIntSamplingStats
  resultItemAsDoubleTimingStatsValue :: ResultValue (SamplingStats Int)
-> Maybe (ResultValue (TimingStats Double))
resultItemAsDoubleTimingStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing

  resultItemAsStringValue :: ResultValue (SamplingStats Int) -> Maybe (ResultValue ResultName)
resultItemAsStringValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Show a => a -> ResultName
show
  
  resultItemExpansion :: ResultValue (SamplingStats Int) -> ResultSource
resultItemExpansion = forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (SamplingStats a))) =>
ResultValue (SamplingStats a) -> ResultSource
samplingStatsResultSource
  resultItemSummary :: ResultValue (SamplingStats Int) -> ResultSource
resultItemSummary = forall a.
ResultItemable (ResultValue (SamplingStats a)) =>
ResultValue (SamplingStats a) -> ResultSource
samplingStatsResultSummary

instance ResultItemable (ResultValue (SamplingStats Double)) where

  resultItemName :: ResultValue (SamplingStats Double) -> ResultName
resultItemName = forall e. ResultValue e -> ResultName
resultValueName
  resultItemNamePath :: ResultValue (SamplingStats Double) -> [ResultName]
resultItemNamePath = forall e. ResultValue e -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue (SamplingStats Double) -> ResultId
resultItemId = forall e. ResultValue e -> ResultId
resultValueId
  resultItemIdPath :: ResultValue (SamplingStats Double) -> [ResultId]
resultItemIdPath = forall e. ResultValue e -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue (SamplingStats Double) -> ResultSignal
resultItemSignal = forall e. ResultValue e -> ResultSignal
resultValueSignal
  
  resultItemAsIntValue :: ResultValue (SamplingStats Double) -> Maybe (ResultValue Int)
resultItemAsIntValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue (SamplingStats Double) -> Maybe (ResultValue [Int])
resultItemAsIntListValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntStatsValue :: ResultValue (SamplingStats Double)
-> Maybe (ResultValue (SamplingStats Int))
resultItemAsIntStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntTimingStatsValue :: ResultValue (SamplingStats Double)
-> Maybe (ResultValue (TimingStats Int))
resultItemAsIntTimingStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  
  resultItemAsDoubleValue :: ResultValue (SamplingStats Double) -> Maybe (ResultValue Double)
resultItemAsDoubleValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleListValue :: ResultValue (SamplingStats Double) -> Maybe (ResultValue [Double])
resultItemAsDoubleListValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleStatsValue :: ResultValue (SamplingStats Double)
-> Maybe (ResultValue (SamplingStats Double))
resultItemAsDoubleStatsValue = forall a. a -> Maybe a
Just
  resultItemAsDoubleTimingStatsValue :: ResultValue (SamplingStats Double)
-> Maybe (ResultValue (TimingStats Double))
resultItemAsDoubleTimingStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing

  resultItemAsStringValue :: ResultValue (SamplingStats Double)
-> Maybe (ResultValue ResultName)
resultItemAsStringValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Show a => a -> ResultName
show
  
  resultItemExpansion :: ResultValue (SamplingStats Double) -> ResultSource
resultItemExpansion = forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (SamplingStats a))) =>
ResultValue (SamplingStats a) -> ResultSource
samplingStatsResultSource
  resultItemSummary :: ResultValue (SamplingStats Double) -> ResultSource
resultItemSummary = forall a.
ResultItemable (ResultValue (SamplingStats a)) =>
ResultValue (SamplingStats a) -> ResultSource
samplingStatsResultSummary

instance ResultItemable (ResultValue (TimingStats Int)) where

  resultItemName :: ResultValue (TimingStats Int) -> ResultName
resultItemName = forall e. ResultValue e -> ResultName
resultValueName
  resultItemNamePath :: ResultValue (TimingStats Int) -> [ResultName]
resultItemNamePath = forall e. ResultValue e -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue (TimingStats Int) -> ResultId
resultItemId = forall e. ResultValue e -> ResultId
resultValueId
  resultItemIdPath :: ResultValue (TimingStats Int) -> [ResultId]
resultItemIdPath = forall e. ResultValue e -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue (TimingStats Int) -> ResultSignal
resultItemSignal = forall e. ResultValue e -> ResultSignal
resultValueSignal
  
  resultItemAsIntValue :: ResultValue (TimingStats Int) -> Maybe (ResultValue Int)
resultItemAsIntValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue (TimingStats Int) -> Maybe (ResultValue [Int])
resultItemAsIntListValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntStatsValue :: ResultValue (TimingStats Int)
-> Maybe (ResultValue (SamplingStats Int))
resultItemAsIntStatsValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. ResultData (a -> b) -> ResultValue a -> ResultValue b
apResultValue forall a.
TimingData a =>
ResultData (TimingStats a -> SamplingStats a)
normTimingStatsData
  resultItemAsIntTimingStatsValue :: ResultValue (TimingStats Int)
-> Maybe (ResultValue (TimingStats Int))
resultItemAsIntTimingStatsValue = forall a. a -> Maybe a
Just

  resultItemAsDoubleValue :: ResultValue (TimingStats Int) -> Maybe (ResultValue Double)
resultItemAsDoubleValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleListValue :: ResultValue (TimingStats Int) -> Maybe (ResultValue [Double])
resultItemAsDoubleListValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleStatsValue :: ResultValue (TimingStats Int)
-> Maybe (ResultValue (SamplingStats Double))
resultItemAsDoubleStatsValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap SamplingStats Int -> SamplingStats Double
fromIntSamplingStats forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. ResultData (a -> b) -> ResultValue a -> ResultValue b
apResultValue forall a.
TimingData a =>
ResultData (TimingStats a -> SamplingStats a)
normTimingStatsData
  resultItemAsDoubleTimingStatsValue :: ResultValue (TimingStats Int)
-> Maybe (ResultValue (TimingStats Double))
resultItemAsDoubleTimingStatsValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap TimingStats Int -> TimingStats Double
fromIntTimingStats

  resultItemAsStringValue :: ResultValue (TimingStats Int) -> Maybe (ResultValue ResultName)
resultItemAsStringValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Show a => a -> ResultName
show
  
  resultItemExpansion :: ResultValue (TimingStats Int) -> ResultSource
resultItemExpansion = forall a.
(TimingData a, ResultItemable (ResultValue a),
 ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingStats a) -> ResultSource
timingStatsResultSource
  resultItemSummary :: ResultValue (TimingStats Int) -> ResultSource
resultItemSummary = forall a.
(TimingData a, ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingStats a) -> ResultSource
timingStatsResultSummary

instance ResultItemable (ResultValue (TimingStats Double)) where

  resultItemName :: ResultValue (TimingStats Double) -> ResultName
resultItemName = forall e. ResultValue e -> ResultName
resultValueName
  resultItemNamePath :: ResultValue (TimingStats Double) -> [ResultName]
resultItemNamePath = forall e. ResultValue e -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue (TimingStats Double) -> ResultId
resultItemId = forall e. ResultValue e -> ResultId
resultValueId
  resultItemIdPath :: ResultValue (TimingStats Double) -> [ResultId]
resultItemIdPath = forall e. ResultValue e -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue (TimingStats Double) -> ResultSignal
resultItemSignal = forall e. ResultValue e -> ResultSignal
resultValueSignal
  
  resultItemAsIntValue :: ResultValue (TimingStats Double) -> Maybe (ResultValue Int)
resultItemAsIntValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue (TimingStats Double) -> Maybe (ResultValue [Int])
resultItemAsIntListValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntStatsValue :: ResultValue (TimingStats Double)
-> Maybe (ResultValue (SamplingStats Int))
resultItemAsIntStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntTimingStatsValue :: ResultValue (TimingStats Double)
-> Maybe (ResultValue (TimingStats Int))
resultItemAsIntTimingStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing

  resultItemAsDoubleValue :: ResultValue (TimingStats Double) -> Maybe (ResultValue Double)
resultItemAsDoubleValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleListValue :: ResultValue (TimingStats Double) -> Maybe (ResultValue [Double])
resultItemAsDoubleListValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleStatsValue :: ResultValue (TimingStats Double)
-> Maybe (ResultValue (SamplingStats Double))
resultItemAsDoubleStatsValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. ResultData (a -> b) -> ResultValue a -> ResultValue b
apResultValue forall a.
TimingData a =>
ResultData (TimingStats a -> SamplingStats a)
normTimingStatsData
  resultItemAsDoubleTimingStatsValue :: ResultValue (TimingStats Double)
-> Maybe (ResultValue (TimingStats Double))
resultItemAsDoubleTimingStatsValue = forall a. a -> Maybe a
Just

  resultItemAsStringValue :: ResultValue (TimingStats Double) -> Maybe (ResultValue ResultName)
resultItemAsStringValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Show a => a -> ResultName
show
  
  resultItemExpansion :: ResultValue (TimingStats Double) -> ResultSource
resultItemExpansion = forall a.
(TimingData a, ResultItemable (ResultValue a),
 ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingStats a) -> ResultSource
timingStatsResultSource
  resultItemSummary :: ResultValue (TimingStats Double) -> ResultSource
resultItemSummary = forall a.
(TimingData a, ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingStats a) -> ResultSource
timingStatsResultSummary

instance ResultItemable (ResultValue Bool) where

  resultItemName :: ResultValue Bool -> ResultName
resultItemName = forall e. ResultValue e -> ResultName
resultValueName
  resultItemNamePath :: ResultValue Bool -> [ResultName]
resultItemNamePath = forall e. ResultValue e -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue Bool -> ResultId
resultItemId = forall e. ResultValue e -> ResultId
resultValueId
  resultItemIdPath :: ResultValue Bool -> [ResultId]
resultItemIdPath = forall e. ResultValue e -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue Bool -> ResultSignal
resultItemSignal = forall e. ResultValue e -> ResultSignal
resultValueSignal
  
  resultItemAsIntValue :: ResultValue Bool -> Maybe (ResultValue Int)
resultItemAsIntValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue Bool -> Maybe (ResultValue [Int])
resultItemAsIntListValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntStatsValue :: ResultValue Bool -> Maybe (ResultValue (SamplingStats Int))
resultItemAsIntStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntTimingStatsValue :: ResultValue Bool -> Maybe (ResultValue (TimingStats Int))
resultItemAsIntTimingStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing

  resultItemAsDoubleValue :: ResultValue Bool -> Maybe (ResultValue Double)
resultItemAsDoubleValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleListValue :: ResultValue Bool -> Maybe (ResultValue [Double])
resultItemAsDoubleListValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleStatsValue :: ResultValue Bool -> Maybe (ResultValue (SamplingStats Double))
resultItemAsDoubleStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleTimingStatsValue :: ResultValue Bool -> Maybe (ResultValue (TimingStats Double))
resultItemAsDoubleTimingStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing

  resultItemAsStringValue :: ResultValue Bool -> Maybe (ResultValue ResultName)
resultItemAsStringValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Show a => a -> ResultName
show

  resultItemExpansion :: ResultValue Bool -> ResultSource
resultItemExpansion = ResultItem -> ResultSource
ResultItemSource forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ResultItemable a => a -> ResultItem
ResultItem
  resultItemSummary :: ResultValue Bool -> ResultSource
resultItemSummary = ResultItem -> ResultSource
ResultItemSource forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ResultItemable a => a -> ResultItem
ResultItem

instance ResultItemable (ResultValue String) where

  resultItemName :: ResultValue ResultName -> ResultName
resultItemName = forall e. ResultValue e -> ResultName
resultValueName
  resultItemNamePath :: ResultValue ResultName -> [ResultName]
resultItemNamePath = forall e. ResultValue e -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue ResultName -> ResultId
resultItemId = forall e. ResultValue e -> ResultId
resultValueId
  resultItemIdPath :: ResultValue ResultName -> [ResultId]
resultItemIdPath = forall e. ResultValue e -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue ResultName -> ResultSignal
resultItemSignal = forall e. ResultValue e -> ResultSignal
resultValueSignal
  
  resultItemAsIntValue :: ResultValue ResultName -> Maybe (ResultValue Int)
resultItemAsIntValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue ResultName -> Maybe (ResultValue [Int])
resultItemAsIntListValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntStatsValue :: ResultValue ResultName -> Maybe (ResultValue (SamplingStats Int))
resultItemAsIntStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntTimingStatsValue :: ResultValue ResultName -> Maybe (ResultValue (TimingStats Int))
resultItemAsIntTimingStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing

  resultItemAsDoubleValue :: ResultValue ResultName -> Maybe (ResultValue Double)
resultItemAsDoubleValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleListValue :: ResultValue ResultName -> Maybe (ResultValue [Double])
resultItemAsDoubleListValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleStatsValue :: ResultValue ResultName
-> Maybe (ResultValue (SamplingStats Double))
resultItemAsDoubleStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleTimingStatsValue :: ResultValue ResultName -> Maybe (ResultValue (TimingStats Double))
resultItemAsDoubleTimingStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing

  resultItemAsStringValue :: ResultValue ResultName -> Maybe (ResultValue ResultName)
resultItemAsStringValue = forall a. a -> Maybe a
Just

  resultItemExpansion :: ResultValue ResultName -> ResultSource
resultItemExpansion = ResultItem -> ResultSource
ResultItemSource forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ResultItemable a => a -> ResultItem
ResultItem
  resultItemSummary :: ResultValue ResultName -> ResultSource
resultItemSummary = ResultItem -> ResultSource
ResultItemSource forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ResultItemable a => a -> ResultItem
ResultItem

instance ResultItemable (ResultValue ()) where

  resultItemName :: ResultValue () -> ResultName
resultItemName = forall e. ResultValue e -> ResultName
resultValueName
  resultItemNamePath :: ResultValue () -> [ResultName]
resultItemNamePath = forall e. ResultValue e -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue () -> ResultId
resultItemId = forall e. ResultValue e -> ResultId
resultValueId
  resultItemIdPath :: ResultValue () -> [ResultId]
resultItemIdPath = forall e. ResultValue e -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue () -> ResultSignal
resultItemSignal = forall e. ResultValue e -> ResultSignal
resultValueSignal
  
  resultItemAsIntValue :: ResultValue () -> Maybe (ResultValue Int)
resultItemAsIntValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue () -> Maybe (ResultValue [Int])
resultItemAsIntListValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntStatsValue :: ResultValue () -> Maybe (ResultValue (SamplingStats Int))
resultItemAsIntStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntTimingStatsValue :: ResultValue () -> Maybe (ResultValue (TimingStats Int))
resultItemAsIntTimingStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing

  resultItemAsDoubleValue :: ResultValue () -> Maybe (ResultValue Double)
resultItemAsDoubleValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleListValue :: ResultValue () -> Maybe (ResultValue [Double])
resultItemAsDoubleListValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleStatsValue :: ResultValue () -> Maybe (ResultValue (SamplingStats Double))
resultItemAsDoubleStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleTimingStatsValue :: ResultValue () -> Maybe (ResultValue (TimingStats Double))
resultItemAsDoubleTimingStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing

  resultItemAsStringValue :: ResultValue () -> Maybe (ResultValue ResultName)
resultItemAsStringValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Show a => a -> ResultName
show

  resultItemExpansion :: ResultValue () -> ResultSource
resultItemExpansion = ResultItem -> ResultSource
ResultItemSource forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ResultItemable a => a -> ResultItem
ResultItem
  resultItemSummary :: ResultValue () -> ResultSource
resultItemSummary = ResultItem -> ResultSource
ResultItemSource forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ResultItemable a => a -> ResultItem
ResultItem

instance ResultItemable (ResultValue FCFS) where

  resultItemName :: ResultValue FCFS -> ResultName
resultItemName = forall e. ResultValue e -> ResultName
resultValueName
  resultItemNamePath :: ResultValue FCFS -> [ResultName]
resultItemNamePath = forall e. ResultValue e -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue FCFS -> ResultId
resultItemId = forall e. ResultValue e -> ResultId
resultValueId
  resultItemIdPath :: ResultValue FCFS -> [ResultId]
resultItemIdPath = forall e. ResultValue e -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue FCFS -> ResultSignal
resultItemSignal = forall e. ResultValue e -> ResultSignal
resultValueSignal
  
  resultItemAsIntValue :: ResultValue FCFS -> Maybe (ResultValue Int)
resultItemAsIntValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue FCFS -> Maybe (ResultValue [Int])
resultItemAsIntListValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntStatsValue :: ResultValue FCFS -> Maybe (ResultValue (SamplingStats Int))
resultItemAsIntStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntTimingStatsValue :: ResultValue FCFS -> Maybe (ResultValue (TimingStats Int))
resultItemAsIntTimingStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing

  resultItemAsDoubleValue :: ResultValue FCFS -> Maybe (ResultValue Double)
resultItemAsDoubleValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleListValue :: ResultValue FCFS -> Maybe (ResultValue [Double])
resultItemAsDoubleListValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleStatsValue :: ResultValue FCFS -> Maybe (ResultValue (SamplingStats Double))
resultItemAsDoubleStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleTimingStatsValue :: ResultValue FCFS -> Maybe (ResultValue (TimingStats Double))
resultItemAsDoubleTimingStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing

  resultItemAsStringValue :: ResultValue FCFS -> Maybe (ResultValue ResultName)
resultItemAsStringValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Show a => a -> ResultName
show

  resultItemExpansion :: ResultValue FCFS -> ResultSource
resultItemExpansion = ResultItem -> ResultSource
ResultItemSource forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ResultItemable a => a -> ResultItem
ResultItem
  resultItemSummary :: ResultValue FCFS -> ResultSource
resultItemSummary = ResultItem -> ResultSource
ResultItemSource forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ResultItemable a => a -> ResultItem
ResultItem

instance ResultItemable (ResultValue LCFS) where

  resultItemName :: ResultValue LCFS -> ResultName
resultItemName = forall e. ResultValue e -> ResultName
resultValueName
  resultItemNamePath :: ResultValue LCFS -> [ResultName]
resultItemNamePath = forall e. ResultValue e -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue LCFS -> ResultId
resultItemId = forall e. ResultValue e -> ResultId
resultValueId
  resultItemIdPath :: ResultValue LCFS -> [ResultId]
resultItemIdPath = forall e. ResultValue e -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue LCFS -> ResultSignal
resultItemSignal = forall e. ResultValue e -> ResultSignal
resultValueSignal
  
  resultItemAsIntValue :: ResultValue LCFS -> Maybe (ResultValue Int)
resultItemAsIntValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue LCFS -> Maybe (ResultValue [Int])
resultItemAsIntListValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntStatsValue :: ResultValue LCFS -> Maybe (ResultValue (SamplingStats Int))
resultItemAsIntStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntTimingStatsValue :: ResultValue LCFS -> Maybe (ResultValue (TimingStats Int))
resultItemAsIntTimingStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing

  resultItemAsDoubleValue :: ResultValue LCFS -> Maybe (ResultValue Double)
resultItemAsDoubleValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleListValue :: ResultValue LCFS -> Maybe (ResultValue [Double])
resultItemAsDoubleListValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleStatsValue :: ResultValue LCFS -> Maybe (ResultValue (SamplingStats Double))
resultItemAsDoubleStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleTimingStatsValue :: ResultValue LCFS -> Maybe (ResultValue (TimingStats Double))
resultItemAsDoubleTimingStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing

  resultItemAsStringValue :: ResultValue LCFS -> Maybe (ResultValue ResultName)
resultItemAsStringValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Show a => a -> ResultName
show

  resultItemExpansion :: ResultValue LCFS -> ResultSource
resultItemExpansion = ResultItem -> ResultSource
ResultItemSource forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ResultItemable a => a -> ResultItem
ResultItem
  resultItemSummary :: ResultValue LCFS -> ResultSource
resultItemSummary = ResultItem -> ResultSource
ResultItemSource forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ResultItemable a => a -> ResultItem
ResultItem

instance ResultItemable (ResultValue SIRO) where

  resultItemName :: ResultValue SIRO -> ResultName
resultItemName = forall e. ResultValue e -> ResultName
resultValueName
  resultItemNamePath :: ResultValue SIRO -> [ResultName]
resultItemNamePath = forall e. ResultValue e -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue SIRO -> ResultId
resultItemId = forall e. ResultValue e -> ResultId
resultValueId
  resultItemIdPath :: ResultValue SIRO -> [ResultId]
resultItemIdPath = forall e. ResultValue e -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue SIRO -> ResultSignal
resultItemSignal = forall e. ResultValue e -> ResultSignal
resultValueSignal
  
  resultItemAsIntValue :: ResultValue SIRO -> Maybe (ResultValue Int)
resultItemAsIntValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue SIRO -> Maybe (ResultValue [Int])
resultItemAsIntListValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntStatsValue :: ResultValue SIRO -> Maybe (ResultValue (SamplingStats Int))
resultItemAsIntStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntTimingStatsValue :: ResultValue SIRO -> Maybe (ResultValue (TimingStats Int))
resultItemAsIntTimingStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing

  resultItemAsDoubleValue :: ResultValue SIRO -> Maybe (ResultValue Double)
resultItemAsDoubleValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleListValue :: ResultValue SIRO -> Maybe (ResultValue [Double])
resultItemAsDoubleListValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleStatsValue :: ResultValue SIRO -> Maybe (ResultValue (SamplingStats Double))
resultItemAsDoubleStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleTimingStatsValue :: ResultValue SIRO -> Maybe (ResultValue (TimingStats Double))
resultItemAsDoubleTimingStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing

  resultItemAsStringValue :: ResultValue SIRO -> Maybe (ResultValue ResultName)
resultItemAsStringValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Show a => a -> ResultName
show

  resultItemExpansion :: ResultValue SIRO -> ResultSource
resultItemExpansion = ResultItem -> ResultSource
ResultItemSource forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ResultItemable a => a -> ResultItem
ResultItem
  resultItemSummary :: ResultValue SIRO -> ResultSource
resultItemSummary = ResultItem -> ResultSource
ResultItemSource forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ResultItemable a => a -> ResultItem
ResultItem

instance ResultItemable (ResultValue StaticPriorities) where

  resultItemName :: ResultValue StaticPriorities -> ResultName
resultItemName = forall e. ResultValue e -> ResultName
resultValueName
  resultItemNamePath :: ResultValue StaticPriorities -> [ResultName]
resultItemNamePath = forall e. ResultValue e -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue StaticPriorities -> ResultId
resultItemId = forall e. ResultValue e -> ResultId
resultValueId
  resultItemIdPath :: ResultValue StaticPriorities -> [ResultId]
resultItemIdPath = forall e. ResultValue e -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue StaticPriorities -> ResultSignal
resultItemSignal = forall e. ResultValue e -> ResultSignal
resultValueSignal
  
  resultItemAsIntValue :: ResultValue StaticPriorities -> Maybe (ResultValue Int)
resultItemAsIntValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue StaticPriorities -> Maybe (ResultValue [Int])
resultItemAsIntListValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntStatsValue :: ResultValue StaticPriorities
-> Maybe (ResultValue (SamplingStats Int))
resultItemAsIntStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsIntTimingStatsValue :: ResultValue StaticPriorities
-> Maybe (ResultValue (TimingStats Int))
resultItemAsIntTimingStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing

  resultItemAsDoubleValue :: ResultValue StaticPriorities -> Maybe (ResultValue Double)
resultItemAsDoubleValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleListValue :: ResultValue StaticPriorities -> Maybe (ResultValue [Double])
resultItemAsDoubleListValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleStatsValue :: ResultValue StaticPriorities
-> Maybe (ResultValue (SamplingStats Double))
resultItemAsDoubleStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
  resultItemAsDoubleTimingStatsValue :: ResultValue StaticPriorities
-> Maybe (ResultValue (TimingStats Double))
resultItemAsDoubleTimingStatsValue = forall a b. a -> b -> a
const forall a. Maybe a
Nothing

  resultItemAsStringValue :: ResultValue StaticPriorities -> Maybe (ResultValue ResultName)
resultItemAsStringValue = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Show a => a -> ResultName
show

  resultItemExpansion :: ResultValue StaticPriorities -> ResultSource
resultItemExpansion = ResultItem -> ResultSource
ResultItemSource forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ResultItemable a => a -> ResultItem
ResultItem
  resultItemSummary :: ResultValue StaticPriorities -> ResultSource
resultItemSummary = ResultItem -> ResultSource
ResultItemSource forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ResultItemable a => a -> ResultItem
ResultItem

-- | Flatten the result source.
flattenResultSource :: ResultSource -> [ResultItem]
flattenResultSource :: ResultSource -> [ResultItem]
flattenResultSource (ResultItemSource ResultItem
x) = [ResultItem
x]
flattenResultSource (ResultObjectSource ResultObject
x) =
  forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall a b. (a -> b) -> a -> b
$ forall a b. (a -> b) -> [a] -> [b]
map (ResultSource -> [ResultItem]
flattenResultSource forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultProperty -> ResultSource
resultPropertySource) forall a b. (a -> b) -> a -> b
$ ResultObject -> [ResultProperty]
resultObjectProperties ResultObject
x
flattenResultSource (ResultVectorSource ResultVector
x) =
  forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall a b. (a -> b) -> a -> b
$ forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> [ResultItem]
flattenResultSource forall a b. (a -> b) -> a -> b
$ forall i e. Array i e -> [e]
A.elems forall a b. (a -> b) -> a -> b
$ ResultVector -> Array Int ResultSource
resultVectorItems ResultVector
x
flattenResultSource (ResultSeparatorSource ResultSeparator
x) = []

-- | Return the result source name.
resultSourceName :: ResultSource -> ResultName
resultSourceName :: ResultSource -> ResultName
resultSourceName (ResultItemSource (ResultItem a
x)) = forall a. ResultItemable a => a -> ResultName
resultItemName a
x
resultSourceName (ResultObjectSource ResultObject
x) = ResultObject -> ResultName
resultObjectName ResultObject
x
resultSourceName (ResultVectorSource ResultVector
x) = ResultVector -> ResultName
resultVectorName ResultVector
x
resultSourceName (ResultSeparatorSource ResultSeparator
x) = []

-- | Expand the result source returning a more detailed version expanding the properties as possible.
expandResultSource :: ResultSource -> ResultSource
expandResultSource :: ResultSource -> ResultSource
expandResultSource (ResultItemSource (ResultItem a
x)) = forall a. ResultItemable a => a -> ResultSource
resultItemExpansion a
x
expandResultSource (ResultObjectSource ResultObject
x) =
  ResultObject -> ResultSource
ResultObjectSource forall a b. (a -> b) -> a -> b
$
  ResultObject
x { resultObjectProperties :: [ResultProperty]
resultObjectProperties =
         forall a b c. (a -> b -> c) -> b -> a -> c
flip forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (ResultObject -> [ResultProperty]
resultObjectProperties ResultObject
x) forall a b. (a -> b) -> a -> b
$ \ResultProperty
p ->
         ResultProperty
p { resultPropertySource :: ResultSource
resultPropertySource = ResultSource -> ResultSource
expandResultSource (ResultProperty -> ResultSource
resultPropertySource ResultProperty
p) } }
expandResultSource (ResultVectorSource ResultVector
x) =
  ResultVector -> ResultSource
ResultVectorSource forall a b. (a -> b) -> a -> b
$
  ResultVector
x { resultVectorItems :: Array Int ResultSource
resultVectorItems =
         forall i e. Ix i => (i, i) -> [(i, e)] -> Array i e
A.array (Int, Int)
bnds [(Int
i, ResultSource -> ResultSource
expandResultSource ResultSource
e) | (Int
i, ResultSource
e) <- [(Int, ResultSource)]
ies] }
    where arr :: Array Int ResultSource
arr  = ResultVector -> Array Int ResultSource
resultVectorItems ResultVector
x
          bnds :: (Int, Int)
bnds = forall i e. Array i e -> (i, i)
A.bounds Array Int ResultSource
arr
          ies :: [(Int, ResultSource)]
ies  = forall i e. Ix i => Array i e -> [(i, e)]
A.assocs Array Int ResultSource
arr
expandResultSource z :: ResultSource
z@(ResultSeparatorSource ResultSeparator
x) = ResultSource
z

-- | Return a summarised and usually more short version of the result source expanding the main properties or excluding auxiliary properties if required.
resultSourceSummary :: ResultSource -> ResultSource
resultSourceSummary :: ResultSource -> ResultSource
resultSourceSummary (ResultItemSource (ResultItem a
x)) = forall a. ResultItemable a => a -> ResultSource
resultItemSummary a
x
resultSourceSummary (ResultObjectSource ResultObject
x) = ResultObject -> ResultSource
resultObjectSummary ResultObject
x
resultSourceSummary (ResultVectorSource ResultVector
x) = ResultVector -> ResultSource
resultVectorSummary ResultVector
x
resultSourceSummary z :: ResultSource
z@(ResultSeparatorSource ResultSeparator
x) = ResultSource
z

-- | Return a signal emitted by the source.
resultSourceSignal :: ResultSource -> ResultSignal
resultSourceSignal :: ResultSource -> ResultSignal
resultSourceSignal (ResultItemSource (ResultItem a
x)) = forall a. ResultItemable a => a -> ResultSignal
resultItemSignal a
x
resultSourceSignal (ResultObjectSource ResultObject
x) = ResultObject -> ResultSignal
resultObjectSignal ResultObject
x
resultSourceSignal (ResultVectorSource ResultVector
x) = ResultVector -> ResultSignal
resultVectorSignal ResultVector
x
resultSourceSignal (ResultSeparatorSource ResultSeparator
x) = ResultSignal
EmptyResultSignal

-- | Represent the result source as integer numbers.
resultSourceToIntValues :: ResultSource -> [ResultValue Int]
resultSourceToIntValues :: ResultSource -> [ResultValue Int]
resultSourceToIntValues = forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a
x) -> forall a. ResultItemable a => a -> ResultValue Int
resultItemToIntValue a
x) forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultSource -> [ResultItem]
flattenResultSource

-- | Represent the result source as lists of integer numbers.
resultSourceToIntListValues :: ResultSource -> [ResultValue [Int]]
resultSourceToIntListValues :: ResultSource -> [ResultValue [Int]]
resultSourceToIntListValues = forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a
x) -> forall a. ResultItemable a => a -> ResultValue [Int]
resultItemToIntListValue a
x) forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultSource -> [ResultItem]
flattenResultSource

-- | Represent the result source as statistics based on integer numbers.
resultSourceToIntStatsValues :: ResultSource -> [ResultValue (SamplingStats Int)]
resultSourceToIntStatsValues :: ResultSource -> [ResultValue (SamplingStats Int)]
resultSourceToIntStatsValues = forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a
x) -> forall a. ResultItemable a => a -> ResultValue (SamplingStats Int)
resultItemToIntStatsValue a
x) forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultSource -> [ResultItem]
flattenResultSource

-- | Represent the result source as statistics based on integer numbers and optimised for fast aggregation.
resultSourceToIntStatsEitherValues :: ResultSource -> [ResultValue (Either Int (SamplingStats Int))]
resultSourceToIntStatsEitherValues :: ResultSource -> [ResultValue (Either Int (SamplingStats Int))]
resultSourceToIntStatsEitherValues = forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a
x) -> forall a.
ResultItemable a =>
a -> ResultValue (Either Int (SamplingStats Int))
resultItemToIntStatsEitherValue a
x) forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultSource -> [ResultItem]
flattenResultSource

-- | Represent the result source as timing statistics based on integer numbers.
resultSourceToIntTimingStatsValues :: ResultSource -> [ResultValue (TimingStats Int)]
resultSourceToIntTimingStatsValues :: ResultSource -> [ResultValue (TimingStats Int)]
resultSourceToIntTimingStatsValues = forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a
x) -> forall a. ResultItemable a => a -> ResultValue (TimingStats Int)
resultItemToIntTimingStatsValue a
x) forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultSource -> [ResultItem]
flattenResultSource

-- | Represent the result source as double floating point numbers.
resultSourceToDoubleValues :: ResultSource -> [ResultValue Double]
resultSourceToDoubleValues :: ResultSource -> [ResultValue Double]
resultSourceToDoubleValues = forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a
x) -> forall a. ResultItemable a => a -> ResultValue Double
resultItemToDoubleValue a
x) forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultSource -> [ResultItem]
flattenResultSource

-- | Represent the result source as lists of double floating point numbers.
resultSourceToDoubleListValues :: ResultSource -> [ResultValue [Double]]
resultSourceToDoubleListValues :: ResultSource -> [ResultValue [Double]]
resultSourceToDoubleListValues = forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a
x) -> forall a. ResultItemable a => a -> ResultValue [Double]
resultItemToDoubleListValue a
x) forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultSource -> [ResultItem]
flattenResultSource

-- | Represent the result source as statistics based on double floating point numbers.
resultSourceToDoubleStatsValues :: ResultSource -> [ResultValue (SamplingStats Double)]
resultSourceToDoubleStatsValues :: ResultSource -> [ResultValue (SamplingStats Double)]
resultSourceToDoubleStatsValues = forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a
x) -> forall a.
ResultItemable a =>
a -> ResultValue (SamplingStats Double)
resultItemToDoubleStatsValue a
x) forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultSource -> [ResultItem]
flattenResultSource

-- | Represent the result source as statistics based on double floating point numbers and optimised for fast aggregation.
resultSourceToDoubleStatsEitherValues :: ResultSource -> [ResultValue (Either Double (SamplingStats Double))]
resultSourceToDoubleStatsEitherValues :: ResultSource
-> [ResultValue (Either Double (SamplingStats Double))]
resultSourceToDoubleStatsEitherValues = forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a
x) -> forall a.
ResultItemable a =>
a -> ResultValue (Either Double (SamplingStats Double))
resultItemToDoubleStatsEitherValue a
x) forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultSource -> [ResultItem]
flattenResultSource

-- | Represent the result source as timing statistics based on double floating point numbers.
resultSourceToDoubleTimingStatsValues :: ResultSource -> [ResultValue (TimingStats Double)]
resultSourceToDoubleTimingStatsValues :: ResultSource -> [ResultValue (TimingStats Double)]
resultSourceToDoubleTimingStatsValues = forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a
x) -> forall a. ResultItemable a => a -> ResultValue (TimingStats Double)
resultItemToDoubleTimingStatsValue a
x) forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultSource -> [ResultItem]
flattenResultSource

-- | Represent the result source as string values.
resultSourceToStringValues :: ResultSource -> [ResultValue String]
resultSourceToStringValues :: ResultSource -> [ResultValue ResultName]
resultSourceToStringValues = forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a
x) -> forall a. ResultItemable a => a -> ResultValue ResultName
resultItemToStringValue a
x) forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultSource -> [ResultItem]
flattenResultSource

-- | It contains the results of simulation.
data Results =
  Results { Results -> ResultSourceMap
resultSourceMap :: ResultSourceMap,
            -- ^ The sources of simulation results as a map of associated names.
            Results -> [ResultSource]
resultSourceList :: [ResultSource]
            -- ^ The sources of simulation results as an ordered list.
          }

-- | It transforms the results of simulation.
type ResultTransform = Results -> Results

-- | It representes the predefined signals provided by every simulation model.
data ResultPredefinedSignals =
  ResultPredefinedSignals { ResultPredefinedSignals -> Signal Double
resultSignalInIntegTimes :: Signal Double,
                            -- ^ The signal triggered in the integration time points.
                            ResultPredefinedSignals -> Signal Double
resultSignalInStartTime :: Signal Double,
                            -- ^ The signal triggered in the start time.
                            ResultPredefinedSignals -> Signal Double
resultSignalInStopTime :: Signal Double
                            -- ^ The signal triggered in the stop time.
                          }

-- | Create the predefined signals provided by every simulation model.
newResultPredefinedSignals :: Simulation ResultPredefinedSignals
newResultPredefinedSignals :: Simulation ResultPredefinedSignals
newResultPredefinedSignals = forall a. Dynamics a -> Simulation a
runDynamicsInStartTime forall a b. (a -> b) -> a -> b
$ forall a. EventProcessing -> Event a -> Dynamics a
runEventWith EventProcessing
EarlierEvents Event ResultPredefinedSignals
d where
  d :: Event ResultPredefinedSignals
d = do Signal Double
signalInIntegTimes <- Event (Signal Double)
newSignalInIntegTimes
         Signal Double
signalInStartTime  <- Event (Signal Double)
newSignalInStartTime
         Signal Double
signalInStopTime   <- Event (Signal Double)
newSignalInStopTime
         forall (m :: * -> *) a. Monad m => a -> m a
return ResultPredefinedSignals { resultSignalInIntegTimes :: Signal Double
resultSignalInIntegTimes = Signal Double
signalInIntegTimes,
                                          resultSignalInStartTime :: Signal Double
resultSignalInStartTime  = Signal Double
signalInStartTime,
                                          resultSignalInStopTime :: Signal Double
resultSignalInStopTime   = Signal Double
signalInStopTime }
instance Semigroup Results where
  Results
x <> :: Results -> Results -> Results
<> Results
y = [ResultSource] -> Results
results forall a b. (a -> b) -> a -> b
$ Results -> [ResultSource]
resultSourceList Results
x forall a. Semigroup a => a -> a -> a
<> Results -> [ResultSource]
resultSourceList Results
y

instance Monoid Results where

  mempty :: Results
mempty  = [ResultSource] -> Results
results forall a. Monoid a => a
mempty
  mappend :: Results -> Results -> Results
mappend = forall a. Semigroup a => a -> a -> a
(<>)

-- | Prepare the simulation results.
results :: [ResultSource] -> Results
results :: [ResultSource] -> Results
results [ResultSource]
ms =
  Results { resultSourceMap :: ResultSourceMap
resultSourceMap  = forall k a. Ord k => [(k, a)] -> Map k a
M.fromList forall a b. (a -> b) -> a -> b
$ forall a b. (a -> b) -> [a] -> [b]
map (\ResultSource
x -> (ResultSource -> ResultName
resultSourceName ResultSource
x, ResultSource
x)) [ResultSource]
ms,
            resultSourceList :: [ResultSource]
resultSourceList = [ResultSource]
ms }

-- | Represent the results as integer numbers.
resultsToIntValues :: Results -> [ResultValue Int]
resultsToIntValues :: Results -> [ResultValue Int]
resultsToIntValues = forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> [ResultValue Int]
resultSourceToIntValues forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results -> [ResultSource]
resultSourceList

-- | Represent the results as lists of integer numbers.
resultsToIntListValues :: Results -> [ResultValue [Int]]
resultsToIntListValues :: Results -> [ResultValue [Int]]
resultsToIntListValues = forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> [ResultValue [Int]]
resultSourceToIntListValues forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results -> [ResultSource]
resultSourceList

-- | Represent the results as statistics based on integer numbers.
resultsToIntStatsValues :: Results -> [ResultValue (SamplingStats Int)]
resultsToIntStatsValues :: Results -> [ResultValue (SamplingStats Int)]
resultsToIntStatsValues = forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> [ResultValue (SamplingStats Int)]
resultSourceToIntStatsValues forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results -> [ResultSource]
resultSourceList

-- | Represent the results as statistics based on integer numbers and optimised for fast aggregation.
resultsToIntStatsEitherValues :: Results -> [ResultValue (Either Int (SamplingStats Int))]
resultsToIntStatsEitherValues :: Results -> [ResultValue (Either Int (SamplingStats Int))]
resultsToIntStatsEitherValues = forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> [ResultValue (Either Int (SamplingStats Int))]
resultSourceToIntStatsEitherValues forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results -> [ResultSource]
resultSourceList

-- | Represent the results as timing statistics based on integer numbers.
resultsToIntTimingStatsValues :: Results -> [ResultValue (TimingStats Int)]
resultsToIntTimingStatsValues :: Results -> [ResultValue (TimingStats Int)]
resultsToIntTimingStatsValues = forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> [ResultValue (TimingStats Int)]
resultSourceToIntTimingStatsValues forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results -> [ResultSource]
resultSourceList

-- | Represent the results as double floating point numbers.
resultsToDoubleValues :: Results -> [ResultValue Double]
resultsToDoubleValues :: Results -> [ResultValue Double]
resultsToDoubleValues = forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> [ResultValue Double]
resultSourceToDoubleValues forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results -> [ResultSource]
resultSourceList

-- | Represent the results as lists of double floating point numbers.
resultsToDoubleListValues :: Results -> [ResultValue [Double]]
resultsToDoubleListValues :: Results -> [ResultValue [Double]]
resultsToDoubleListValues = forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> [ResultValue [Double]]
resultSourceToDoubleListValues forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results -> [ResultSource]
resultSourceList

-- | Represent the results as statistics based on double floating point numbers.
resultsToDoubleStatsValues :: Results -> [ResultValue (SamplingStats Double)]
resultsToDoubleStatsValues :: Results -> [ResultValue (SamplingStats Double)]
resultsToDoubleStatsValues = forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> [ResultValue (SamplingStats Double)]
resultSourceToDoubleStatsValues forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results -> [ResultSource]
resultSourceList

-- | Represent the results as statistics based on double floating point numbers and optimised for fast aggregation.
resultsToDoubleStatsEitherValues :: Results -> [ResultValue (Either Double (SamplingStats Double))]
resultsToDoubleStatsEitherValues :: Results -> [ResultValue (Either Double (SamplingStats Double))]
resultsToDoubleStatsEitherValues = forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map ResultSource
-> [ResultValue (Either Double (SamplingStats Double))]
resultSourceToDoubleStatsEitherValues forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results -> [ResultSource]
resultSourceList

-- | Represent the results as timing statistics based on double floating point numbers.
resultsToDoubleTimingStatsValues :: Results -> [ResultValue (TimingStats Double)]
resultsToDoubleTimingStatsValues :: Results -> [ResultValue (TimingStats Double)]
resultsToDoubleTimingStatsValues = forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> [ResultValue (TimingStats Double)]
resultSourceToDoubleTimingStatsValues forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results -> [ResultSource]
resultSourceList

-- | Represent the results as string values.
resultsToStringValues :: Results -> [ResultValue String]
resultsToStringValues :: Results -> [ResultValue ResultName]
resultsToStringValues = forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> [ResultValue ResultName]
resultSourceToStringValues forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results -> [ResultSource]
resultSourceList

-- | Return a signal emitted by the specified results.
resultSignal :: Results -> ResultSignal
resultSignal :: Results -> ResultSignal
resultSignal = forall a. Monoid a => [a] -> a
mconcat forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> ResultSignal
resultSourceSignal forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results -> [ResultSource]
resultSourceList

-- | Return an expanded version of the simulation results expanding the properties as possible, which
-- takes place for expanding statistics to show the count, average, deviation, minimum, maximum etc.
-- as separate values.
expandResults :: ResultTransform
expandResults :: Results -> Results
expandResults = [ResultSource] -> Results
results forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> ResultSource
expandResultSource forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results -> [ResultSource]
resultSourceList

-- | Return a short version of the simulation results, i.e. their summary, expanding the main properties
-- or excluding auxiliary properties if required.
resultSummary :: ResultTransform
resultSummary :: Results -> Results
resultSummary = [ResultSource] -> Results
results forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> ResultSource
resultSourceSummary forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results -> [ResultSource]
resultSourceList

-- | Take a result by its name.
resultByName :: ResultName -> ResultTransform
resultByName :: ResultName -> Results -> Results
resultByName ResultName
name Results
rs =
  case forall k a. Ord k => k -> Map k a -> Maybe a
M.lookup ResultName
name (Results -> ResultSourceMap
resultSourceMap Results
rs) of
    Just ResultSource
x -> [ResultSource] -> Results
results [ResultSource
x]
    Maybe ResultSource
Nothing ->
      forall a. HasCallStack => ResultName -> a
error forall a b. (a -> b) -> a -> b
$
      ResultName
"Not found result source with name " forall a. [a] -> [a] -> [a]
++ ResultName
name forall a. [a] -> [a] -> [a]
++
      ResultName
": resultByName"

-- | Take a result from the object with the specified property label,
-- but it is more preferrable to refer to the property by its 'ResultId'
-- identifier with help of the 'resultById' function.
resultByProperty :: ResultName -> ResultTransform
resultByProperty :: ResultName -> Results -> Results
resultByProperty ResultName
label Results
rs = forall a b c. (a -> b -> c) -> b -> a -> c
flip (ResultSource -> [ResultSource]) -> Results -> Results
composeResults Results
rs ResultSource -> [ResultSource]
loop
  where
    loop :: ResultSource -> [ResultSource]
loop ResultSource
x =
      case ResultSource
x of
        ResultObjectSource ResultObject
s ->
          let ps :: [ResultProperty]
ps =
                forall a b c. (a -> b -> c) -> b -> a -> c
flip forall a. (a -> Bool) -> [a] -> [a]
filter (ResultObject -> [ResultProperty]
resultObjectProperties ResultObject
s) forall a b. (a -> b) -> a -> b
$ \ResultProperty
p ->
                ResultProperty -> ResultName
resultPropertyLabel ResultProperty
p forall a. Eq a => a -> a -> Bool
== ResultName
label
          in case [ResultProperty]
ps of
            [] ->
              forall a. HasCallStack => ResultName -> a
error forall a b. (a -> b) -> a -> b
$
              ResultName
"Not found property " forall a. [a] -> [a] -> [a]
++ ResultName
label forall a. [a] -> [a] -> [a]
++
              ResultName
" for object " forall a. [a] -> [a] -> [a]
++ ResultObject -> ResultName
resultObjectName ResultObject
s forall a. [a] -> [a] -> [a]
++
              ResultName
": resultByProperty"
            [ResultProperty]
ps ->
              forall a b. (a -> b) -> [a] -> [b]
map ResultProperty -> ResultSource
resultPropertySource [ResultProperty]
ps
        ResultVectorSource ResultVector
s ->
          forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall a b. (a -> b) -> a -> b
$ forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> [ResultSource]
loop forall a b. (a -> b) -> a -> b
$ forall i e. Array i e -> [e]
A.elems forall a b. (a -> b) -> a -> b
$ ResultVector -> Array Int ResultSource
resultVectorItems ResultVector
s
        ResultSource
x ->
          forall a. HasCallStack => ResultName -> a
error forall a b. (a -> b) -> a -> b
$
          ResultName
"Result source " forall a. [a] -> [a] -> [a]
++ ResultSource -> ResultName
resultSourceName ResultSource
x forall a. [a] -> [a] -> [a]
++
          ResultName
" is neither object, nor vector " forall a. [a] -> [a] -> [a]
++
          ResultName
": resultByProperty"

-- | Take a result from the object with the specified identifier. It can identify
-- an item, object property, the object iself, vector or its elements.
resultById :: ResultId -> ResultTransform
resultById :: ResultId -> Results -> Results
resultById ResultId
i Results
rs = forall a b c. (a -> b -> c) -> b -> a -> c
flip (ResultSource -> [ResultSource]) -> Results -> Results
composeResults Results
rs ResultSource -> [ResultSource]
loop
  where
    loop :: ResultSource -> [ResultSource]
loop ResultSource
x =
      case ResultSource
x of
        ResultItemSource (ResultItem a
s) ->
          if forall a. ResultItemable a => a -> ResultId
resultItemId a
s forall a. Eq a => a -> a -> Bool
== ResultId
i
          then [ResultSource
x]
          else forall a. HasCallStack => ResultName -> a
error forall a b. (a -> b) -> a -> b
$
               ResultName
"Expected to find item with Id = " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> ResultName
show ResultId
i forall a. [a] -> [a] -> [a]
++
               ResultName
", while the item " forall a. [a] -> [a] -> [a]
++ forall a. ResultItemable a => a -> ResultName
resultItemName a
s forall a. [a] -> [a] -> [a]
++
               ResultName
" has actual Id = " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> ResultName
show (forall a. ResultItemable a => a -> ResultId
resultItemId a
s) forall a. [a] -> [a] -> [a]
++
               ResultName
": resultById"
        ResultObjectSource ResultObject
s ->
          if ResultObject -> ResultId
resultObjectId ResultObject
s forall a. Eq a => a -> a -> Bool
== ResultId
i
          then [ResultSource
x]
          else let ps :: [ResultProperty]
ps =
                     forall a b c. (a -> b -> c) -> b -> a -> c
flip forall a. (a -> Bool) -> [a] -> [a]
filter (ResultObject -> [ResultProperty]
resultObjectProperties ResultObject
s) forall a b. (a -> b) -> a -> b
$ \ResultProperty
p ->
                     ResultProperty -> ResultId
resultPropertyId ResultProperty
p forall a. Eq a => a -> a -> Bool
== ResultId
i
               in case [ResultProperty]
ps of
                 [] ->
                   forall a. HasCallStack => ResultName -> a
error forall a b. (a -> b) -> a -> b
$
                   ResultName
"Not found property with Id = " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> ResultName
show ResultId
i forall a. [a] -> [a] -> [a]
++
                   ResultName
" for object " forall a. [a] -> [a] -> [a]
++ ResultObject -> ResultName
resultObjectName ResultObject
s forall a. [a] -> [a] -> [a]
++
                   ResultName
" that has actual Id = " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> ResultName
show (ResultObject -> ResultId
resultObjectId ResultObject
s) forall a. [a] -> [a] -> [a]
++
                   ResultName
": resultById"
                 [ResultProperty]
ps ->
                   forall a b. (a -> b) -> [a] -> [b]
map ResultProperty -> ResultSource
resultPropertySource [ResultProperty]
ps
        ResultVectorSource ResultVector
s ->
          if ResultVector -> ResultId
resultVectorId ResultVector
s forall a. Eq a => a -> a -> Bool
== ResultId
i
          then [ResultSource
x]
          else forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall a b. (a -> b) -> a -> b
$ forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> [ResultSource]
loop forall a b. (a -> b) -> a -> b
$ forall i e. Array i e -> [e]
A.elems forall a b. (a -> b) -> a -> b
$ ResultVector -> Array Int ResultSource
resultVectorItems ResultVector
s
        ResultSource
x ->
          forall a. HasCallStack => ResultName -> a
error forall a b. (a -> b) -> a -> b
$
          ResultName
"Result source " forall a. [a] -> [a] -> [a]
++ ResultSource -> ResultName
resultSourceName ResultSource
x forall a. [a] -> [a] -> [a]
++
          ResultName
" is neither item, nor object, nor vector " forall a. [a] -> [a] -> [a]
++
          ResultName
": resultById"

-- | Take a result from the vector by the specified integer index.
resultByIndex :: Int -> ResultTransform
resultByIndex :: Int -> Results -> Results
resultByIndex Int
index Results
rs = forall a b c. (a -> b -> c) -> b -> a -> c
flip (ResultSource -> [ResultSource]) -> Results -> Results
composeResults Results
rs ResultSource -> [ResultSource]
loop
  where
    loop :: ResultSource -> [ResultSource]
loop ResultSource
x =
      case ResultSource
x of
        ResultVectorSource ResultVector
s ->
          [ResultVector -> Array Int ResultSource
resultVectorItems ResultVector
s forall i e. Ix i => Array i e -> i -> e
A.! Int
index] 
        ResultSource
x ->
          forall a. HasCallStack => ResultName -> a
error forall a b. (a -> b) -> a -> b
$
          ResultName
"Result source " forall a. [a] -> [a] -> [a]
++ ResultSource -> ResultName
resultSourceName ResultSource
x forall a. [a] -> [a] -> [a]
++
          ResultName
" is not vector " forall a. [a] -> [a] -> [a]
++
          ResultName
": resultByIndex"

-- | Take a result from the vector by the specified string subscript.
resultBySubscript :: ResultName -> ResultTransform
resultBySubscript :: ResultName -> Results -> Results
resultBySubscript ResultName
subscript Results
rs = forall a b c. (a -> b -> c) -> b -> a -> c
flip (ResultSource -> [ResultSource]) -> Results -> Results
composeResults Results
rs ResultSource -> [ResultSource]
loop
  where
    loop :: ResultSource -> [ResultSource]
loop ResultSource
x =
      case ResultSource
x of
        ResultVectorSource ResultVector
s ->
          let ys :: [ResultSource]
ys = forall i e. Array i e -> [e]
A.elems forall a b. (a -> b) -> a -> b
$ ResultVector -> Array Int ResultSource
resultVectorItems ResultVector
s
              zs :: [ResultName]
zs = forall i e. Array i e -> [e]
A.elems forall a b. (a -> b) -> a -> b
$ ResultVector -> Array Int ResultName
resultVectorSubscript ResultVector
s
              ps :: [(ResultSource, ResultName)]
ps =
                forall a b c. (a -> b -> c) -> b -> a -> c
flip forall a. (a -> Bool) -> [a] -> [a]
filter (forall a b. [a] -> [b] -> [(a, b)]
zip [ResultSource]
ys [ResultName]
zs) forall a b. (a -> b) -> a -> b
$ \(ResultSource
y, ResultName
z) ->
                ResultName
z forall a. Eq a => a -> a -> Bool
== ResultName
subscript
          in case [(ResultSource, ResultName)]
ps of
            [] ->
              forall a. HasCallStack => ResultName -> a
error forall a b. (a -> b) -> a -> b
$
              ResultName
"Not found subscript " forall a. [a] -> [a] -> [a]
++ ResultName
subscript forall a. [a] -> [a] -> [a]
++
              ResultName
" for vector " forall a. [a] -> [a] -> [a]
++ ResultVector -> ResultName
resultVectorName ResultVector
s forall a. [a] -> [a] -> [a]
++
              ResultName
": resultBySubscript"
            [(ResultSource, ResultName)]
ps ->
              forall a b. (a -> b) -> [a] -> [b]
map forall a b. (a, b) -> a
fst [(ResultSource, ResultName)]
ps
        ResultSource
x ->
          forall a. HasCallStack => ResultName -> a
error forall a b. (a -> b) -> a -> b
$
          ResultName
"Result source " forall a. [a] -> [a] -> [a]
++ ResultSource -> ResultName
resultSourceName ResultSource
x forall a. [a] -> [a] -> [a]
++
          ResultName
" is not vector " forall a. [a] -> [a] -> [a]
++
          ResultName
": resultBySubscript"

-- | Compose the results using the specified transformation function.
composeResults :: (ResultSource -> [ResultSource]) -> ResultTransform
composeResults :: (ResultSource -> [ResultSource]) -> Results -> Results
composeResults ResultSource -> [ResultSource]
f =
  [ResultSource] -> Results
results forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> [ResultSource]
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. Results -> [ResultSource]
resultSourceList

-- | Concatenate the results using the specified list of transformation functions.
concatResults :: [ResultTransform] -> ResultTransform
concatResults :: [Results -> Results] -> Results -> Results
concatResults [Results -> Results]
trs Results
rs =
  [ResultSource] -> Results
results forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall a b. (a -> b) -> a -> b
$ forall a b. (a -> b) -> [a] -> [b]
map (\Results -> Results
tr -> Results -> [ResultSource]
resultSourceList forall a b. (a -> b) -> a -> b
$ Results -> Results
tr Results
rs) [Results -> Results]
trs

-- | Append the results using the specified transformation functions.
appendResults :: ResultTransform -> ResultTransform -> ResultTransform
appendResults :: (Results -> Results) -> (Results -> Results) -> Results -> Results
appendResults Results -> Results
x Results -> Results
y =
  [Results -> Results] -> Results -> Results
concatResults [Results -> Results
x, Results -> Results
y]

-- | Return a pure signal as a result of combination of the predefined signals
-- with the specified result signal usually provided by the sources.
--
-- The signal returned is triggered when the source signal is triggered.
-- The pure signal is also triggered in the integration time points
-- if the source signal is unknown or it was combined with any unknown signal.
pureResultSignal :: ResultPredefinedSignals -> ResultSignal -> Signal ()
pureResultSignal :: ResultPredefinedSignals -> ResultSignal -> Signal ()
pureResultSignal ResultPredefinedSignals
rs ResultSignal
EmptyResultSignal =
  forall (f :: * -> *) a. Functor f => f a -> f ()
void (ResultPredefinedSignals -> Signal Double
resultSignalInStartTime ResultPredefinedSignals
rs)
pureResultSignal ResultPredefinedSignals
rs ResultSignal
UnknownResultSignal =
  forall (f :: * -> *) a. Functor f => f a -> f ()
void (ResultPredefinedSignals -> Signal Double
resultSignalInIntegTimes ResultPredefinedSignals
rs)
pureResultSignal ResultPredefinedSignals
rs (ResultSignal Signal ()
s) =
  forall (f :: * -> *) a. Functor f => f a -> f ()
void (ResultPredefinedSignals -> Signal Double
resultSignalInStartTime ResultPredefinedSignals
rs) forall a. Semigroup a => a -> a -> a
<> forall (f :: * -> *) a. Functor f => f a -> f ()
void (ResultPredefinedSignals -> Signal Double
resultSignalInStopTime ResultPredefinedSignals
rs) forall a. Semigroup a => a -> a -> a
<> Signal ()
s
pureResultSignal ResultPredefinedSignals
rs (ResultSignalMix Signal ()
s) =
  forall (f :: * -> *) a. Functor f => f a -> f ()
void (ResultPredefinedSignals -> Signal Double
resultSignalInIntegTimes ResultPredefinedSignals
rs) forall a. Semigroup a => a -> a -> a
<> Signal ()
s

-- | Represents a computation that can return the simulation data.
class ResultComputing m where

  -- | Compute data with the results of simulation.
  computeResultData :: m a -> ResultData a

  -- | Return the signal triggered when data change if such a signal exists.
  computeResultSignal :: m a -> ResultSignal

-- | Return a new result value by the specified name, identifier and computation.
computeResultValue :: ResultComputing m
                      => ResultName
                      -- ^ the result name
                      -> [ResultName]
                      -- ^ the result name path
                      -> ResultId
                      -- ^ the result identifier
                      -> [ResultId]
                      -- ^ the result identifier path
                      -> m a
                      -- ^ the result computation
                      -> ResultValue a
computeResultValue :: forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is m a
m =
  ResultValue {
    resultValueName :: ResultName
resultValueName   = ResultName
name,
    resultValueNamePath :: [ResultName]
resultValueNamePath = [ResultName]
names,
    resultValueId :: ResultId
resultValueId     = ResultId
i,
    resultValueIdPath :: [ResultId]
resultValueIdPath = [ResultId]
is,
    resultValueData :: ResultData a
resultValueData   = forall (m :: * -> *) a. ResultComputing m => m a -> ResultData a
computeResultData m a
m,
    resultValueSignal :: ResultSignal
resultValueSignal = forall (m :: * -> *) a. ResultComputing m => m a -> ResultSignal
computeResultSignal m a
m }

-- | Represents a computation that can return the simulation data.
data ResultComputation a =
  ResultComputation { forall a. ResultComputation a -> ResultData a
resultComputationData :: ResultData a,
                      -- ^ Return data from the computation.
                      forall a. ResultComputation a -> ResultSignal
resultComputationSignal :: ResultSignal
                      -- ^ Return a signal from the computation.
                    }

instance ResultComputing ResultComputation where

  computeResultData :: forall a. ResultComputation a -> ResultData a
computeResultData = forall a. ResultComputation a -> ResultData a
resultComputationData
  computeResultSignal :: forall a. ResultComputation a -> ResultSignal
computeResultSignal = forall a. ResultComputation a -> ResultSignal
resultComputationSignal

instance ResultComputing Parameter where

  computeResultData :: forall a. Parameter a -> ResultData a
computeResultData = forall (m :: * -> *) a. ParameterLift m => Parameter a -> m a
liftParameter
  computeResultSignal :: forall a. Parameter a -> ResultSignal
computeResultSignal = forall a b. a -> b -> a
const ResultSignal
UnknownResultSignal

instance ResultComputing Simulation where

  computeResultData :: forall a. Simulation a -> ResultData a
computeResultData = forall (m :: * -> *) a. SimulationLift m => Simulation a -> m a
liftSimulation
  computeResultSignal :: forall a. Simulation a -> ResultSignal
computeResultSignal = forall a b. a -> b -> a
const ResultSignal
UnknownResultSignal

instance ResultComputing Dynamics where

  computeResultData :: forall a. Dynamics a -> ResultData a
computeResultData = forall (m :: * -> *) a. DynamicsLift m => Dynamics a -> m a
liftDynamics
  computeResultSignal :: forall a. Dynamics a -> ResultSignal
computeResultSignal = forall a b. a -> b -> a
const ResultSignal
UnknownResultSignal

instance ResultComputing Event where

  computeResultData :: forall a. ResultData a -> ResultData a
computeResultData = forall a. a -> a
id
  computeResultSignal :: forall a. Event a -> ResultSignal
computeResultSignal = forall a b. a -> b -> a
const ResultSignal
UnknownResultSignal

instance ResultComputing Ref where

  computeResultData :: forall a. Ref a -> ResultData a
computeResultData = forall a. Ref a -> ResultData a
readRef
  computeResultSignal :: forall a. Ref a -> ResultSignal
computeResultSignal = Signal () -> ResultSignal
ResultSignal forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Ref a -> Signal ()
refChanged_

instance ResultComputing BR.Ref where

  computeResultData :: forall a. Ref a -> ResultData a
computeResultData = forall a. Ref a -> ResultData a
BR.readRef
  computeResultSignal :: forall a. Ref a -> ResultSignal
computeResultSignal = forall a b. a -> b -> a
const ResultSignal
UnknownResultSignal

instance ResultComputing Var where

  computeResultData :: forall a. Var a -> ResultData a
computeResultData = forall a. Var a -> ResultData a
readVar
  computeResultSignal :: forall a. Var a -> ResultSignal
computeResultSignal = Signal () -> ResultSignal
ResultSignal forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Var a -> Signal ()
varChanged_

instance ResultComputing Signalable where

  computeResultData :: forall a. Signalable a -> ResultData a
computeResultData = forall a. Signalable a -> ResultData a
readSignalable
  computeResultSignal :: forall a. Signalable a -> ResultSignal
computeResultSignal = Signal () -> ResultSignal
ResultSignal forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Signalable a -> Signal ()
signalableChanged_
      
-- | Return a source by the specified statistics.
samplingStatsResultSource :: (ResultItemable (ResultValue a),
                              ResultItemable (ResultValue (SamplingStats a)))
                             => ResultValue (SamplingStats a)
                             -- ^ the statistics
                             -> ResultSource
samplingStatsResultSource :: forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (SamplingStats a))) =>
ResultValue (SamplingStats a) -> ResultSource
samplingStatsResultSource ResultValue (SamplingStats a)
x =
  ResultObject -> ResultSource
ResultObjectSource forall a b. (a -> b) -> a -> b
$
  ResultObject {
    resultObjectName :: ResultName
resultObjectName      = forall e. ResultValue e -> ResultName
resultValueName ResultValue (SamplingStats a)
x,
    resultObjectId :: ResultId
resultObjectId        = forall e. ResultValue e -> ResultId
resultValueId ResultValue (SamplingStats a)
x,
    resultObjectTypeId :: ResultId
resultObjectTypeId    = ResultId
SamplingStatsId,
    resultObjectSignal :: ResultSignal
resultObjectSignal    = forall e. ResultValue e -> ResultSignal
resultValueSignal ResultValue (SamplingStats a)
x,
    resultObjectSummary :: ResultSource
resultObjectSummary   = forall a.
ResultItemable (ResultValue (SamplingStats a)) =>
ResultValue (SamplingStats a) -> ResultSource
samplingStatsResultSummary ResultValue (SamplingStats a)
x,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (SamplingStats a))
c ResultName
"count" ResultId
SamplingStatsCountId forall a. SamplingStats a -> Int
samplingStatsCount,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (SamplingStats a))
c ResultName
"mean" ResultId
SamplingStatsMeanId forall a. SamplingStats a -> Double
samplingStatsMean,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (SamplingStats a))
c ResultName
"mean2" ResultId
SamplingStatsMean2Id forall a. SamplingStats a -> Double
samplingStatsMean2,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (SamplingStats a))
c ResultName
"std" ResultId
SamplingStatsDeviationId forall a. SamplingStats a -> Double
samplingStatsDeviation,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (SamplingStats a))
c ResultName
"var" ResultId
SamplingStatsVarianceId forall a. SamplingStats a -> Double
samplingStatsVariance,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (SamplingStats a))
c ResultName
"min" ResultId
SamplingStatsMinId forall a. SamplingStats a -> a
samplingStatsMin,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (SamplingStats a))
c ResultName
"max" ResultId
SamplingStatsMaxId forall a. SamplingStats a -> a
samplingStatsMax ] }
  where
    c :: ResultContainer (ResultData (SamplingStats a))
c = forall a. ResultValue a -> ResultContainer (ResultData a)
resultValueToContainer ResultValue (SamplingStats a)
x

-- | Return the summary by the specified statistics.
samplingStatsResultSummary :: ResultItemable (ResultValue (SamplingStats a))
                              => ResultValue (SamplingStats a)
                              -- ^ the statistics
                           -> ResultSource
samplingStatsResultSummary :: forall a.
ResultItemable (ResultValue (SamplingStats a)) =>
ResultValue (SamplingStats a) -> ResultSource
samplingStatsResultSummary = ResultItem -> ResultSource
ResultItemSource forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ResultItemable a => a -> ResultItem
ResultItem forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ResultItemable a => a -> ResultValue ResultName
resultItemToStringValue 
  
-- | Return a source by the specified timing statistics.
timingStatsResultSource :: (TimingData a,
                            ResultItemable (ResultValue a),
                            ResultItemable (ResultValue (TimingStats a)))
                           => ResultValue (TimingStats a)
                           -- ^ the statistics
                           -> ResultSource
timingStatsResultSource :: forall a.
(TimingData a, ResultItemable (ResultValue a),
 ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingStats a) -> ResultSource
timingStatsResultSource ResultValue (TimingStats a)
x =
  ResultObject -> ResultSource
ResultObjectSource forall a b. (a -> b) -> a -> b
$
  ResultObject {
    resultObjectName :: ResultName
resultObjectName      = forall e. ResultValue e -> ResultName
resultValueName ResultValue (TimingStats a)
x,
    resultObjectId :: ResultId
resultObjectId        = forall e. ResultValue e -> ResultId
resultValueId ResultValue (TimingStats a)
x,
    resultObjectTypeId :: ResultId
resultObjectTypeId    = ResultId
TimingStatsId,
    resultObjectSignal :: ResultSignal
resultObjectSignal    = forall e. ResultValue e -> ResultSignal
resultValueSignal ResultValue (TimingStats a)
x,
    resultObjectSummary :: ResultSource
resultObjectSummary   = forall a.
(TimingData a, ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingStats a) -> ResultSource
timingStatsResultSummary ResultValue (TimingStats a)
x,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingStats a))
c ResultName
"count" ResultId
TimingStatsCountId forall a. TimingStats a -> Int
timingStatsCount,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingStats a))
c ResultName
"mean" ResultId
TimingStatsMeanId forall a. TimingData a => TimingStats a -> Double
timingStatsMean,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingStats a))
c ResultName
"std" ResultId
TimingStatsDeviationId forall a. TimingData a => TimingStats a -> Double
timingStatsDeviation,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingStats a))
c ResultName
"var" ResultId
TimingStatsVarianceId forall a. TimingData a => TimingStats a -> Double
timingStatsVariance,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingStats a))
c ResultName
"min" ResultId
TimingStatsMinId forall a. TimingStats a -> a
timingStatsMin,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingStats a))
c ResultName
"max" ResultId
TimingStatsMaxId forall a. TimingStats a -> a
timingStatsMax,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingStats a))
c ResultName
"minTime" ResultId
TimingStatsMinTimeId forall a. TimingStats a -> Double
timingStatsMinTime,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingStats a))
c ResultName
"maxTime" ResultId
TimingStatsMaxTimeId forall a. TimingStats a -> Double
timingStatsMaxTime,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingStats a))
c ResultName
"startTime" ResultId
TimingStatsStartTimeId forall a. TimingStats a -> Double
timingStatsStartTime,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingStats a))
c ResultName
"lastTime" ResultId
TimingStatsLastTimeId forall a. TimingStats a -> Double
timingStatsLastTime,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingStats a))
c ResultName
"sum" ResultId
TimingStatsSumId forall a. TimingStats a -> Double
timingStatsSum,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingStats a))
c ResultName
"sum2" ResultId
TimingStatsSum2Id forall a. TimingStats a -> Double
timingStatsSum2 ] }
  where
    c :: ResultContainer (ResultData (TimingStats a))
c = forall a. ResultValue a -> ResultContainer (ResultData a)
resultValueToContainer ResultValue (TimingStats a)
x

-- | Return the summary by the specified timing statistics.
timingStatsResultSummary :: (TimingData a, ResultItemable (ResultValue (TimingStats a)))
                            => ResultValue (TimingStats a) 
                            -- ^ the statistics
                            -> ResultSource
timingStatsResultSummary :: forall a.
(TimingData a, ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingStats a) -> ResultSource
timingStatsResultSummary = ResultItem -> ResultSource
ResultItemSource forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ResultItemable a => a -> ResultItem
ResultItem forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ResultItemable a => a -> ResultValue ResultName
resultItemToStringValue
      
-- | Return a source by the specified counter.
samplingCounterResultSource :: (ResultItemable (ResultValue a),
                                ResultItemable (ResultValue (SamplingStats a)))
                               => ResultValue (SamplingCounter a)
                               -- ^ the counter
                               -> ResultSource
samplingCounterResultSource :: forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (SamplingStats a))) =>
ResultValue (SamplingCounter a) -> ResultSource
samplingCounterResultSource ResultValue (SamplingCounter a)
x =
  ResultObject -> ResultSource
ResultObjectSource forall a b. (a -> b) -> a -> b
$
  ResultObject {
    resultObjectName :: ResultName
resultObjectName      = forall e. ResultValue e -> ResultName
resultValueName ResultValue (SamplingCounter a)
x,
    resultObjectId :: ResultId
resultObjectId        = forall e. ResultValue e -> ResultId
resultValueId ResultValue (SamplingCounter a)
x,
    resultObjectTypeId :: ResultId
resultObjectTypeId    = ResultId
SamplingCounterId,
    resultObjectSignal :: ResultSignal
resultObjectSignal    = forall e. ResultValue e -> ResultSignal
resultValueSignal ResultValue (SamplingCounter a)
x,
    resultObjectSummary :: ResultSource
resultObjectSummary   = forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (SamplingStats a))) =>
ResultValue (SamplingCounter a) -> ResultSource
samplingCounterResultSummary ResultValue (SamplingCounter a)
x,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (SamplingCounter a))
c ResultName
"value" ResultId
SamplingCounterValueId forall a. SamplingCounter a -> a
samplingCounterValue,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (SamplingCounter a))
c ResultName
"stats" ResultId
SamplingCounterStatsId forall a. SamplingCounter a -> SamplingStats a
samplingCounterStats ] }
  where
    c :: ResultContainer (ResultData (SamplingCounter a))
c = forall a. ResultValue a -> ResultContainer (ResultData a)
resultValueToContainer ResultValue (SamplingCounter a)
x
      
-- | Return a source by the specified counter.
samplingCounterResultSummary :: (ResultItemable (ResultValue a),
                                 ResultItemable (ResultValue (SamplingStats a)))
                                => ResultValue (SamplingCounter a)
                                -- ^ the counter
                                -> ResultSource
samplingCounterResultSummary :: forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (SamplingStats a))) =>
ResultValue (SamplingCounter a) -> ResultSource
samplingCounterResultSummary ResultValue (SamplingCounter a)
x =
  ResultObject -> ResultSource
ResultObjectSource forall a b. (a -> b) -> a -> b
$
  ResultObject {
    resultObjectName :: ResultName
resultObjectName      = forall e. ResultValue e -> ResultName
resultValueName ResultValue (SamplingCounter a)
x,
    resultObjectId :: ResultId
resultObjectId        = forall e. ResultValue e -> ResultId
resultValueId ResultValue (SamplingCounter a)
x,
    resultObjectTypeId :: ResultId
resultObjectTypeId    = ResultId
SamplingCounterId,
    resultObjectSignal :: ResultSignal
resultObjectSignal    = forall e. ResultValue e -> ResultSignal
resultValueSignal ResultValue (SamplingCounter a)
x,
    resultObjectSummary :: ResultSource
resultObjectSummary   = forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (SamplingStats a))) =>
ResultValue (SamplingCounter a) -> ResultSource
samplingCounterResultSummary ResultValue (SamplingCounter a)
x,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (SamplingCounter a))
c ResultName
"value" ResultId
SamplingCounterValueId forall a. SamplingCounter a -> a
samplingCounterValue,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (SamplingCounter a))
c ResultName
"stats" ResultId
SamplingCounterStatsId forall a. SamplingCounter a -> SamplingStats a
samplingCounterStats ] }
  where
    c :: ResultContainer (ResultData (SamplingCounter a))
c = forall a. ResultValue a -> ResultContainer (ResultData a)
resultValueToContainer ResultValue (SamplingCounter a)
x
      
-- | Return a source by the specified counter.
timingCounterResultSource :: (ResultItemable (ResultValue a),
                              ResultItemable (ResultValue (TimingStats a)))
                             => ResultValue (TimingCounter a)
                             -- ^ the counter
                             -> ResultSource
timingCounterResultSource :: forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingCounter a) -> ResultSource
timingCounterResultSource ResultValue (TimingCounter a)
x =
  ResultObject -> ResultSource
ResultObjectSource forall a b. (a -> b) -> a -> b
$
  ResultObject {
    resultObjectName :: ResultName
resultObjectName      = forall e. ResultValue e -> ResultName
resultValueName ResultValue (TimingCounter a)
x,
    resultObjectId :: ResultId
resultObjectId        = forall e. ResultValue e -> ResultId
resultValueId ResultValue (TimingCounter a)
x,
    resultObjectTypeId :: ResultId
resultObjectTypeId    = ResultId
TimingCounterId,
    resultObjectSignal :: ResultSignal
resultObjectSignal    = forall e. ResultValue e -> ResultSignal
resultValueSignal ResultValue (TimingCounter a)
x,
    resultObjectSummary :: ResultSource
resultObjectSummary   = forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingCounter a) -> ResultSource
timingCounterResultSummary ResultValue (TimingCounter a)
x,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingCounter a))
c ResultName
"value" ResultId
TimingCounterValueId forall a. TimingCounter a -> a
timingCounterValue,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingCounter a))
c ResultName
"stats" ResultId
TimingCounterStatsId forall a. TimingCounter a -> TimingStats a
timingCounterStats ] }
  where
    c :: ResultContainer (ResultData (TimingCounter a))
c = forall a. ResultValue a -> ResultContainer (ResultData a)
resultValueToContainer ResultValue (TimingCounter a)
x
      
-- | Return a source by the specified counter.
timingCounterResultSummary :: (ResultItemable (ResultValue a),
                               ResultItemable (ResultValue (TimingStats a)))
                              => ResultValue (TimingCounter a)
                              -- ^ the counter
                              -> ResultSource
timingCounterResultSummary :: forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingCounter a) -> ResultSource
timingCounterResultSummary ResultValue (TimingCounter a)
x =
  ResultObject -> ResultSource
ResultObjectSource forall a b. (a -> b) -> a -> b
$
  ResultObject {
    resultObjectName :: ResultName
resultObjectName      = forall e. ResultValue e -> ResultName
resultValueName ResultValue (TimingCounter a)
x,
    resultObjectId :: ResultId
resultObjectId        = forall e. ResultValue e -> ResultId
resultValueId ResultValue (TimingCounter a)
x,
    resultObjectTypeId :: ResultId
resultObjectTypeId    = ResultId
TimingCounterId,
    resultObjectSignal :: ResultSignal
resultObjectSignal    = forall e. ResultValue e -> ResultSignal
resultValueSignal ResultValue (TimingCounter a)
x,
    resultObjectSummary :: ResultSource
resultObjectSummary   = forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingCounter a) -> ResultSource
timingCounterResultSummary ResultValue (TimingCounter a)
x,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingCounter a))
c ResultName
"value" ResultId
TimingCounterValueId forall a. TimingCounter a -> a
timingCounterValue,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingCounter a))
c ResultName
"stats" ResultId
TimingCounterStatsId forall a. TimingCounter a -> TimingStats a
timingCounterStats ] }
  where
    c :: ResultContainer (ResultData (TimingCounter a))
c = forall a. ResultValue a -> ResultContainer (ResultData a)
resultValueToContainer ResultValue (TimingCounter a)
x
  
-- | Return a source by the specified finite queue.
queueResultSource :: (Show si, Show sm, Show so,
                      ResultItemable (ResultValue si),
                      ResultItemable (ResultValue sm),
                      ResultItemable (ResultValue so))
                     => ResultContainer (Q.Queue si sm so a)
                     -- ^ the queue container
                     -> ResultSource
queueResultSource :: forall si sm so a.
(Show si, Show sm, Show so, ResultItemable (ResultValue si),
 ResultItemable (ResultValue sm),
 ResultItemable (ResultValue so)) =>
ResultContainer (Queue si sm so a) -> ResultSource
queueResultSource ResultContainer (Queue si sm so a)
c =
  ResultObject -> ResultSource
ResultObjectSource forall a b. (a -> b) -> a -> b
$
  ResultObject {
    resultObjectName :: ResultName
resultObjectName = forall e. ResultContainer e -> ResultName
resultContainerName ResultContainer (Queue si sm so a)
c,
    resultObjectId :: ResultId
resultObjectId = forall e. ResultContainer e -> ResultId
resultContainerId ResultContainer (Queue si sm so a)
c,
    resultObjectTypeId :: ResultId
resultObjectTypeId = ResultId
FiniteQueueId,
    resultObjectSignal :: ResultSignal
resultObjectSignal = forall e. ResultContainer e -> ResultSignal
resultContainerSignal ResultContainer (Queue si sm so a)
c,
    resultObjectSummary :: ResultSource
resultObjectSummary = forall si sm so a.
(Show si, Show sm, Show so) =>
ResultContainer (Queue si sm so a) -> ResultSource
queueResultSummary ResultContainer (Queue si sm so a)
c,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerConstProperty ResultContainer (Queue si sm so a)
c ResultName
"enqueueStrategy" ResultId
EnqueueStrategyId forall si sm so a. Queue si sm so a -> si
Q.enqueueStrategy,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerConstProperty ResultContainer (Queue si sm so a)
c ResultName
"enqueueStoringStrategy" ResultId
EnqueueStoringStrategyId forall si sm so a. Queue si sm so a -> sm
Q.enqueueStoringStrategy,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerConstProperty ResultContainer (Queue si sm so a)
c ResultName
"dequeueStrategy" ResultId
DequeueStrategyId forall si sm so a. Queue si sm so a -> so
Q.dequeueStrategy,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue si sm so a)
c ResultName
"queueNull" ResultId
QueueNullId forall si sm so a. Queue si sm so a -> Event Bool
Q.queueNull forall si sm so a. Queue si sm so a -> Signal ()
Q.queueNullChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue si sm so a)
c ResultName
"queueFull" ResultId
QueueFullId forall si sm so a. Queue si sm so a -> Event Bool
Q.queueFull forall si sm so a. Queue si sm so a -> Signal ()
Q.queueFullChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerConstProperty ResultContainer (Queue si sm so a)
c ResultName
"queueMaxCount" ResultId
QueueMaxCountId forall si sm so a. Queue si sm so a -> Int
Q.queueMaxCount,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue si sm so a)
c ResultName
"queueCount" ResultId
QueueCountId forall si sm so a. Queue si sm so a -> Event Int
Q.queueCount forall si sm so a. Queue si sm so a -> Signal ()
Q.queueCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue si sm so a)
c ResultName
"queueCountStats" ResultId
QueueCountStatsId forall si sm so a. Queue si sm so a -> Event (TimingStats Int)
Q.queueCountStats forall si sm so a. Queue si sm so a -> Signal ()
Q.queueCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue si sm so a)
c ResultName
"enqueueCount" ResultId
EnqueueCountId forall si sm so a. Queue si sm so a -> Event Int
Q.enqueueCount forall si sm so a. Queue si sm so a -> Signal ()
Q.enqueueCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue si sm so a)
c ResultName
"enqueueLostCount" ResultId
EnqueueLostCountId forall si sm so a. Queue si sm so a -> Event Int
Q.enqueueLostCount forall si sm so a. Queue si sm so a -> Signal ()
Q.enqueueLostCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue si sm so a)
c ResultName
"enqueueStoreCount" ResultId
EnqueueStoreCountId forall si sm so a. Queue si sm so a -> Event Int
Q.enqueueStoreCount forall si sm so a. Queue si sm so a -> Signal ()
Q.enqueueStoreCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue si sm so a)
c ResultName
"dequeueCount" ResultId
DequeueCountId forall si sm so a. Queue si sm so a -> Event Int
Q.dequeueCount forall si sm so a. Queue si sm so a -> Signal ()
Q.dequeueCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue si sm so a)
c ResultName
"dequeueExtractCount" ResultId
DequeueExtractCountId forall si sm so a. Queue si sm so a -> Event Int
Q.dequeueExtractCount forall si sm so a. Queue si sm so a -> Signal ()
Q.dequeueExtractCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue si sm so a)
c ResultName
"queueLoadFactor" ResultId
QueueLoadFactorId forall si sm so a. Queue si sm so a -> Event Double
Q.queueLoadFactor forall si sm so a. Queue si sm so a -> Signal ()
Q.queueLoadFactorChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName -> ResultId -> (a -> Event b) -> ResultProperty
resultContainerIntegProperty ResultContainer (Queue si sm so a)
c ResultName
"enqueueRate" ResultId
EnqueueRateId forall si sm so a. Queue si sm so a -> Event Double
Q.enqueueRate,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName -> ResultId -> (a -> Event b) -> ResultProperty
resultContainerIntegProperty ResultContainer (Queue si sm so a)
c ResultName
"enqueueStoreRate" ResultId
EnqueueStoreRateId forall si sm so a. Queue si sm so a -> Event Double
Q.enqueueStoreRate,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName -> ResultId -> (a -> Event b) -> ResultProperty
resultContainerIntegProperty ResultContainer (Queue si sm so a)
c ResultName
"dequeueRate" ResultId
DequeueRateId forall si sm so a. Queue si sm so a -> Event Double
Q.dequeueRate,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName -> ResultId -> (a -> Event b) -> ResultProperty
resultContainerIntegProperty ResultContainer (Queue si sm so a)
c ResultName
"dequeueExtractRate" ResultId
DequeueExtractRateId forall si sm so a. Queue si sm so a -> Event Double
Q.dequeueExtractRate,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue si sm so a)
c ResultName
"queueWaitTime" ResultId
QueueWaitTimeId forall si sm so a. Queue si sm so a -> Event (SamplingStats Double)
Q.queueWaitTime forall si sm so a. Queue si sm so a -> Signal ()
Q.queueWaitTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue si sm so a)
c ResultName
"queueTotalWaitTime" ResultId
QueueTotalWaitTimeId forall si sm so a. Queue si sm so a -> Event (SamplingStats Double)
Q.queueTotalWaitTime forall si sm so a. Queue si sm so a -> Signal ()
Q.queueTotalWaitTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue si sm so a)
c ResultName
"enqueueWaitTime" ResultId
EnqueueWaitTimeId forall si sm so a. Queue si sm so a -> Event (SamplingStats Double)
Q.enqueueWaitTime forall si sm so a. Queue si sm so a -> Signal ()
Q.enqueueWaitTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue si sm so a)
c ResultName
"dequeueWaitTime" ResultId
DequeueWaitTimeId forall si sm so a. Queue si sm so a -> Event (SamplingStats Double)
Q.dequeueWaitTime forall si sm so a. Queue si sm so a -> Signal ()
Q.dequeueWaitTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue si sm so a)
c ResultName
"queueRate" ResultId
QueueRateId forall si sm so a. Queue si sm so a -> Event Double
Q.queueRate forall si sm so a. Queue si sm so a -> Signal ()
Q.queueRateChanged_ ] }

-- | Return the summary by the specified finite queue.
queueResultSummary :: (Show si, Show sm, Show so)
                      => ResultContainer (Q.Queue si sm so a)
                      -- ^ the queue container
                      -> ResultSource
queueResultSummary :: forall si sm so a.
(Show si, Show sm, Show so) =>
ResultContainer (Queue si sm so a) -> ResultSource
queueResultSummary ResultContainer (Queue si sm so a)
c =
  ResultObject -> ResultSource
ResultObjectSource forall a b. (a -> b) -> a -> b
$
  ResultObject {
    resultObjectName :: ResultName
resultObjectName = forall e. ResultContainer e -> ResultName
resultContainerName ResultContainer (Queue si sm so a)
c,
    resultObjectId :: ResultId
resultObjectId = forall e. ResultContainer e -> ResultId
resultContainerId ResultContainer (Queue si sm so a)
c,
    resultObjectTypeId :: ResultId
resultObjectTypeId = ResultId
FiniteQueueId,
    resultObjectSignal :: ResultSignal
resultObjectSignal = forall e. ResultContainer e -> ResultSignal
resultContainerSignal ResultContainer (Queue si sm so a)
c,
    resultObjectSummary :: ResultSource
resultObjectSummary = forall si sm so a.
(Show si, Show sm, Show so) =>
ResultContainer (Queue si sm so a) -> ResultSource
queueResultSummary ResultContainer (Queue si sm so a)
c,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerConstProperty ResultContainer (Queue si sm so a)
c ResultName
"queueMaxCount" ResultId
QueueMaxCountId forall si sm so a. Queue si sm so a -> Int
Q.queueMaxCount,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue si sm so a)
c ResultName
"queueCountStats" ResultId
QueueCountStatsId forall si sm so a. Queue si sm so a -> Event (TimingStats Int)
Q.queueCountStats forall si sm so a. Queue si sm so a -> Signal ()
Q.queueCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue si sm so a)
c ResultName
"enqueueCount" ResultId
EnqueueCountId forall si sm so a. Queue si sm so a -> Event Int
Q.enqueueCount forall si sm so a. Queue si sm so a -> Signal ()
Q.enqueueCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue si sm so a)
c ResultName
"enqueueLostCount" ResultId
EnqueueLostCountId forall si sm so a. Queue si sm so a -> Event Int
Q.enqueueLostCount forall si sm so a. Queue si sm so a -> Signal ()
Q.enqueueLostCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue si sm so a)
c ResultName
"enqueueStoreCount" ResultId
EnqueueStoreCountId forall si sm so a. Queue si sm so a -> Event Int
Q.enqueueStoreCount forall si sm so a. Queue si sm so a -> Signal ()
Q.enqueueStoreCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue si sm so a)
c ResultName
"dequeueCount" ResultId
DequeueCountId forall si sm so a. Queue si sm so a -> Event Int
Q.dequeueCount forall si sm so a. Queue si sm so a -> Signal ()
Q.dequeueCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue si sm so a)
c ResultName
"dequeueExtractCount" ResultId
DequeueExtractCountId forall si sm so a. Queue si sm so a -> Event Int
Q.dequeueExtractCount forall si sm so a. Queue si sm so a -> Signal ()
Q.dequeueExtractCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue si sm so a)
c ResultName
"queueLoadFactor" ResultId
QueueLoadFactorId forall si sm so a. Queue si sm so a -> Event Double
Q.queueLoadFactor forall si sm so a. Queue si sm so a -> Signal ()
Q.queueLoadFactorChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue si sm so a)
c ResultName
"queueWaitTime" ResultId
QueueWaitTimeId forall si sm so a. Queue si sm so a -> Event (SamplingStats Double)
Q.queueWaitTime forall si sm so a. Queue si sm so a -> Signal ()
Q.queueWaitTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue si sm so a)
c ResultName
"queueRate" ResultId
QueueRateId forall si sm so a. Queue si sm so a -> Event Double
Q.queueRate forall si sm so a. Queue si sm so a -> Signal ()
Q.queueRateChanged_ ] }

-- | Return a source by the specified infinite queue.
infiniteQueueResultSource :: (Show sm, Show so,
                              ResultItemable (ResultValue sm),
                              ResultItemable (ResultValue so))
                             => ResultContainer (IQ.Queue sm so a)
                             -- ^ the queue container
                             -> ResultSource
infiniteQueueResultSource :: forall sm so a.
(Show sm, Show so, ResultItemable (ResultValue sm),
 ResultItemable (ResultValue so)) =>
ResultContainer (Queue sm so a) -> ResultSource
infiniteQueueResultSource ResultContainer (Queue sm so a)
c =
  ResultObject -> ResultSource
ResultObjectSource forall a b. (a -> b) -> a -> b
$
  ResultObject {
    resultObjectName :: ResultName
resultObjectName = forall e. ResultContainer e -> ResultName
resultContainerName ResultContainer (Queue sm so a)
c,
    resultObjectId :: ResultId
resultObjectId = forall e. ResultContainer e -> ResultId
resultContainerId ResultContainer (Queue sm so a)
c,
    resultObjectTypeId :: ResultId
resultObjectTypeId = ResultId
FiniteQueueId,
    resultObjectSignal :: ResultSignal
resultObjectSignal = forall e. ResultContainer e -> ResultSignal
resultContainerSignal ResultContainer (Queue sm so a)
c,
    resultObjectSummary :: ResultSource
resultObjectSummary = forall sm so a.
(Show sm, Show so) =>
ResultContainer (Queue sm so a) -> ResultSource
infiniteQueueResultSummary ResultContainer (Queue sm so a)
c,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerConstProperty ResultContainer (Queue sm so a)
c ResultName
"enqueueStoringStrategy" ResultId
EnqueueStoringStrategyId forall sm so a. Queue sm so a -> sm
IQ.enqueueStoringStrategy,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerConstProperty ResultContainer (Queue sm so a)
c ResultName
"dequeueStrategy" ResultId
DequeueStrategyId forall sm so a. Queue sm so a -> so
IQ.dequeueStrategy,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue sm so a)
c ResultName
"queueNull" ResultId
QueueNullId forall sm so a. Queue sm so a -> Event Bool
IQ.queueNull forall sm so a. Queue sm so a -> Signal ()
IQ.queueNullChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue sm so a)
c ResultName
"queueCount" ResultId
QueueCountId forall sm so a. Queue sm so a -> Event Int
IQ.queueCount forall sm so a. Queue sm so a -> Signal ()
IQ.queueCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue sm so a)
c ResultName
"queueCountStats" ResultId
QueueCountStatsId forall sm so a. Queue sm so a -> Event (TimingStats Int)
IQ.queueCountStats forall sm so a. Queue sm so a -> Signal ()
IQ.queueCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue sm so a)
c ResultName
"enqueueStoreCount" ResultId
EnqueueStoreCountId forall sm so a. Queue sm so a -> Event Int
IQ.enqueueStoreCount forall sm so a. Queue sm so a -> Signal ()
IQ.enqueueStoreCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue sm so a)
c ResultName
"dequeueCount" ResultId
DequeueCountId forall sm so a. Queue sm so a -> Event Int
IQ.dequeueCount forall sm so a. Queue sm so a -> Signal ()
IQ.dequeueCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue sm so a)
c ResultName
"dequeueExtractCount" ResultId
DequeueExtractCountId forall sm so a. Queue sm so a -> Event Int
IQ.dequeueExtractCount forall sm so a. Queue sm so a -> Signal ()
IQ.dequeueExtractCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName -> ResultId -> (a -> Event b) -> ResultProperty
resultContainerIntegProperty ResultContainer (Queue sm so a)
c ResultName
"enqueueStoreRate" ResultId
EnqueueStoreRateId forall sm so a. Queue sm so a -> Event Double
IQ.enqueueStoreRate,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName -> ResultId -> (a -> Event b) -> ResultProperty
resultContainerIntegProperty ResultContainer (Queue sm so a)
c ResultName
"dequeueRate" ResultId
DequeueRateId forall sm so a. Queue sm so a -> Event Double
IQ.dequeueRate,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName -> ResultId -> (a -> Event b) -> ResultProperty
resultContainerIntegProperty ResultContainer (Queue sm so a)
c ResultName
"dequeueExtractRate" ResultId
DequeueExtractRateId forall sm so a. Queue sm so a -> Event Double
IQ.dequeueExtractRate,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue sm so a)
c ResultName
"queueWaitTime" ResultId
QueueWaitTimeId forall sm so a. Queue sm so a -> Event (SamplingStats Double)
IQ.queueWaitTime forall sm so a. Queue sm so a -> Signal ()
IQ.queueWaitTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue sm so a)
c ResultName
"dequeueWaitTime" ResultId
DequeueWaitTimeId forall sm so a. Queue sm so a -> Event (SamplingStats Double)
IQ.dequeueWaitTime forall sm so a. Queue sm so a -> Signal ()
IQ.dequeueWaitTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue sm so a)
c ResultName
"queueRate" ResultId
QueueRateId forall sm so a. Queue sm so a -> Event Double
IQ.queueRate forall sm so a. Queue sm so a -> Signal ()
IQ.queueRateChanged_ ] }

-- | Return the summary by the specified infinite queue.
infiniteQueueResultSummary :: (Show sm, Show so)
                              => ResultContainer (IQ.Queue sm so a)
                              -- ^ the queue container
                              -> ResultSource
infiniteQueueResultSummary :: forall sm so a.
(Show sm, Show so) =>
ResultContainer (Queue sm so a) -> ResultSource
infiniteQueueResultSummary ResultContainer (Queue sm so a)
c =
  ResultObject -> ResultSource
ResultObjectSource forall a b. (a -> b) -> a -> b
$
  ResultObject {
    resultObjectName :: ResultName
resultObjectName = forall e. ResultContainer e -> ResultName
resultContainerName ResultContainer (Queue sm so a)
c,
    resultObjectId :: ResultId
resultObjectId = forall e. ResultContainer e -> ResultId
resultContainerId ResultContainer (Queue sm so a)
c,
    resultObjectTypeId :: ResultId
resultObjectTypeId = ResultId
FiniteQueueId,
    resultObjectSignal :: ResultSignal
resultObjectSignal = forall e. ResultContainer e -> ResultSignal
resultContainerSignal ResultContainer (Queue sm so a)
c,
    resultObjectSummary :: ResultSource
resultObjectSummary = forall sm so a.
(Show sm, Show so) =>
ResultContainer (Queue sm so a) -> ResultSource
infiniteQueueResultSummary ResultContainer (Queue sm so a)
c,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue sm so a)
c ResultName
"queueCountStats" ResultId
QueueCountStatsId forall sm so a. Queue sm so a -> Event (TimingStats Int)
IQ.queueCountStats forall sm so a. Queue sm so a -> Signal ()
IQ.queueCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue sm so a)
c ResultName
"enqueueStoreCount" ResultId
EnqueueStoreCountId forall sm so a. Queue sm so a -> Event Int
IQ.enqueueStoreCount forall sm so a. Queue sm so a -> Signal ()
IQ.enqueueStoreCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue sm so a)
c ResultName
"dequeueCount" ResultId
DequeueCountId forall sm so a. Queue sm so a -> Event Int
IQ.dequeueCount forall sm so a. Queue sm so a -> Signal ()
IQ.dequeueCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue sm so a)
c ResultName
"dequeueExtractCount" ResultId
DequeueExtractCountId forall sm so a. Queue sm so a -> Event Int
IQ.dequeueExtractCount forall sm so a. Queue sm so a -> Signal ()
IQ.dequeueExtractCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue sm so a)
c ResultName
"queueWaitTime" ResultId
QueueWaitTimeId forall sm so a. Queue sm so a -> Event (SamplingStats Double)
IQ.queueWaitTime forall sm so a. Queue sm so a -> Signal ()
IQ.queueWaitTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Queue sm so a)
c ResultName
"queueRate" ResultId
QueueRateId forall sm so a. Queue sm so a -> Event Double
IQ.queueRate forall sm so a. Queue sm so a -> Signal ()
IQ.queueRateChanged_ ] }
  
-- | Return a source by the specified arrival timer.
arrivalTimerResultSource :: ResultContainer ArrivalTimer
                            -- ^ the arrival timer container
                            -> ResultSource
arrivalTimerResultSource :: ResultContainer ArrivalTimer -> ResultSource
arrivalTimerResultSource ResultContainer ArrivalTimer
c =
  ResultObject -> ResultSource
ResultObjectSource forall a b. (a -> b) -> a -> b
$
  ResultObject {
    resultObjectName :: ResultName
resultObjectName = forall e. ResultContainer e -> ResultName
resultContainerName ResultContainer ArrivalTimer
c,
    resultObjectId :: ResultId
resultObjectId = forall e. ResultContainer e -> ResultId
resultContainerId ResultContainer ArrivalTimer
c,
    resultObjectTypeId :: ResultId
resultObjectTypeId = ResultId
ArrivalTimerId,
    resultObjectSignal :: ResultSignal
resultObjectSignal = forall e. ResultContainer e -> ResultSignal
resultContainerSignal ResultContainer ArrivalTimer
c,
    resultObjectSummary :: ResultSource
resultObjectSummary = ResultContainer ArrivalTimer -> ResultSource
arrivalTimerResultSummary ResultContainer ArrivalTimer
c,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer ArrivalTimer
c ResultName
"processingTime" ResultId
ArrivalProcessingTimeId ArrivalTimer -> Event (SamplingStats Double)
arrivalProcessingTime ArrivalTimer -> Signal ()
arrivalProcessingTimeChanged_ ] }

-- | Return the summary by the specified arrival timer.
arrivalTimerResultSummary :: ResultContainer ArrivalTimer
                             -- ^ the arrival timer container
                             -> ResultSource
arrivalTimerResultSummary :: ResultContainer ArrivalTimer -> ResultSource
arrivalTimerResultSummary ResultContainer ArrivalTimer
c =
  ResultObject -> ResultSource
ResultObjectSource forall a b. (a -> b) -> a -> b
$
  ResultObject {
    resultObjectName :: ResultName
resultObjectName = forall e. ResultContainer e -> ResultName
resultContainerName ResultContainer ArrivalTimer
c,
    resultObjectId :: ResultId
resultObjectId = forall e. ResultContainer e -> ResultId
resultContainerId ResultContainer ArrivalTimer
c,
    resultObjectTypeId :: ResultId
resultObjectTypeId = ResultId
ArrivalTimerId,
    resultObjectSignal :: ResultSignal
resultObjectSignal = forall e. ResultContainer e -> ResultSignal
resultContainerSignal ResultContainer ArrivalTimer
c,
    resultObjectSummary :: ResultSource
resultObjectSummary = ResultContainer ArrivalTimer -> ResultSource
arrivalTimerResultSummary ResultContainer ArrivalTimer
c,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer ArrivalTimer
c ResultName
"processingTime" ResultId
ArrivalProcessingTimeId ArrivalTimer -> Event (SamplingStats Double)
arrivalProcessingTime ArrivalTimer -> Signal ()
arrivalProcessingTimeChanged_ ] }

-- | Return a source by the specified server.
serverResultSource :: (Show s, ResultItemable (ResultValue s))
                      => ResultContainer (Server s a b)
                      -- ^ the server container
                      -> ResultSource
serverResultSource :: forall s a b.
(Show s, ResultItemable (ResultValue s)) =>
ResultContainer (Server s a b) -> ResultSource
serverResultSource ResultContainer (Server s a b)
c =
  ResultObject -> ResultSource
ResultObjectSource forall a b. (a -> b) -> a -> b
$
  ResultObject {
    resultObjectName :: ResultName
resultObjectName = forall e. ResultContainer e -> ResultName
resultContainerName ResultContainer (Server s a b)
c,
    resultObjectId :: ResultId
resultObjectId = forall e. ResultContainer e -> ResultId
resultContainerId ResultContainer (Server s a b)
c,
    resultObjectTypeId :: ResultId
resultObjectTypeId = ResultId
ServerId,
    resultObjectSignal :: ResultSignal
resultObjectSignal = forall e. ResultContainer e -> ResultSignal
resultContainerSignal ResultContainer (Server s a b)
c,
    resultObjectSummary :: ResultSource
resultObjectSummary = forall s a b. ResultContainer (Server s a b) -> ResultSource
serverResultSummary ResultContainer (Server s a b)
c,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerConstProperty ResultContainer (Server s a b)
c ResultName
"initState" ResultId
ServerInitStateId forall s a b. Server s a b -> s
serverInitState,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Server s a b)
c ResultName
"state" ResultId
ServerStateId forall s a b. Server s a b -> Event s
serverState forall s a b. Server s a b -> Signal ()
serverStateChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Server s a b)
c ResultName
"totalInputWaitTime" ResultId
ServerTotalInputWaitTimeId forall s a b. Server s a b -> Event Double
serverTotalInputWaitTime forall s a b. Server s a b -> Signal ()
serverTotalInputWaitTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Server s a b)
c ResultName
"totalProcessingTime" ResultId
ServerTotalProcessingTimeId forall s a b. Server s a b -> Event Double
serverTotalProcessingTime forall s a b. Server s a b -> Signal ()
serverTotalProcessingTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Server s a b)
c ResultName
"totalOutputWaitTime" ResultId
ServerTotalOutputWaitTimeId forall s a b. Server s a b -> Event Double
serverTotalOutputWaitTime forall s a b. Server s a b -> Signal ()
serverTotalOutputWaitTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Server s a b)
c ResultName
"totalPreemptionTime" ResultId
ServerTotalPreemptionTimeId forall s a b. Server s a b -> Event Double
serverTotalPreemptionTime forall s a b. Server s a b -> Signal ()
serverTotalPreemptionTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Server s a b)
c ResultName
"inputWaitTime" ResultId
ServerInputWaitTimeId forall s a b. Server s a b -> Event (SamplingStats Double)
serverInputWaitTime forall s a b. Server s a b -> Signal ()
serverInputWaitTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Server s a b)
c ResultName
"processingTime" ResultId
ServerProcessingTimeId forall s a b. Server s a b -> Event (SamplingStats Double)
serverProcessingTime forall s a b. Server s a b -> Signal ()
serverProcessingTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Server s a b)
c ResultName
"outputWaitTime" ResultId
ServerOutputWaitTimeId forall s a b. Server s a b -> Event (SamplingStats Double)
serverOutputWaitTime forall s a b. Server s a b -> Signal ()
serverOutputWaitTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Server s a b)
c ResultName
"preemptionTime" ResultId
ServerPreemptionTimeId forall s a b. Server s a b -> Event (SamplingStats Double)
serverPreemptionTime forall s a b. Server s a b -> Signal ()
serverPreemptionTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Server s a b)
c ResultName
"inputWaitFactor" ResultId
ServerInputWaitFactorId forall s a b. Server s a b -> Event Double
serverInputWaitFactor forall s a b. Server s a b -> Signal ()
serverInputWaitFactorChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Server s a b)
c ResultName
"processingFactor" ResultId
ServerProcessingFactorId forall s a b. Server s a b -> Event Double
serverProcessingFactor forall s a b. Server s a b -> Signal ()
serverProcessingFactorChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Server s a b)
c ResultName
"outputWaitFactor" ResultId
ServerOutputWaitFactorId forall s a b. Server s a b -> Event Double
serverOutputWaitFactor forall s a b. Server s a b -> Signal ()
serverOutputWaitFactorChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Server s a b)
c ResultName
"preemptionFactor" ResultId
ServerPreemptionFactorId forall s a b. Server s a b -> Event Double
serverPreemptionFactor forall s a b. Server s a b -> Signal ()
serverPreemptionFactorChanged_ ] }

-- | Return the summary by the specified server.
serverResultSummary :: ResultContainer (Server s a b)
                       -- ^ the server container
                       -> ResultSource
serverResultSummary :: forall s a b. ResultContainer (Server s a b) -> ResultSource
serverResultSummary ResultContainer (Server s a b)
c =
  ResultObject -> ResultSource
ResultObjectSource forall a b. (a -> b) -> a -> b
$
  ResultObject {
    resultObjectName :: ResultName
resultObjectName = forall e. ResultContainer e -> ResultName
resultContainerName ResultContainer (Server s a b)
c,
    resultObjectId :: ResultId
resultObjectId = forall e. ResultContainer e -> ResultId
resultContainerId ResultContainer (Server s a b)
c,
    resultObjectTypeId :: ResultId
resultObjectTypeId = ResultId
ServerId,
    resultObjectSignal :: ResultSignal
resultObjectSignal = forall e. ResultContainer e -> ResultSignal
resultContainerSignal ResultContainer (Server s a b)
c,
    resultObjectSummary :: ResultSource
resultObjectSummary = forall s a b. ResultContainer (Server s a b) -> ResultSource
serverResultSummary ResultContainer (Server s a b)
c,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Server s a b)
c ResultName
"inputWaitTime" ResultId
ServerInputWaitTimeId forall s a b. Server s a b -> Event (SamplingStats Double)
serverInputWaitTime forall s a b. Server s a b -> Signal ()
serverInputWaitTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Server s a b)
c ResultName
"processingTime" ResultId
ServerProcessingTimeId forall s a b. Server s a b -> Event (SamplingStats Double)
serverProcessingTime forall s a b. Server s a b -> Signal ()
serverProcessingTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Server s a b)
c ResultName
"outputWaitTime" ResultId
ServerOutputWaitTimeId forall s a b. Server s a b -> Event (SamplingStats Double)
serverOutputWaitTime forall s a b. Server s a b -> Signal ()
serverOutputWaitTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Server s a b)
c ResultName
"preemptionTime" ResultId
ServerPreemptionTimeId forall s a b. Server s a b -> Event (SamplingStats Double)
serverPreemptionTime forall s a b. Server s a b -> Signal ()
serverPreemptionTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Server s a b)
c ResultName
"inputWaitFactor" ResultId
ServerInputWaitFactorId forall s a b. Server s a b -> Event Double
serverInputWaitFactor forall s a b. Server s a b -> Signal ()
serverInputWaitFactorChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Server s a b)
c ResultName
"processingFactor" ResultId
ServerProcessingFactorId forall s a b. Server s a b -> Event Double
serverProcessingFactor forall s a b. Server s a b -> Signal ()
serverProcessingFactorChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Server s a b)
c ResultName
"outputWaitFactor" ResultId
ServerOutputWaitFactorId forall s a b. Server s a b -> Event Double
serverOutputWaitFactor forall s a b. Server s a b -> Signal ()
serverOutputWaitFactorChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Server s a b)
c ResultName
"preemptionFactor" ResultId
ServerPreemptionFactorId forall s a b. Server s a b -> Event Double
serverPreemptionFactor forall s a b. Server s a b -> Signal ()
serverPreemptionFactorChanged_ ] }

-- | Return a source by the specified activity.
activityResultSource :: (Show s, ResultItemable (ResultValue s))
                        => ResultContainer (Activity s a b)
                        -- ^ the activity container
                        -> ResultSource
activityResultSource :: forall s a b.
(Show s, ResultItemable (ResultValue s)) =>
ResultContainer (Activity s a b) -> ResultSource
activityResultSource ResultContainer (Activity s a b)
c =
  ResultObject -> ResultSource
ResultObjectSource forall a b. (a -> b) -> a -> b
$
  ResultObject {
    resultObjectName :: ResultName
resultObjectName = forall e. ResultContainer e -> ResultName
resultContainerName ResultContainer (Activity s a b)
c,
    resultObjectId :: ResultId
resultObjectId = forall e. ResultContainer e -> ResultId
resultContainerId ResultContainer (Activity s a b)
c,
    resultObjectTypeId :: ResultId
resultObjectTypeId = ResultId
ActivityId,
    resultObjectSignal :: ResultSignal
resultObjectSignal = forall e. ResultContainer e -> ResultSignal
resultContainerSignal ResultContainer (Activity s a b)
c,
    resultObjectSummary :: ResultSource
resultObjectSummary = forall s a b. ResultContainer (Activity s a b) -> ResultSource
activityResultSummary ResultContainer (Activity s a b)
c,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerConstProperty ResultContainer (Activity s a b)
c ResultName
"initState" ResultId
ActivityInitStateId forall s a b. Activity s a b -> s
activityInitState,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Activity s a b)
c ResultName
"state" ResultId
ActivityStateId forall s a b. Activity s a b -> Event s
activityState forall s a b. Activity s a b -> Signal ()
activityStateChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Activity s a b)
c ResultName
"totalUtilisationTime" ResultId
ActivityTotalUtilisationTimeId forall s a b. Activity s a b -> Event Double
activityTotalUtilisationTime forall s a b. Activity s a b -> Signal ()
activityTotalUtilisationTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Activity s a b)
c ResultName
"totalIdleTime" ResultId
ActivityTotalIdleTimeId forall s a b. Activity s a b -> Event Double
activityTotalIdleTime forall s a b. Activity s a b -> Signal ()
activityTotalIdleTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Activity s a b)
c ResultName
"totalPreemptionTime" ResultId
ActivityTotalPreemptionTimeId forall s a b. Activity s a b -> Event Double
activityTotalPreemptionTime forall s a b. Activity s a b -> Signal ()
activityTotalPreemptionTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Activity s a b)
c ResultName
"utilisationTime" ResultId
ActivityUtilisationTimeId forall s a b. Activity s a b -> Event (SamplingStats Double)
activityUtilisationTime forall s a b. Activity s a b -> Signal ()
activityUtilisationTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Activity s a b)
c ResultName
"idleTime" ResultId
ActivityIdleTimeId forall s a b. Activity s a b -> Event (SamplingStats Double)
activityIdleTime forall s a b. Activity s a b -> Signal ()
activityIdleTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Activity s a b)
c ResultName
"preemptionTime" ResultId
ActivityPreemptionTimeId forall s a b. Activity s a b -> Event (SamplingStats Double)
activityPreemptionTime forall s a b. Activity s a b -> Signal ()
activityPreemptionTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Activity s a b)
c ResultName
"utilisationFactor" ResultId
ActivityUtilisationFactorId forall s a b. Activity s a b -> Event Double
activityUtilisationFactor forall s a b. Activity s a b -> Signal ()
activityUtilisationFactorChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Activity s a b)
c ResultName
"idleFactor" ResultId
ActivityIdleFactorId forall s a b. Activity s a b -> Event Double
activityIdleFactor forall s a b. Activity s a b -> Signal ()
activityIdleFactorChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Activity s a b)
c ResultName
"preemptionFactor" ResultId
ActivityPreemptionFactorId forall s a b. Activity s a b -> Event Double
activityPreemptionFactor forall s a b. Activity s a b -> Signal ()
activityPreemptionFactorChanged_ ] }

-- | Return a summary by the specified activity.
activityResultSummary :: ResultContainer (Activity s a b)
                         -- ^ the activity container
                         -> ResultSource
activityResultSummary :: forall s a b. ResultContainer (Activity s a b) -> ResultSource
activityResultSummary ResultContainer (Activity s a b)
c =
  ResultObject -> ResultSource
ResultObjectSource forall a b. (a -> b) -> a -> b
$
  ResultObject {
    resultObjectName :: ResultName
resultObjectName = forall e. ResultContainer e -> ResultName
resultContainerName ResultContainer (Activity s a b)
c,
    resultObjectId :: ResultId
resultObjectId = forall e. ResultContainer e -> ResultId
resultContainerId ResultContainer (Activity s a b)
c,
    resultObjectTypeId :: ResultId
resultObjectTypeId = ResultId
ActivityId,
    resultObjectSignal :: ResultSignal
resultObjectSignal = forall e. ResultContainer e -> ResultSignal
resultContainerSignal ResultContainer (Activity s a b)
c,
    resultObjectSummary :: ResultSource
resultObjectSummary = forall s a b. ResultContainer (Activity s a b) -> ResultSource
activityResultSummary ResultContainer (Activity s a b)
c,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Activity s a b)
c ResultName
"utilisationTime" ResultId
ActivityUtilisationTimeId forall s a b. Activity s a b -> Event (SamplingStats Double)
activityUtilisationTime forall s a b. Activity s a b -> Signal ()
activityUtilisationTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Activity s a b)
c ResultName
"idleTime" ResultId
ActivityIdleTimeId forall s a b. Activity s a b -> Event (SamplingStats Double)
activityIdleTime forall s a b. Activity s a b -> Signal ()
activityIdleTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Activity s a b)
c ResultName
"preemptionTime" ResultId
ActivityPreemptionTimeId forall s a b. Activity s a b -> Event (SamplingStats Double)
activityPreemptionTime forall s a b. Activity s a b -> Signal ()
activityPreemptionTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Activity s a b)
c ResultName
"utilisationFactor" ResultId
ActivityUtilisationFactorId forall s a b. Activity s a b -> Event Double
activityUtilisationFactor forall s a b. Activity s a b -> Signal ()
activityUtilisationFactorChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Activity s a b)
c ResultName
"idleFactor" ResultId
ActivityIdleFactorId forall s a b. Activity s a b -> Event Double
activityIdleFactor forall s a b. Activity s a b -> Signal ()
activityIdleFactorChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Activity s a b)
c ResultName
"preemptionFactor" ResultId
ActivityPreemptionFactorId forall s a b. Activity s a b -> Event Double
activityPreemptionFactor forall s a b. Activity s a b -> Signal ()
activityPreemptionFactorChanged_ ] }

-- | Return a source by the specified resource.
resourceResultSource :: (Show s, ResultItemable (ResultValue s))
                        => ResultContainer (Resource s)
                        -- ^ the resource container
                        -> ResultSource
resourceResultSource :: forall s.
(Show s, ResultItemable (ResultValue s)) =>
ResultContainer (Resource s) -> ResultSource
resourceResultSource ResultContainer (Resource s)
c =
  ResultObject -> ResultSource
ResultObjectSource forall a b. (a -> b) -> a -> b
$
  ResultObject {
    resultObjectName :: ResultName
resultObjectName = forall e. ResultContainer e -> ResultName
resultContainerName ResultContainer (Resource s)
c,
    resultObjectId :: ResultId
resultObjectId = forall e. ResultContainer e -> ResultId
resultContainerId ResultContainer (Resource s)
c,
    resultObjectTypeId :: ResultId
resultObjectTypeId = ResultId
ResourceId,
    resultObjectSignal :: ResultSignal
resultObjectSignal = forall e. ResultContainer e -> ResultSignal
resultContainerSignal ResultContainer (Resource s)
c,
    resultObjectSummary :: ResultSource
resultObjectSummary = forall s. ResultContainer (Resource s) -> ResultSource
resourceResultSummary ResultContainer (Resource s)
c,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Resource s)
c ResultName
"queueCount" ResultId
ResourceQueueCountId forall s. Resource s -> Event Int
resourceQueueCount forall s. Resource s -> Signal ()
resourceQueueCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Resource s)
c ResultName
"queueCountStats" ResultId
ResourceQueueCountStatsId forall s. Resource s -> Event (TimingStats Int)
resourceQueueCountStats forall s. Resource s -> Signal ()
resourceQueueCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Resource s)
c ResultName
"totalWaitTime" ResultId
ResourceTotalWaitTimeId forall s. Resource s -> Event Double
resourceTotalWaitTime forall s. Resource s -> Signal ()
resourceWaitTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Resource s)
c ResultName
"waitTime" ResultId
ResourceWaitTimeId forall s. Resource s -> Event (SamplingStats Double)
resourceWaitTime forall s. Resource s -> Signal ()
resourceWaitTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Resource s)
c ResultName
"count" ResultId
ResourceCountId forall s. Resource s -> Event Int
resourceCount forall s. Resource s -> Signal ()
resourceCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Resource s)
c ResultName
"countStats" ResultId
ResourceCountStatsId forall s. Resource s -> Event (TimingStats Int)
resourceCountStats forall s. Resource s -> Signal ()
resourceCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Resource s)
c ResultName
"utilisationCount" ResultId
ResourceUtilisationCountId forall s. Resource s -> Event Int
resourceUtilisationCount forall s. Resource s -> Signal ()
resourceUtilisationCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Resource s)
c ResultName
"utilisationCountStats" ResultId
ResourceUtilisationCountStatsId forall s. Resource s -> Event (TimingStats Int)
resourceUtilisationCountStats forall s. Resource s -> Signal ()
resourceUtilisationCountChanged_ ] }

-- | Return a summary by the specified resource.
resourceResultSummary :: ResultContainer (Resource s)
                         -- ^ the resource container
                         -> ResultSource
resourceResultSummary :: forall s. ResultContainer (Resource s) -> ResultSource
resourceResultSummary ResultContainer (Resource s)
c =
  ResultObject -> ResultSource
ResultObjectSource forall a b. (a -> b) -> a -> b
$
  ResultObject {
    resultObjectName :: ResultName
resultObjectName = forall e. ResultContainer e -> ResultName
resultContainerName ResultContainer (Resource s)
c,
    resultObjectId :: ResultId
resultObjectId = forall e. ResultContainer e -> ResultId
resultContainerId ResultContainer (Resource s)
c,
    resultObjectTypeId :: ResultId
resultObjectTypeId = ResultId
ResourceId,
    resultObjectSignal :: ResultSignal
resultObjectSignal = forall e. ResultContainer e -> ResultSignal
resultContainerSignal ResultContainer (Resource s)
c,
    resultObjectSummary :: ResultSource
resultObjectSummary = forall s. ResultContainer (Resource s) -> ResultSource
resourceResultSummary ResultContainer (Resource s)
c,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Resource s)
c ResultName
"queueCountStats" ResultId
ResourceQueueCountStatsId forall s. Resource s -> Event (TimingStats Int)
resourceQueueCountStats forall s. Resource s -> Signal ()
resourceQueueCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Resource s)
c ResultName
"waitTime" ResultId
ResourceWaitTimeId forall s. Resource s -> Event (SamplingStats Double)
resourceWaitTime forall s. Resource s -> Signal ()
resourceWaitTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Resource s)
c ResultName
"countStats" ResultId
ResourceCountStatsId forall s. Resource s -> Event (TimingStats Int)
resourceCountStats forall s. Resource s -> Signal ()
resourceCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Resource s)
c ResultName
"utilisationCountStats" ResultId
ResourceUtilisationCountStatsId forall s. Resource s -> Event (TimingStats Int)
resourceUtilisationCountStats forall s. Resource s -> Signal ()
resourceUtilisationCountChanged_ ] }

-- | Return a source by the specified resource.
preemptibleResourceResultSource :: ResultContainer PR.Resource
                                   -- ^ the resource container
                                   -> ResultSource
preemptibleResourceResultSource :: ResultContainer Resource -> ResultSource
preemptibleResourceResultSource ResultContainer Resource
c =
  ResultObject -> ResultSource
ResultObjectSource forall a b. (a -> b) -> a -> b
$
  ResultObject {
    resultObjectName :: ResultName
resultObjectName = forall e. ResultContainer e -> ResultName
resultContainerName ResultContainer Resource
c,
    resultObjectId :: ResultId
resultObjectId = forall e. ResultContainer e -> ResultId
resultContainerId ResultContainer Resource
c,
    resultObjectTypeId :: ResultId
resultObjectTypeId = ResultId
ResourceId,
    resultObjectSignal :: ResultSignal
resultObjectSignal = forall e. ResultContainer e -> ResultSignal
resultContainerSignal ResultContainer Resource
c,
    resultObjectSummary :: ResultSource
resultObjectSummary = ResultContainer Resource -> ResultSource
preemptibleResourceResultSummary ResultContainer Resource
c,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer Resource
c ResultName
"queueCount" ResultId
ResourceQueueCountId Resource -> Event Int
PR.resourceQueueCount Resource -> Signal ()
PR.resourceQueueCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer Resource
c ResultName
"queueCountStats" ResultId
ResourceQueueCountStatsId Resource -> Event (TimingStats Int)
PR.resourceQueueCountStats Resource -> Signal ()
PR.resourceQueueCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer Resource
c ResultName
"totalWaitTime" ResultId
ResourceTotalWaitTimeId Resource -> Event Double
PR.resourceTotalWaitTime Resource -> Signal ()
PR.resourceWaitTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer Resource
c ResultName
"waitTime" ResultId
ResourceWaitTimeId Resource -> Event (SamplingStats Double)
PR.resourceWaitTime Resource -> Signal ()
PR.resourceWaitTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer Resource
c ResultName
"count" ResultId
ResourceCountId Resource -> Event Int
PR.resourceCount Resource -> Signal ()
PR.resourceCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer Resource
c ResultName
"countStats" ResultId
ResourceCountStatsId Resource -> Event (TimingStats Int)
PR.resourceCountStats Resource -> Signal ()
PR.resourceCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer Resource
c ResultName
"utilisationCount" ResultId
ResourceUtilisationCountId Resource -> Event Int
PR.resourceUtilisationCount Resource -> Signal ()
PR.resourceUtilisationCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer Resource
c ResultName
"utilisationCountStats" ResultId
ResourceUtilisationCountStatsId Resource -> Event (TimingStats Int)
PR.resourceUtilisationCountStats Resource -> Signal ()
PR.resourceUtilisationCountChanged_ ] }

-- | Return a summary by the specified resource.
preemptibleResourceResultSummary :: ResultContainer PR.Resource
                                    -- ^ the resource container
                                    -> ResultSource
preemptibleResourceResultSummary :: ResultContainer Resource -> ResultSource
preemptibleResourceResultSummary ResultContainer Resource
c =
  ResultObject -> ResultSource
ResultObjectSource forall a b. (a -> b) -> a -> b
$
  ResultObject {
    resultObjectName :: ResultName
resultObjectName = forall e. ResultContainer e -> ResultName
resultContainerName ResultContainer Resource
c,
    resultObjectId :: ResultId
resultObjectId = forall e. ResultContainer e -> ResultId
resultContainerId ResultContainer Resource
c,
    resultObjectTypeId :: ResultId
resultObjectTypeId = ResultId
ResourceId,
    resultObjectSignal :: ResultSignal
resultObjectSignal = forall e. ResultContainer e -> ResultSignal
resultContainerSignal ResultContainer Resource
c,
    resultObjectSummary :: ResultSource
resultObjectSummary = ResultContainer Resource -> ResultSource
preemptibleResourceResultSummary ResultContainer Resource
c,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer Resource
c ResultName
"queueCountStats" ResultId
ResourceQueueCountStatsId Resource -> Event (TimingStats Int)
PR.resourceQueueCountStats Resource -> Signal ()
PR.resourceQueueCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer Resource
c ResultName
"waitTime" ResultId
ResourceWaitTimeId Resource -> Event (SamplingStats Double)
PR.resourceWaitTime Resource -> Signal ()
PR.resourceWaitTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer Resource
c ResultName
"countStats" ResultId
ResourceCountStatsId Resource -> Event (TimingStats Int)
PR.resourceCountStats Resource -> Signal ()
PR.resourceCountChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer Resource
c ResultName
"utilisationCountStats" ResultId
ResourceUtilisationCountStatsId Resource -> Event (TimingStats Int)
PR.resourceUtilisationCountStats Resource -> Signal ()
PR.resourceUtilisationCountChanged_ ] }

-- | Return a source by the specified operation.
operationResultSource :: ResultContainer (Operation a b)
                         -- ^ the operation container
                         -> ResultSource
operationResultSource :: forall a b. ResultContainer (Operation a b) -> ResultSource
operationResultSource ResultContainer (Operation a b)
c =
  ResultObject -> ResultSource
ResultObjectSource forall a b. (a -> b) -> a -> b
$
  ResultObject {
    resultObjectName :: ResultName
resultObjectName = forall e. ResultContainer e -> ResultName
resultContainerName ResultContainer (Operation a b)
c,
    resultObjectId :: ResultId
resultObjectId = forall e. ResultContainer e -> ResultId
resultContainerId ResultContainer (Operation a b)
c,
    resultObjectTypeId :: ResultId
resultObjectTypeId = ResultId
OperationId,
    resultObjectSignal :: ResultSignal
resultObjectSignal = forall e. ResultContainer e -> ResultSignal
resultContainerSignal ResultContainer (Operation a b)
c,
    resultObjectSummary :: ResultSource
resultObjectSummary = forall a b. ResultContainer (Operation a b) -> ResultSource
operationResultSummary ResultContainer (Operation a b)
c,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Operation a b)
c ResultName
"totalUtilisationTime" ResultId
OperationTotalUtilisationTimeId forall a b. Operation a b -> Event Double
operationTotalUtilisationTime forall a b. Operation a b -> Signal ()
operationTotalUtilisationTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Operation a b)
c ResultName
"totalPreemptionTime" ResultId
OperationTotalPreemptionTimeId forall a b. Operation a b -> Event Double
operationTotalPreemptionTime forall a b. Operation a b -> Signal ()
operationTotalPreemptionTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Operation a b)
c ResultName
"utilisationTime" ResultId
OperationUtilisationTimeId forall a b. Operation a b -> Event (SamplingStats Double)
operationUtilisationTime forall a b. Operation a b -> Signal ()
operationUtilisationTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Operation a b)
c ResultName
"preemptionTime" ResultId
OperationPreemptionTimeId forall a b. Operation a b -> Event (SamplingStats Double)
operationPreemptionTime forall a b. Operation a b -> Signal ()
operationPreemptionTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Operation a b)
c ResultName
"utilisationFactor" ResultId
OperationUtilisationFactorId forall a b. Operation a b -> Event Double
operationUtilisationFactor forall a b. Operation a b -> Signal ()
operationUtilisationFactorChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Operation a b)
c ResultName
"preemptionFactor" ResultId
OperationPreemptionFactorId forall a b. Operation a b -> Event Double
operationPreemptionFactor forall a b. Operation a b -> Signal ()
operationPreemptionFactorChanged_ ] }

-- | Return a summary by the specified operation.
operationResultSummary :: ResultContainer (Operation a b)
                          -- ^ the operation container
                          -> ResultSource
operationResultSummary :: forall a b. ResultContainer (Operation a b) -> ResultSource
operationResultSummary ResultContainer (Operation a b)
c =
  ResultObject -> ResultSource
ResultObjectSource forall a b. (a -> b) -> a -> b
$
  ResultObject {
    resultObjectName :: ResultName
resultObjectName = forall e. ResultContainer e -> ResultName
resultContainerName ResultContainer (Operation a b)
c,
    resultObjectId :: ResultId
resultObjectId = forall e. ResultContainer e -> ResultId
resultContainerId ResultContainer (Operation a b)
c,
    resultObjectTypeId :: ResultId
resultObjectTypeId = ResultId
OperationId,
    resultObjectSignal :: ResultSignal
resultObjectSignal = forall e. ResultContainer e -> ResultSignal
resultContainerSignal ResultContainer (Operation a b)
c,
    resultObjectSummary :: ResultSource
resultObjectSummary = forall a b. ResultContainer (Operation a b) -> ResultSource
operationResultSummary ResultContainer (Operation a b)
c,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Operation a b)
c ResultName
"utilisationTime" ResultId
OperationUtilisationTimeId forall a b. Operation a b -> Event (SamplingStats Double)
operationUtilisationTime forall a b. Operation a b -> Signal ()
operationUtilisationTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Operation a b)
c ResultName
"preemptionTime" ResultId
OperationPreemptionTimeId forall a b. Operation a b -> Event (SamplingStats Double)
operationPreemptionTime forall a b. Operation a b -> Signal ()
operationPreemptionTimeChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Operation a b)
c ResultName
"utilisationFactor" ResultId
OperationUtilisationFactorId forall a b. Operation a b -> Event Double
operationUtilisationFactor forall a b. Operation a b -> Signal ()
operationUtilisationFactorChanged_,
      forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Operation a b)
c ResultName
"preemptionFactor" ResultId
OperationPreemptionFactorId forall a b. Operation a b -> Event Double
operationPreemptionFactor forall a b. Operation a b -> Signal ()
operationPreemptionFactorChanged_ ] }

-- | Return an arbitrary text as a separator source.
textResultSource :: String -> ResultSource
textResultSource :: ResultName -> ResultSource
textResultSource ResultName
text =
  ResultSeparator -> ResultSource
ResultSeparatorSource forall a b. (a -> b) -> a -> b
$
  ResultSeparator { resultSeparatorText :: ResultName
resultSeparatorText = ResultName
text }

-- | Return the source of the modeling time.
timeResultSource :: ResultSource
timeResultSource :: ResultSource
timeResultSource = forall p.
ResultProvider p =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> p -> ResultSource
resultSource' ResultName
"t" [ResultName
"t"] ResultId
TimeId [ResultId
TimeId] Dynamics Double
time
                         
-- | Make an integer subscript
intSubscript :: Int -> ResultName
intSubscript :: Int -> ResultName
intSubscript Int
i = ResultName
"[" forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> ResultName
show Int
i forall a. [a] -> [a] -> [a]
++ ResultName
"]"

instance {-# OVERLAPPABLE #-} ResultItemable (ResultValue a) => ResultProvider (Parameter a) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Parameter a
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Parameter a
m =
    ResultItem -> ResultSource
ResultItemSource forall a b. (a -> b) -> a -> b
$ forall a. ResultItemable a => a -> ResultItem
ResultItem forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Parameter a
m

instance {-# OVERLAPPABLE #-} ResultItemable (ResultValue a) => ResultProvider (Simulation a) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Simulation a
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Simulation a
m =
    ResultItem -> ResultSource
ResultItemSource forall a b. (a -> b) -> a -> b
$ forall a. ResultItemable a => a -> ResultItem
ResultItem forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Simulation a
m

instance {-# OVERLAPPABLE #-} ResultItemable (ResultValue a) => ResultProvider (Dynamics a) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Dynamics a
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Dynamics a
m =
    ResultItem -> ResultSource
ResultItemSource forall a b. (a -> b) -> a -> b
$ forall a. ResultItemable a => a -> ResultItem
ResultItem forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Dynamics a
m

instance {-# OVERLAPPABLE #-} ResultItemable (ResultValue a) => ResultProvider (Event a) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Event a
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Event a
m =
    ResultItem -> ResultSource
ResultItemSource forall a b. (a -> b) -> a -> b
$ forall a. ResultItemable a => a -> ResultItem
ResultItem forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Event a
m

instance {-# OVERLAPPABLE #-} ResultItemable (ResultValue a) => ResultProvider (Ref a) where

  resultSource' :: ResultName
-> [ResultName] -> ResultId -> [ResultId] -> Ref a -> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Ref a
m =
    ResultItem -> ResultSource
ResultItemSource forall a b. (a -> b) -> a -> b
$ forall a. ResultItemable a => a -> ResultItem
ResultItem forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Ref a
m

instance {-# OVERLAPPABLE #-} ResultItemable (ResultValue a) => ResultProvider (BR.Ref a) where

  resultSource' :: ResultName
-> [ResultName] -> ResultId -> [ResultId] -> Ref a -> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Ref a
m =
    ResultItem -> ResultSource
ResultItemSource forall a b. (a -> b) -> a -> b
$ forall a. ResultItemable a => a -> ResultItem
ResultItem forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Ref a
m

instance {-# OVERLAPPABLE #-} ResultItemable (ResultValue a) => ResultProvider (Var a) where

  resultSource' :: ResultName
-> [ResultName] -> ResultId -> [ResultId] -> Var a -> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Var a
m =
    ResultItem -> ResultSource
ResultItemSource forall a b. (a -> b) -> a -> b
$ forall a. ResultItemable a => a -> ResultItem
ResultItem forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Var a
m

instance {-# OVERLAPPABLE #-} ResultItemable (ResultValue a) => ResultProvider (Signalable a) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Signalable a
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Signalable a
m =
    ResultItem -> ResultSource
ResultItemSource forall a b. (a -> b) -> a -> b
$ forall a. ResultItemable a => a -> ResultItem
ResultItem forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Signalable a
m

instance {-# OVERLAPPING #-} (ResultItemable (ResultValue a),
                              ResultItemable (ResultValue (SamplingStats a)))
                             => ResultProvider (Parameter (SamplingCounter a)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Parameter (SamplingCounter a)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Parameter (SamplingCounter a)
m =
    forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (SamplingStats a))) =>
ResultValue (SamplingCounter a) -> ResultSource
samplingCounterResultSource forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Parameter (SamplingCounter a)
m

instance {-# OVERLAPPING #-} (ResultItemable (ResultValue a),
                              ResultItemable (ResultValue (SamplingStats a)))
                             => ResultProvider (Simulation (SamplingCounter a)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Simulation (SamplingCounter a)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Simulation (SamplingCounter a)
m =
    forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (SamplingStats a))) =>
ResultValue (SamplingCounter a) -> ResultSource
samplingCounterResultSource forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Simulation (SamplingCounter a)
m

instance {-# OVERLAPPING #-} (ResultItemable (ResultValue a),
                              ResultItemable (ResultValue (SamplingStats a)))
                             => ResultProvider (Dynamics (SamplingCounter a)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Dynamics (SamplingCounter a)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Dynamics (SamplingCounter a)
m =
    forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (SamplingStats a))) =>
ResultValue (SamplingCounter a) -> ResultSource
samplingCounterResultSource forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Dynamics (SamplingCounter a)
m

instance {-# OVERLAPPING #-} (ResultItemable (ResultValue a),
                              ResultItemable (ResultValue (SamplingStats a)))
                             => ResultProvider (Event (SamplingCounter a)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Event (SamplingCounter a)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Event (SamplingCounter a)
m =
    forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (SamplingStats a))) =>
ResultValue (SamplingCounter a) -> ResultSource
samplingCounterResultSource forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Event (SamplingCounter a)
m

instance {-# OVERLAPPING #-} (ResultItemable (ResultValue a),
                              ResultItemable (ResultValue (SamplingStats a)))
                             => ResultProvider (Ref (SamplingCounter a)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Ref (SamplingCounter a)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Ref (SamplingCounter a)
m =
    forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (SamplingStats a))) =>
ResultValue (SamplingCounter a) -> ResultSource
samplingCounterResultSource forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Ref (SamplingCounter a)
m

instance {-# OVERLAPPING #-} (ResultItemable (ResultValue a),
                              ResultItemable (ResultValue (SamplingStats a)))
                             => ResultProvider (BR.Ref (SamplingCounter a)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Ref (SamplingCounter a)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Ref (SamplingCounter a)
m =
    forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (SamplingStats a))) =>
ResultValue (SamplingCounter a) -> ResultSource
samplingCounterResultSource forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Ref (SamplingCounter a)
m

instance {-# OVERLAPPING #-} (ResultItemable (ResultValue a),
                              ResultItemable (ResultValue (SamplingStats a)))
                             => ResultProvider (Var (SamplingCounter a)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Var (SamplingCounter a)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Var (SamplingCounter a)
m =
    forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (SamplingStats a))) =>
ResultValue (SamplingCounter a) -> ResultSource
samplingCounterResultSource forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Var (SamplingCounter a)
m

instance {-# OVERLAPPING #-} (ResultItemable (ResultValue a),
                              ResultItemable (ResultValue (SamplingStats a)))
                             => ResultProvider (Signalable (SamplingCounter a)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Signalable (SamplingCounter a)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Signalable (SamplingCounter a)
m =
    forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (SamplingStats a))) =>
ResultValue (SamplingCounter a) -> ResultSource
samplingCounterResultSource forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Signalable (SamplingCounter a)
m

instance {-# OVERLAPPING #-} (ResultItemable (ResultValue a),
                              ResultItemable (ResultValue (TimingStats a)))
                             => ResultProvider (Parameter (TimingCounter a)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Parameter (TimingCounter a)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Parameter (TimingCounter a)
m =
    forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingCounter a) -> ResultSource
timingCounterResultSource forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Parameter (TimingCounter a)
m

instance {-# OVERLAPPING #-} (ResultItemable (ResultValue a),
                              ResultItemable (ResultValue (TimingStats a)))
                             => ResultProvider (Simulation (TimingCounter a)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Simulation (TimingCounter a)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Simulation (TimingCounter a)
m =
    forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingCounter a) -> ResultSource
timingCounterResultSource forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Simulation (TimingCounter a)
m

instance {-# OVERLAPPING #-} (ResultItemable (ResultValue a),
                              ResultItemable (ResultValue (TimingStats a)))
                             => ResultProvider (Dynamics (TimingCounter a)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Dynamics (TimingCounter a)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Dynamics (TimingCounter a)
m =
    forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingCounter a) -> ResultSource
timingCounterResultSource forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Dynamics (TimingCounter a)
m

instance {-# OVERLAPPING #-} (ResultItemable (ResultValue a),
                              ResultItemable (ResultValue (TimingStats a)))
                             => ResultProvider (Event (TimingCounter a)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Event (TimingCounter a)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Event (TimingCounter a)
m =
    forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingCounter a) -> ResultSource
timingCounterResultSource forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Event (TimingCounter a)
m

instance {-# OVERLAPPING #-} (ResultItemable (ResultValue a),
                              ResultItemable (ResultValue (TimingStats a)))
                             => ResultProvider (Ref (TimingCounter a)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Ref (TimingCounter a)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Ref (TimingCounter a)
m =
    forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingCounter a) -> ResultSource
timingCounterResultSource forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Ref (TimingCounter a)
m

instance {-# OVERLAPPING #-} (ResultItemable (ResultValue a),
                              ResultItemable (ResultValue (TimingStats a)))
                             => ResultProvider (BR.Ref (TimingCounter a)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Ref (TimingCounter a)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Ref (TimingCounter a)
m =
    forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingCounter a) -> ResultSource
timingCounterResultSource forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Ref (TimingCounter a)
m

instance {-# OVERLAPPING #-} (ResultItemable (ResultValue a),
                              ResultItemable (ResultValue (TimingStats a)))
                             => ResultProvider (Var (TimingCounter a)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Var (TimingCounter a)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Var (TimingCounter a)
m =
    forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingCounter a) -> ResultSource
timingCounterResultSource forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Var (TimingCounter a)
m

instance {-# OVERLAPPING #-} (ResultItemable (ResultValue a),
                              ResultItemable (ResultValue (TimingStats a)))
                             => ResultProvider (Signalable (TimingCounter a)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Signalable (TimingCounter a)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Signalable (TimingCounter a)
m =
    forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingCounter a) -> ResultSource
timingCounterResultSource forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Signalable (TimingCounter a)
m

instance ResultProvider p => ResultProvider [p] where

  resultSource' :: ResultName
-> [ResultName] -> ResultId -> [ResultId] -> [p] -> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is [p]
m =
    forall p.
ResultProvider p =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> p -> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is forall a b. (a -> b) -> a -> b
$ forall p. [p] -> [ResultName] -> ResultListWithSubscript p
ResultListWithSubscript [p]
m [ResultName]
subscript where
      subscript :: [ResultName]
subscript = forall a b. (a -> b) -> [a] -> [b]
map forall a b. (a, b) -> b
snd forall a b. (a -> b) -> a -> b
$ forall a b. [a] -> [b] -> [(a, b)]
zip [p]
m forall a b. (a -> b) -> a -> b
$ forall a b. (a -> b) -> [a] -> [b]
map Int -> ResultName
intSubscript [Int
0..]

instance (Show i, Ix i, ResultProvider p) => ResultProvider (A.Array i p) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Array i p
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Array i p
m =
    forall p.
ResultProvider p =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> p -> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is forall a b. (a -> b) -> a -> b
$ forall p. [p] -> [ResultName] -> ResultListWithSubscript p
ResultListWithSubscript [p]
items [ResultName]
subscript where
      items :: [p]
items = forall i e. Array i e -> [e]
A.elems Array i p
m
      subscript :: [ResultName]
subscript = forall a b. (a -> b) -> [a] -> [b]
map (\i
i -> ResultName
"[" forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> ResultName
show i
i forall a. [a] -> [a] -> [a]
++ ResultName
"]") (forall i e. Ix i => Array i e -> [i]
A.indices Array i p
m)

instance ResultProvider p => ResultProvider (V.Vector p) where
  
  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Vector p
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Vector p
m =
    forall p.
ResultProvider p =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> p -> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is forall a b. (a -> b) -> a -> b
$ forall p.
Vector p -> Vector ResultName -> ResultVectorWithSubscript p
ResultVectorWithSubscript Vector p
m Vector ResultName
subscript where
      subscript :: Vector ResultName
subscript = forall a b. (Int -> a -> b) -> Vector a -> Vector b
V.imap (\Int
i p
x -> Int -> ResultName
intSubscript Int
i) Vector p
m

-- | Represents a list with the specified subscript.
data ResultListWithSubscript p =
  ResultListWithSubscript [p] [String]

-- | Represents an array with the specified subscript.
data ResultArrayWithSubscript i p =
  ResultArrayWithSubscript (A.Array i p) (A.Array i String)

-- | Represents a vector with the specified subscript.
data ResultVectorWithSubscript p =
  ResultVectorWithSubscript (V.Vector p) (V.Vector String)

instance ResultProvider p => ResultProvider (ResultListWithSubscript p) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> ResultListWithSubscript p
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is (ResultListWithSubscript [p]
xs [ResultName]
ys) =
    ResultVector -> ResultSource
ResultVectorSource forall a b. (a -> b) -> a -> b
$
    ResultVector -> ResultVector
memoResultVectorSignal forall a b. (a -> b) -> a -> b
$
    ResultVector -> ResultVector
memoResultVectorSummary forall a b. (a -> b) -> a -> b
$
    ResultVector { resultVectorName :: ResultName
resultVectorName = ResultName
name,
                   resultVectorId :: ResultId
resultVectorId = ResultId
i,
                   resultVectorItems :: Array Int ResultSource
resultVectorItems = Array Int ResultSource
axs,
                   resultVectorSubscript :: Array Int ResultName
resultVectorSubscript = Array Int ResultName
ays,
                   resultVectorSignal :: ResultSignal
resultVectorSignal = forall a. HasCallStack => a
undefined,
                   resultVectorSummary :: ResultSource
resultVectorSummary = forall a. HasCallStack => a
undefined }
    where
      bnds :: (Int, Int)
bnds   = (Int
0, forall (t :: * -> *) a. Foldable t => t a -> Int
length [p]
xs forall a. Num a => a -> a -> a
- Int
1)
      axs :: Array Int ResultSource
axs    = forall i e. Ix i => (i, i) -> [e] -> Array i e
A.listArray (Int, Int)
bnds [ResultSource]
items
      ays :: Array Int ResultName
ays    = forall i e. Ix i => (i, i) -> [e] -> Array i e
A.listArray (Int, Int)
bnds [ResultName]
ys
      items :: [ResultSource]
items  =
        forall a b c. (a -> b -> c) -> b -> a -> c
flip forall a b. (a -> b) -> [a] -> [b]
map (forall a b. [a] -> [b] -> [(a, b)]
zip [ResultName]
ys [p]
xs) forall a b. (a -> b) -> a -> b
$ \(ResultName
y, p
x) ->
        let name' :: ResultName
name'  = ResultName
name forall a. [a] -> [a] -> [a]
++ ResultName
y
            names' :: [ResultName]
names' = [ResultName]
names forall a. [a] -> [a] -> [a]
++ [ResultName
y]
            i' :: ResultId
i'  = ResultName -> ResultId
VectorItemId ResultName
y
            is' :: [ResultId]
is' = [ResultId]
is forall a. [a] -> [a] -> [a]
++ [ResultId
i']
        in forall p.
ResultProvider p =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> p -> ResultSource
resultSource' ResultName
name' [ResultName]
names' ResultId
i' [ResultId]
is' p
x
      items' :: [ResultSource]
items' = forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> ResultSource
resultSourceSummary [ResultSource]
items
    
instance (Show i, Ix i, ResultProvider p) => ResultProvider (ResultArrayWithSubscript i p) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> ResultArrayWithSubscript i p
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is (ResultArrayWithSubscript Array i p
xs Array i ResultName
ys) =
    forall p.
ResultProvider p =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> p -> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is forall a b. (a -> b) -> a -> b
$ forall p. [p] -> [ResultName] -> ResultListWithSubscript p
ResultListWithSubscript [p]
items [ResultName]
subscript where
      items :: [p]
items = forall i e. Array i e -> [e]
A.elems Array i p
xs
      subscript :: [ResultName]
subscript = forall i e. Array i e -> [e]
A.elems Array i ResultName
ys

instance ResultProvider p => ResultProvider (ResultVectorWithSubscript p) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> ResultVectorWithSubscript p
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is (ResultVectorWithSubscript Vector p
xs Vector ResultName
ys) =
    ResultVector -> ResultSource
ResultVectorSource forall a b. (a -> b) -> a -> b
$
    ResultVector -> ResultVector
memoResultVectorSignal forall a b. (a -> b) -> a -> b
$
    ResultVector -> ResultVector
memoResultVectorSummary forall a b. (a -> b) -> a -> b
$
    ResultVector { resultVectorName :: ResultName
resultVectorName = ResultName
name,
                   resultVectorId :: ResultId
resultVectorId = ResultId
i,
                   resultVectorItems :: Array Int ResultSource
resultVectorItems = Array Int ResultSource
axs,
                   resultVectorSubscript :: Array Int ResultName
resultVectorSubscript = Array Int ResultName
ays,
                   resultVectorSignal :: ResultSignal
resultVectorSignal = forall a. HasCallStack => a
undefined,
                   resultVectorSummary :: ResultSource
resultVectorSummary = forall a. HasCallStack => a
undefined }
    where
      bnds :: (Int, Int)
bnds   = (Int
0, forall a. Vector a -> Int
V.length Vector p
xs forall a. Num a => a -> a -> a
- Int
1)
      axs :: Array Int ResultSource
axs    = forall i e. Ix i => (i, i) -> [e] -> Array i e
A.listArray (Int, Int)
bnds (forall a. Vector a -> [a]
V.toList Vector ResultSource
items)
      ays :: Array Int ResultName
ays    = forall i e. Ix i => (i, i) -> [e] -> Array i e
A.listArray (Int, Int)
bnds (forall a. Vector a -> [a]
V.toList Vector ResultName
ys)
      items :: Vector ResultSource
items =
        forall a. Int -> (Int -> a) -> Vector a
V.generate (forall a. Vector a -> Int
V.length Vector p
xs) forall a b. (a -> b) -> a -> b
$ \Int
i ->
        let x :: p
x = Vector p
xs forall a. Vector a -> Int -> a
V.! Int
i
            y :: ResultName
y = Vector ResultName
ys forall a. Vector a -> Int -> a
V.! Int
i
            name' :: ResultName
name'  = ResultName
name forall a. [a] -> [a] -> [a]
++ ResultName
y
            names' :: [ResultName]
names' = [ResultName]
names forall a. [a] -> [a] -> [a]
++ [ResultName
y]
            i' :: ResultId
i'  = ResultName -> ResultId
VectorItemId ResultName
y
            is' :: [ResultId]
is' = [ResultId]
is forall a. [a] -> [a] -> [a]
++ [ResultId
i']
        in forall p.
ResultProvider p =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> p -> ResultSource
resultSource' ResultName
name' [ResultName]
names' ResultId
i' [ResultId]
is' p
x
      items' :: Vector ResultSource
items' = forall a b. (a -> b) -> Vector a -> Vector b
V.map ResultSource -> ResultSource
resultSourceSummary Vector ResultSource
items

instance {-# OVERLAPPING #-} (Ix i, Show i, ResultItemable (ResultValue [e])) => ResultProvider (Parameter (A.Array i e)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Parameter (Array i e)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Parameter (Array i e)
m =
    ResultItem -> ResultSource
ResultItemSource forall a b. (a -> b) -> a -> b
$ forall a. ResultItemable a => a -> ResultItem
ResultItem forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall i e. Array i e -> [e]
A.elems forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Parameter (Array i e)
m

instance {-# OVERLAPPING #-} (Ix i, Show i, ResultItemable (ResultValue [e])) => ResultProvider (Simulation (A.Array i e)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Simulation (Array i e)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Simulation (Array i e)
m =
    ResultItem -> ResultSource
ResultItemSource forall a b. (a -> b) -> a -> b
$ forall a. ResultItemable a => a -> ResultItem
ResultItem forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall i e. Array i e -> [e]
A.elems forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Simulation (Array i e)
m

instance {-# OVERLAPPING #-} (Ix i, Show i, ResultItemable (ResultValue [e])) => ResultProvider (Dynamics (A.Array i e)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Dynamics (Array i e)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Dynamics (Array i e)
m =
    ResultItem -> ResultSource
ResultItemSource forall a b. (a -> b) -> a -> b
$ forall a. ResultItemable a => a -> ResultItem
ResultItem forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall i e. Array i e -> [e]
A.elems forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Dynamics (Array i e)
m

instance {-# OVERLAPPING #-} (Ix i, Show i, ResultItemable (ResultValue [e])) => ResultProvider (Event (A.Array i e)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Event (Array i e)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Event (Array i e)
m =
    ResultItem -> ResultSource
ResultItemSource forall a b. (a -> b) -> a -> b
$ forall a. ResultItemable a => a -> ResultItem
ResultItem forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall i e. Array i e -> [e]
A.elems forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Event (Array i e)
m

instance {-# OVERLAPPING #-} (Ix i, Show i, ResultItemable (ResultValue [e])) => ResultProvider (Ref (A.Array i e)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Ref (Array i e)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Ref (Array i e)
m =
    ResultItem -> ResultSource
ResultItemSource forall a b. (a -> b) -> a -> b
$ forall a. ResultItemable a => a -> ResultItem
ResultItem forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall i e. Array i e -> [e]
A.elems forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Ref (Array i e)
m

instance {-# OVERLAPPING #-} (Ix i, Show i, ResultItemable (ResultValue [e])) => ResultProvider (BR.Ref (A.Array i e)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Ref (Array i e)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Ref (Array i e)
m =
    ResultItem -> ResultSource
ResultItemSource forall a b. (a -> b) -> a -> b
$ forall a. ResultItemable a => a -> ResultItem
ResultItem forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall i e. Array i e -> [e]
A.elems forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Ref (Array i e)
m

instance {-# OVERLAPPING #-} (Ix i, Show i, ResultItemable (ResultValue [e])) => ResultProvider (Var (A.Array i e)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Var (Array i e)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Var (Array i e)
m =
    ResultItem -> ResultSource
ResultItemSource forall a b. (a -> b) -> a -> b
$ forall a. ResultItemable a => a -> ResultItem
ResultItem forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall i e. Array i e -> [e]
A.elems forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Var (Array i e)
m

instance {-# OVERLAPPING #-} (Ix i, Show i, ResultItemable (ResultValue [e])) => ResultProvider (Signalable (A.Array i e)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Signalable (Array i e)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Signalable (Array i e)
m =
    ResultItem -> ResultSource
ResultItemSource forall a b. (a -> b) -> a -> b
$ forall a. ResultItemable a => a -> ResultItem
ResultItem forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall i e. Array i e -> [e]
A.elems forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Signalable (Array i e)
m

instance {-# OVERLAPPING #-} ResultItemable (ResultValue [e]) => ResultProvider (Parameter (V.Vector e)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Parameter (Vector e)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Parameter (Vector e)
m =
    ResultItem -> ResultSource
ResultItemSource forall a b. (a -> b) -> a -> b
$ forall a. ResultItemable a => a -> ResultItem
ResultItem forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Vector a -> [a]
V.toList forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Parameter (Vector e)
m

instance {-# OVERLAPPING #-} ResultItemable (ResultValue [e]) => ResultProvider (Simulation (V.Vector e)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Simulation (Vector e)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Simulation (Vector e)
m =
    ResultItem -> ResultSource
ResultItemSource forall a b. (a -> b) -> a -> b
$ forall a. ResultItemable a => a -> ResultItem
ResultItem forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Vector a -> [a]
V.toList forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Simulation (Vector e)
m

instance {-# OVERLAPPING #-} ResultItemable (ResultValue [e]) => ResultProvider (Dynamics (V.Vector e)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Dynamics (Vector e)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Dynamics (Vector e)
m =
    ResultItem -> ResultSource
ResultItemSource forall a b. (a -> b) -> a -> b
$ forall a. ResultItemable a => a -> ResultItem
ResultItem forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Vector a -> [a]
V.toList forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Dynamics (Vector e)
m

instance {-# OVERLAPPING #-} ResultItemable (ResultValue [e]) => ResultProvider (Event (V.Vector e)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Event (Vector e)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Event (Vector e)
m =
    ResultItem -> ResultSource
ResultItemSource forall a b. (a -> b) -> a -> b
$ forall a. ResultItemable a => a -> ResultItem
ResultItem forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Vector a -> [a]
V.toList forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Event (Vector e)
m

instance {-# OVERLAPPING #-} ResultItemable (ResultValue [e]) => ResultProvider (Ref (V.Vector e)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Ref (Vector e)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Ref (Vector e)
m =
    ResultItem -> ResultSource
ResultItemSource forall a b. (a -> b) -> a -> b
$ forall a. ResultItemable a => a -> ResultItem
ResultItem forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Vector a -> [a]
V.toList forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Ref (Vector e)
m

instance {-# OVERLAPPING #-} ResultItemable (ResultValue [e]) => ResultProvider (BR.Ref (V.Vector e)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Ref (Vector e)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Ref (Vector e)
m =
    ResultItem -> ResultSource
ResultItemSource forall a b. (a -> b) -> a -> b
$ forall a. ResultItemable a => a -> ResultItem
ResultItem forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Vector a -> [a]
V.toList forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Ref (Vector e)
m

instance {-# OVERLAPPING #-} ResultItemable (ResultValue [e]) => ResultProvider (Var (V.Vector e)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Var (Vector e)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Var (Vector e)
m =
    ResultItem -> ResultSource
ResultItemSource forall a b. (a -> b) -> a -> b
$ forall a. ResultItemable a => a -> ResultItem
ResultItem forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Vector a -> [a]
V.toList forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Var (Vector e)
m

instance {-# OVERLAPPING #-} ResultItemable (ResultValue [e]) => ResultProvider (Signalable (V.Vector e)) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Signalable (Vector e)
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Signalable (Vector e)
m =
    ResultItem -> ResultSource
ResultItemSource forall a b. (a -> b) -> a -> b
$ forall a. ResultItemable a => a -> ResultItem
ResultItem forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Vector a -> [a]
V.toList forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
ResultComputing m =>
ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is Signalable (Vector e)
m

instance (Show si, Show sm, Show so,
          ResultItemable (ResultValue si),
          ResultItemable (ResultValue sm),
          ResultItemable (ResultValue so))
         => ResultProvider (Q.Queue si sm so a) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Queue si sm so a
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Queue si sm so a
m =
    forall si sm so a.
(Show si, Show sm, Show so, ResultItemable (ResultValue si),
 ResultItemable (ResultValue sm),
 ResultItemable (ResultValue so)) =>
ResultContainer (Queue si sm so a) -> ResultSource
queueResultSource forall a b. (a -> b) -> a -> b
$ forall e.
ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> e
-> ResultSignal
-> ResultContainer e
ResultContainer ResultName
name [ResultName]
names ResultId
i [ResultId]
is Queue si sm so a
m (Signal () -> ResultSignal
ResultSignal forall a b. (a -> b) -> a -> b
$ forall si sm so a. Queue si sm so a -> Signal ()
Q.queueChanged_ Queue si sm so a
m)

instance (Show sm, Show so,
          ResultItemable (ResultValue sm),
          ResultItemable (ResultValue so))
         => ResultProvider (IQ.Queue sm so a) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Queue sm so a
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Queue sm so a
m =
    forall sm so a.
(Show sm, Show so, ResultItemable (ResultValue sm),
 ResultItemable (ResultValue so)) =>
ResultContainer (Queue sm so a) -> ResultSource
infiniteQueueResultSource forall a b. (a -> b) -> a -> b
$ forall e.
ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> e
-> ResultSignal
-> ResultContainer e
ResultContainer ResultName
name [ResultName]
names ResultId
i [ResultId]
is Queue sm so a
m (Signal () -> ResultSignal
ResultSignal forall a b. (a -> b) -> a -> b
$ forall sm so a. Queue sm so a -> Signal ()
IQ.queueChanged_ Queue sm so a
m)

instance ResultProvider ArrivalTimer where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> ArrivalTimer
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is ArrivalTimer
m =
    ResultContainer ArrivalTimer -> ResultSource
arrivalTimerResultSource forall a b. (a -> b) -> a -> b
$ forall e.
ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> e
-> ResultSignal
-> ResultContainer e
ResultContainer ResultName
name [ResultName]
names ResultId
i [ResultId]
is ArrivalTimer
m (Signal () -> ResultSignal
ResultSignal forall a b. (a -> b) -> a -> b
$ ArrivalTimer -> Signal ()
arrivalProcessingTimeChanged_ ArrivalTimer
m)

instance (Show s, ResultItemable (ResultValue s)) => ResultProvider (Server s a b) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Server s a b
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Server s a b
m =
    forall s a b.
(Show s, ResultItemable (ResultValue s)) =>
ResultContainer (Server s a b) -> ResultSource
serverResultSource forall a b. (a -> b) -> a -> b
$ forall e.
ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> e
-> ResultSignal
-> ResultContainer e
ResultContainer ResultName
name [ResultName]
names ResultId
i [ResultId]
is Server s a b
m (Signal () -> ResultSignal
ResultSignal forall a b. (a -> b) -> a -> b
$ forall s a b. Server s a b -> Signal ()
serverChanged_ Server s a b
m)

instance (Show s, ResultItemable (ResultValue s)) => ResultProvider (Activity s a b) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Activity s a b
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Activity s a b
m =
    forall s a b.
(Show s, ResultItemable (ResultValue s)) =>
ResultContainer (Activity s a b) -> ResultSource
activityResultSource forall a b. (a -> b) -> a -> b
$ forall e.
ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> e
-> ResultSignal
-> ResultContainer e
ResultContainer ResultName
name [ResultName]
names ResultId
i [ResultId]
is Activity s a b
m (Signal () -> ResultSignal
ResultSignal forall a b. (a -> b) -> a -> b
$ forall s a b. Activity s a b -> Signal ()
activityChanged_ Activity s a b
m)

instance (Show s, ResultItemable (ResultValue s)) => ResultProvider (Resource s) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Resource s
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Resource s
m =
    forall s.
(Show s, ResultItemable (ResultValue s)) =>
ResultContainer (Resource s) -> ResultSource
resourceResultSource forall a b. (a -> b) -> a -> b
$ forall e.
ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> e
-> ResultSignal
-> ResultContainer e
ResultContainer ResultName
name [ResultName]
names ResultId
i [ResultId]
is Resource s
m (Signal () -> ResultSignal
ResultSignal forall a b. (a -> b) -> a -> b
$ forall s. Resource s -> Signal ()
resourceChanged_ Resource s
m)

instance ResultProvider PR.Resource where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Resource
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Resource
m =
    ResultContainer Resource -> ResultSource
preemptibleResourceResultSource forall a b. (a -> b) -> a -> b
$ forall e.
ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> e
-> ResultSignal
-> ResultContainer e
ResultContainer ResultName
name [ResultName]
names ResultId
i [ResultId]
is Resource
m (Signal () -> ResultSignal
ResultSignal forall a b. (a -> b) -> a -> b
$ Resource -> Signal ()
PR.resourceChanged_ Resource
m)

instance ResultProvider (Operation a b) where

  resultSource' :: ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> Operation a b
-> ResultSource
resultSource' ResultName
name [ResultName]
names ResultId
i [ResultId]
is Operation a b
m =
    forall a b. ResultContainer (Operation a b) -> ResultSource
operationResultSource forall a b. (a -> b) -> a -> b
$ forall e.
ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> e
-> ResultSignal
-> ResultContainer e
ResultContainer ResultName
name [ResultName]
names ResultId
i [ResultId]
is Operation a b
m (Signal () -> ResultSignal
ResultSignal forall a b. (a -> b) -> a -> b
$ forall a b. Operation a b -> Signal ()
operationChanged_ Operation a b
m)