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

-- |
-- 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 = ResultName
-> [ResultName] -> ResultId -> [ResultId] -> p -> ResultSource
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 (UserDefinedResult -> ResultId) -> UserDefinedResult -> ResultId
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 = ResultName
-> [ResultName] -> ResultId -> [ResultId] -> p -> ResultSource
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 (UserDefinedResult -> ResultId) -> UserDefinedResult -> ResultId
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 :: a -> Maybe (ResultValue (Either Int (SamplingStats Int)))
resultItemAsIntStatsEitherValue a
x =
  case Maybe (ResultValue Int)
x1 of
    Just ResultValue Int
a1 -> ResultValue (Either Int (SamplingStats Int))
-> Maybe (ResultValue (Either Int (SamplingStats Int)))
forall a. a -> Maybe a
Just (ResultValue (Either Int (SamplingStats Int))
 -> Maybe (ResultValue (Either Int (SamplingStats Int))))
-> ResultValue (Either Int (SamplingStats Int))
-> Maybe (ResultValue (Either Int (SamplingStats Int)))
forall a b. (a -> b) -> a -> b
$ (Int -> Either Int (SamplingStats Int))
-> ResultValue Int -> ResultValue (Either Int (SamplingStats Int))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Int -> Either Int (SamplingStats Int)
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 -> ResultValue (Either Int (SamplingStats Int))
-> Maybe (ResultValue (Either Int (SamplingStats Int)))
forall a. a -> Maybe a
Just (ResultValue (Either Int (SamplingStats Int))
 -> Maybe (ResultValue (Either Int (SamplingStats Int))))
-> ResultValue (Either Int (SamplingStats Int))
-> Maybe (ResultValue (Either Int (SamplingStats Int)))
forall a b. (a -> b) -> a -> b
$ (SamplingStats Int -> Either Int (SamplingStats Int))
-> ResultValue (SamplingStats Int)
-> ResultValue (Either Int (SamplingStats Int))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap SamplingStats Int -> Either Int (SamplingStats Int)
forall a b. b -> Either a b
Right ResultValue (SamplingStats Int)
a2
        Maybe (ResultValue (SamplingStats Int))
Nothing -> Maybe (ResultValue (Either Int (SamplingStats Int)))
forall a. Maybe a
Nothing
  where
    x1 :: Maybe (ResultValue Int)
x1 = a -> Maybe (ResultValue Int)
forall a. ResultItemable a => a -> Maybe (ResultValue Int)
resultItemAsIntValue a
x
    x2 :: Maybe (ResultValue (SamplingStats Int))
x2 = a -> Maybe (ResultValue (SamplingStats Int))
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 :: a -> Maybe (ResultValue (Either Double (SamplingStats Double)))
resultItemAsDoubleStatsEitherValue a
x =
  case Maybe (ResultValue Double)
x1 of
    Just ResultValue Double
a1 -> ResultValue (Either Double (SamplingStats Double))
-> Maybe (ResultValue (Either Double (SamplingStats Double)))
forall a. a -> Maybe a
Just (ResultValue (Either Double (SamplingStats Double))
 -> Maybe (ResultValue (Either Double (SamplingStats Double))))
-> ResultValue (Either Double (SamplingStats Double))
-> Maybe (ResultValue (Either Double (SamplingStats Double)))
forall a b. (a -> b) -> a -> b
$ (Double -> Either Double (SamplingStats Double))
-> ResultValue Double
-> ResultValue (Either Double (SamplingStats Double))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Double -> Either Double (SamplingStats Double)
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 -> ResultValue (Either Double (SamplingStats Double))
-> Maybe (ResultValue (Either Double (SamplingStats Double)))
forall a. a -> Maybe a
Just (ResultValue (Either Double (SamplingStats Double))
 -> Maybe (ResultValue (Either Double (SamplingStats Double))))
-> ResultValue (Either Double (SamplingStats Double))
-> Maybe (ResultValue (Either Double (SamplingStats Double)))
forall a b. (a -> b) -> a -> b
$ (SamplingStats Double -> Either Double (SamplingStats Double))
-> ResultValue (SamplingStats Double)
-> ResultValue (Either Double (SamplingStats Double))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap SamplingStats Double -> Either Double (SamplingStats Double)
forall a b. b -> Either a b
Right ResultValue (SamplingStats Double)
a2
        Maybe (ResultValue (SamplingStats Double))
Nothing -> Maybe (ResultValue (Either Double (SamplingStats Double)))
forall a. Maybe a
Nothing
  where
    x1 :: Maybe (ResultValue Double)
x1 = a -> Maybe (ResultValue Double)
forall a. ResultItemable a => a -> Maybe (ResultValue Double)
resultItemAsDoubleValue a
x
    x2 :: Maybe (ResultValue (SamplingStats Double))
x2 = a -> Maybe (ResultValue (SamplingStats Double))
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 :: a -> ResultValue Int
resultItemToIntValue a
x =
  case a -> Maybe (ResultValue Int)
forall a. ResultItemable a => a -> Maybe (ResultValue Int)
resultItemAsIntValue a
x of
    Just ResultValue Int
a -> ResultValue Int
a
    Maybe (ResultValue Int)
Nothing ->
      ResultName -> ResultValue Int
forall a. HasCallStack => ResultName -> a
error (ResultName -> ResultValue Int) -> ResultName -> ResultValue Int
forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ a -> ResultName
forall a. ResultItemable a => a -> ResultName
resultItemName a
x ResultName -> ResultName -> ResultName
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 :: a -> ResultValue [Int]
resultItemToIntListValue a
x =
  case a -> Maybe (ResultValue [Int])
forall a. ResultItemable a => a -> Maybe (ResultValue [Int])
resultItemAsIntListValue a
x of
    Just ResultValue [Int]
a -> ResultValue [Int]
a
    Maybe (ResultValue [Int])
Nothing ->
      ResultName -> ResultValue [Int]
forall a. HasCallStack => ResultName -> a
error (ResultName -> ResultValue [Int])
-> ResultName -> ResultValue [Int]
forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ a -> ResultName
forall a. ResultItemable a => a -> ResultName
resultItemName a
x ResultName -> ResultName -> ResultName
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 :: a -> ResultValue (SamplingStats Int)
resultItemToIntStatsValue a
x =
  case a -> Maybe (ResultValue (SamplingStats Int))
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 ->
      ResultName -> ResultValue (SamplingStats Int)
forall a. HasCallStack => ResultName -> a
error (ResultName -> ResultValue (SamplingStats Int))
-> ResultName -> ResultValue (SamplingStats Int)
forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ a -> ResultName
forall a. ResultItemable a => a -> ResultName
resultItemName a
x ResultName -> ResultName -> ResultName
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 :: a -> ResultValue (Either Int (SamplingStats Int))
resultItemToIntStatsEitherValue a
x =
  case a -> Maybe (ResultValue (Either Int (SamplingStats Int)))
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 ->
      ResultName -> ResultValue (Either Int (SamplingStats Int))
forall a. HasCallStack => ResultName -> a
error (ResultName -> ResultValue (Either Int (SamplingStats Int)))
-> ResultName -> ResultValue (Either Int (SamplingStats Int))
forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ a -> ResultName
forall a. ResultItemable a => a -> ResultName
resultItemName a
x ResultName -> ResultName -> ResultName
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 :: a -> ResultValue (TimingStats Int)
resultItemToIntTimingStatsValue a
x =
  case a -> Maybe (ResultValue (TimingStats Int))
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 ->
      ResultName -> ResultValue (TimingStats Int)
forall a. HasCallStack => ResultName -> a
error (ResultName -> ResultValue (TimingStats Int))
-> ResultName -> ResultValue (TimingStats Int)
forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ a -> ResultName
forall a. ResultItemable a => a -> ResultName
resultItemName a
x ResultName -> ResultName -> ResultName
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 :: a -> ResultValue Double
resultItemToDoubleValue a
x =
  case a -> Maybe (ResultValue Double)
forall a. ResultItemable a => a -> Maybe (ResultValue Double)
resultItemAsDoubleValue a
x of
    Just ResultValue Double
a -> ResultValue Double
a
    Maybe (ResultValue Double)
Nothing ->
      ResultName -> ResultValue Double
forall a. HasCallStack => ResultName -> a
error (ResultName -> ResultValue Double)
-> ResultName -> ResultValue Double
forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ a -> ResultName
forall a. ResultItemable a => a -> ResultName
resultItemName a
x ResultName -> ResultName -> ResultName
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 :: a -> ResultValue [Double]
resultItemToDoubleListValue a
x =
  case a -> Maybe (ResultValue [Double])
forall a. ResultItemable a => a -> Maybe (ResultValue [Double])
resultItemAsDoubleListValue a
x of
    Just ResultValue [Double]
a -> ResultValue [Double]
a
    Maybe (ResultValue [Double])
Nothing ->
      ResultName -> ResultValue [Double]
forall a. HasCallStack => ResultName -> a
error (ResultName -> ResultValue [Double])
-> ResultName -> ResultValue [Double]
forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ a -> ResultName
forall a. ResultItemable a => a -> ResultName
resultItemName a
x ResultName -> ResultName -> ResultName
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 :: a -> ResultValue (SamplingStats Double)
resultItemToDoubleStatsValue a
x =
  case a -> Maybe (ResultValue (SamplingStats Double))
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 ->
      ResultName -> ResultValue (SamplingStats Double)
forall a. HasCallStack => ResultName -> a
error (ResultName -> ResultValue (SamplingStats Double))
-> ResultName -> ResultValue (SamplingStats Double)
forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ a -> ResultName
forall a. ResultItemable a => a -> ResultName
resultItemName a
x ResultName -> ResultName -> ResultName
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 :: a -> ResultValue (Either Double (SamplingStats Double))
resultItemToDoubleStatsEitherValue a
x =
  case a -> Maybe (ResultValue (Either Double (SamplingStats Double)))
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 ->
      ResultName -> ResultValue (Either Double (SamplingStats Double))
forall a. HasCallStack => ResultName -> a
error (ResultName -> ResultValue (Either Double (SamplingStats Double)))
-> ResultName -> ResultValue (Either Double (SamplingStats Double))
forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ a -> ResultName
forall a. ResultItemable a => a -> ResultName
resultItemName a
x ResultName -> ResultName -> ResultName
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 :: a -> ResultValue (TimingStats Double)
resultItemToDoubleTimingStatsValue a
x =
  case a -> Maybe (ResultValue (TimingStats Double))
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 ->
      ResultName -> ResultValue (TimingStats Double)
forall a. HasCallStack => ResultName -> a
error (ResultName -> ResultValue (TimingStats Double))
-> ResultName -> ResultValue (TimingStats Double)
forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ a -> ResultName
forall a. ResultItemable a => a -> ResultName
resultItemName a
x ResultName -> ResultName -> ResultName
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 :: a -> ResultValue ResultName
resultItemToStringValue a
x =
  case a -> Maybe (ResultValue ResultName)
forall a. ResultItemable a => a -> Maybe (ResultValue ResultName)
resultItemAsStringValue a
x of
    Just ResultValue ResultName
a -> ResultValue ResultName
a
    Maybe (ResultValue ResultName)
Nothing ->
      ResultName -> ResultValue ResultName
forall a. HasCallStack => ResultName -> a
error (ResultName -> ResultValue ResultName)
-> ResultName -> ResultValue ResultName
forall a b. (a -> b) -> a -> b
$
      ResultName
"Cannot represent " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ a -> ResultName
forall a. ResultItemable a => a -> ResultName
resultItemName a
x ResultName -> ResultName -> ResultName
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 =
         (ResultSignal -> ResultSignal -> ResultSignal)
-> ResultSignal -> [ResultSignal] -> ResultSignal
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr ResultSignal -> ResultSignal -> ResultSignal
forall a. Semigroup a => a -> a -> a
(<>) ResultSignal
forall a. Monoid a => a
mempty ([ResultSignal] -> ResultSignal) -> [ResultSignal] -> ResultSignal
forall a b. (a -> b) -> a -> b
$ (ResultSource -> ResultSignal) -> [ResultSource] -> [ResultSignal]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> ResultSignal
resultSourceSignal ([ResultSource] -> [ResultSignal])
-> [ResultSource] -> [ResultSignal]
forall a b. (a -> b) -> a -> b
$ Array Int ResultSource -> [ResultSource]
forall i e. Array i e -> [e]
A.elems (Array Int ResultSource -> [ResultSource])
-> Array Int ResultSource -> [ResultSource]
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 (ResultVector -> ResultSource) -> ResultVector -> ResultSource
forall a b. (a -> b) -> a -> b
$
         ResultVector
x { resultVectorItems :: Array Int ResultSource
resultVectorItems =
                (Int, Int) -> [(Int, ResultSource)] -> Array Int ResultSource
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 = Array Int ResultSource -> (Int, Int)
forall i e. Array i e -> (i, i)
A.bounds Array Int ResultSource
arr
    ies :: [(Int, ResultSource)]
ies  = Array Int ResultSource -> [(Int, ResultSource)]
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 { ResultValue e -> ResultName
resultValueName :: ResultName,
                -- ^ The value name.
                ResultValue e -> [ResultName]
resultValueNamePath :: [ResultName],
                -- ^ The value name path.
                ResultValue e -> ResultId
resultValueId :: ResultId,
                -- ^ The value identifier.
                ResultValue e -> [ResultId]
resultValueIdPath :: [ResultId],
                -- ^ The value identifier path.
                ResultValue e -> ResultData e
resultValueData :: ResultData e,
                -- ^ Simulation data supplied by the value.
                ResultValue e -> ResultSignal
resultValueSignal :: ResultSignal
                -- ^ Whether the value emits a signal when changing simulation data.
              }

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

-- | Transform the result value.
apResultValue :: ResultData (a -> b) -> ResultValue a -> ResultValue b
apResultValue :: ResultData (a -> b) -> ResultValue a -> ResultValue b
apResultValue ResultData (a -> b)
f ResultValue a
x = ResultValue a
x { resultValueData :: ResultData b
resultValueData = ResultData (a -> b) -> Event a -> ResultData b
forall (m :: * -> *) a b. Monad m => m (a -> b) -> m a -> m b
ap ResultData (a -> b)
f (ResultValue a -> Event a
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 { ResultContainer e -> ResultName
resultContainerName :: ResultName,
                    -- ^ The container name.
                    ResultContainer e -> [ResultName]
resultContainerNamePath :: [ResultName],
                    -- ^ The container name path.
                    ResultContainer e -> ResultId
resultContainerId :: ResultId,
                    -- ^ The container identifier.
                    ResultContainer e -> [ResultId]
resultContainerIdPath :: [ResultId],
                    -- ^ The container identifier path.
                    ResultContainer e -> e
resultContainerData :: e,
                    -- ^ The container data.
                    ResultContainer e -> ResultSignal
resultContainerSignal :: ResultSignal
                    -- ^ Whether the container emits a signal when changing simulation data.
                  }

instance Functor ResultContainer where
  fmap :: (a -> b) -> ResultContainer a -> ResultContainer b
fmap a -> b
f ResultContainer a
x = ResultContainer a
x { resultContainerData :: b
resultContainerData = a -> b
f (ResultContainer a -> a
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 :: 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 (ResultItem -> ResultSource) -> ResultItem -> ResultSource
forall a b. (a -> b) -> a -> b
$
  ResultValue b -> ResultItem
forall a. ResultItemable a => a -> ResultItem
ResultItem (ResultValue b -> ResultItem) -> ResultValue b -> ResultItem
forall a b. (a -> b) -> a -> b
$
  ResultValue :: forall e.
ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> ResultData e
-> ResultSignal
-> ResultValue e
ResultValue {
    resultValueName :: ResultName
resultValueName   = (ResultContainer a -> ResultName
forall e. ResultContainer e -> ResultName
resultContainerName ResultContainer a
cont) ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultName
"." ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultName
name,
    resultValueNamePath :: [ResultName]
resultValueNamePath = (ResultContainer a -> [ResultName]
forall e. ResultContainer e -> [ResultName]
resultContainerNamePath ResultContainer a
cont) [ResultName] -> [ResultName] -> [ResultName]
forall a. [a] -> [a] -> [a]
++ [ResultName
name],
    resultValueId :: ResultId
resultValueId     = ResultId
i,
    resultValueIdPath :: [ResultId]
resultValueIdPath = (ResultContainer a -> [ResultId]
forall e. ResultContainer e -> [ResultId]
resultContainerIdPath ResultContainer a
cont) [ResultId] -> [ResultId] -> [ResultId]
forall a. [a] -> [a] -> [a]
++ [ResultId
i],
    resultValueData :: ResultData b
resultValueData   = a -> ResultData b
f (ResultContainer a -> a
forall e. ResultContainer e -> e
resultContainerData ResultContainer a
cont),
    resultValueSignal :: ResultSignal
resultValueSignal = a -> ResultSignal
g (ResultContainer a -> a
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 :: ResultContainer a
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerConstProperty ResultContainer a
cont ResultName
name ResultId
i a -> b
f =
  ResultProperty :: ResultName -> ResultId -> ResultSource -> ResultProperty
ResultProperty {
    resultPropertyLabel :: ResultName
resultPropertyLabel = ResultName
name,
    resultPropertyId :: ResultId
resultPropertyId = ResultId
i,
    resultPropertySource :: ResultSource
resultPropertySource =
      ResultContainer a
-> ResultName
-> ResultId
-> (a -> ResultData b)
-> (a -> ResultSignal)
-> ResultSource
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> ResultData b)
-> (a -> ResultSignal)
-> ResultSource
resultContainerPropertySource ResultContainer a
cont ResultName
name ResultId
i (b -> ResultData b
forall (m :: * -> *) a. Monad m => a -> m a
return (b -> ResultData b) -> (a -> b) -> a -> ResultData b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> b
f) (ResultSignal -> a -> ResultSignal
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 :: ResultContainer a
-> ResultName -> ResultId -> (a -> Event b) -> ResultProperty
resultContainerIntegProperty ResultContainer a
cont ResultName
name ResultId
i a -> Event b
f =
  ResultProperty :: ResultName -> ResultId -> ResultSource -> ResultProperty
ResultProperty {
    resultPropertyLabel :: ResultName
resultPropertyLabel = ResultName
name,
    resultPropertyId :: ResultId
resultPropertyId = ResultId
i,
    resultPropertySource :: ResultSource
resultPropertySource =
      ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> ResultSignal)
-> ResultSource
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 (ResultSignal -> a -> ResultSignal
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 :: 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 :: ResultName -> ResultId -> ResultSource -> ResultProperty
ResultProperty {
    resultPropertyLabel :: ResultName
resultPropertyLabel = ResultName
name,
    resultPropertyId :: ResultId
resultPropertyId = ResultId
i,
    resultPropertySource :: ResultSource
resultPropertySource =
      ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> ResultSignal)
-> ResultSource
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 (Signal () -> ResultSignal)
-> (a -> Signal ()) -> a -> 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 :: ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData a)
cont ResultName
name ResultId
i a -> b
f =                     
  ResultProperty :: ResultName -> ResultId -> ResultSource -> ResultProperty
ResultProperty {
    resultPropertyLabel :: ResultName
resultPropertyLabel = ResultName
name,
    resultPropertyId :: ResultId
resultPropertyId = ResultId
i,
    resultPropertySource :: ResultSource
resultPropertySource =
      ResultContainer (ResultData a)
-> ResultName
-> ResultId
-> (ResultData a -> ResultData b)
-> (ResultData a -> ResultSignal)
-> ResultSource
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 ((a -> b) -> ResultData a -> ResultData b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> b
f) (ResultSignal -> ResultData a -> ResultSignal
forall a b. a -> b -> a
const (ResultSignal -> ResultData a -> ResultSignal)
-> ResultSignal -> ResultData a -> ResultSignal
forall a b. (a -> b) -> a -> b
$ ResultContainer (ResultData a) -> ResultSignal
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 :: ResultValue a -> ResultContainer (ResultData a)
resultValueToContainer ResultValue a
x =
  ResultContainer :: forall e.
ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> e
-> ResultSignal
-> ResultContainer e
ResultContainer {
    resultContainerName :: ResultName
resultContainerName   = ResultValue a -> ResultName
forall e. ResultValue e -> ResultName
resultValueName ResultValue a
x,
    resultContainerNamePath :: [ResultName]
resultContainerNamePath = ResultValue a -> [ResultName]
forall e. ResultValue e -> [ResultName]
resultValueNamePath ResultValue a
x,
    resultContainerId :: ResultId
resultContainerId     = ResultValue a -> ResultId
forall e. ResultValue e -> ResultId
resultValueId ResultValue a
x,
    resultContainerIdPath :: [ResultId]
resultContainerIdPath = ResultValue a -> [ResultId]
forall e. ResultValue e -> [ResultId]
resultValueIdPath ResultValue a
x,
    resultContainerData :: ResultData a
resultContainerData   = ResultValue a -> ResultData a
forall e. ResultValue e -> ResultData e
resultValueData ResultValue a
x,
    resultContainerSignal :: ResultSignal
resultContainerSignal = ResultValue a -> ResultSignal
forall e. ResultValue e -> ResultSignal
resultValueSignal ResultValue a
x }

-- | Convert the result container to a value.
resultContainerToValue :: ResultContainer (ResultData a) -> ResultValue a
resultContainerToValue :: ResultContainer (ResultData a) -> ResultValue a
resultContainerToValue ResultContainer (ResultData a)
x =
  ResultValue :: forall e.
ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> ResultData e
-> ResultSignal
-> ResultValue e
ResultValue {
    resultValueName :: ResultName
resultValueName   = ResultContainer (ResultData a) -> ResultName
forall e. ResultContainer e -> ResultName
resultContainerName ResultContainer (ResultData a)
x,
    resultValueNamePath :: [ResultName]
resultValueNamePath = ResultContainer (ResultData a) -> [ResultName]
forall e. ResultContainer e -> [ResultName]
resultContainerNamePath ResultContainer (ResultData a)
x,
    resultValueId :: ResultId
resultValueId     = ResultContainer (ResultData a) -> ResultId
forall e. ResultContainer e -> ResultId
resultContainerId ResultContainer (ResultData a)
x,
    resultValueIdPath :: [ResultId]
resultValueIdPath = ResultContainer (ResultData a) -> [ResultId]
forall e. ResultContainer e -> [ResultId]
resultContainerIdPath ResultContainer (ResultData a)
x,
    resultValueData :: ResultData a
resultValueData   = ResultContainer (ResultData a) -> ResultData a
forall e. ResultContainer e -> e
resultContainerData ResultContainer (ResultData a)
x,
    resultValueSignal :: ResultSignal
resultValueSignal = ResultContainer (ResultData a) -> ResultSignal
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 :: ResultData (TimingStats a -> SamplingStats a)
normTimingStatsData =
  do Int
n <- Dynamics Int -> Event Int
forall (m :: * -> *) a. DynamicsLift m => Dynamics a -> m a
liftDynamics Dynamics Int
integIteration
     (TimingStats a -> SamplingStats a)
-> ResultData (TimingStats a -> SamplingStats a)
forall (m :: * -> *) a. Monad m => a -> m a
return ((TimingStats a -> SamplingStats a)
 -> ResultData (TimingStats a -> SamplingStats a))
-> (TimingStats a -> SamplingStats a)
-> ResultData (TimingStats a -> SamplingStats a)
forall a b. (a -> b) -> a -> b
$ Int -> TimingStats a -> SamplingStats a
forall a. TimingData a => Int -> TimingStats a -> SamplingStats a
normTimingStats (Int -> Int
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 Signal () -> Signal () -> Signal ()
forall a. Semigroup a => a -> a -> a
<> Signal ()
y)
  (<>) (ResultSignal Signal ()
x) (ResultSignalMix Signal ()
y) = Signal () -> ResultSignal
ResultSignalMix (Signal ()
x Signal () -> Signal () -> Signal ()
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 Signal () -> Signal () -> Signal ()
forall a. Semigroup a => a -> a -> a
<> Signal ()
y)
  (<>) (ResultSignalMix Signal ()
x) (ResultSignalMix Signal ()
y) = Signal () -> ResultSignal
ResultSignalMix (Signal ()
x Signal () -> Signal () -> Signal ()
forall a. Semigroup a => a -> a -> a
<> Signal ()
y)

instance Monoid ResultSignal where

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

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

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

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

instance ResultItemable (ResultValue Double) where

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

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

instance ResultItemable (ResultValue [Int]) where

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

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

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

instance ResultItemable (ResultValue [Double]) where

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

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

instance ResultItemable (ResultValue (SamplingStats Int)) where

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

  resultItemAsDoubleValue :: ResultValue (SamplingStats Int) -> Maybe (ResultValue Double)
resultItemAsDoubleValue = Maybe (ResultValue Double)
-> ResultValue (SamplingStats Int) -> Maybe (ResultValue Double)
forall a b. a -> b -> a
const Maybe (ResultValue Double)
forall a. Maybe a
Nothing
  resultItemAsDoubleListValue :: ResultValue (SamplingStats Int) -> Maybe (ResultValue [Double])
resultItemAsDoubleListValue = Maybe (ResultValue [Double])
-> ResultValue (SamplingStats Int) -> Maybe (ResultValue [Double])
forall a b. a -> b -> a
const Maybe (ResultValue [Double])
forall a. Maybe a
Nothing
  resultItemAsDoubleStatsValue :: ResultValue (SamplingStats Int)
-> Maybe (ResultValue (SamplingStats Double))
resultItemAsDoubleStatsValue = ResultValue (SamplingStats Double)
-> Maybe (ResultValue (SamplingStats Double))
forall a. a -> Maybe a
Just (ResultValue (SamplingStats Double)
 -> Maybe (ResultValue (SamplingStats Double)))
-> (ResultValue (SamplingStats Int)
    -> ResultValue (SamplingStats Double))
-> ResultValue (SamplingStats Int)
-> Maybe (ResultValue (SamplingStats Double))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (SamplingStats Int -> SamplingStats Double)
-> ResultValue (SamplingStats Int)
-> ResultValue (SamplingStats Double)
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 = Maybe (ResultValue (TimingStats Double))
-> ResultValue (SamplingStats Int)
-> Maybe (ResultValue (TimingStats Double))
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Double))
forall a. Maybe a
Nothing

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

instance ResultItemable (ResultValue (SamplingStats Double)) where

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

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

instance ResultItemable (ResultValue (TimingStats Int)) where

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

  resultItemAsDoubleValue :: ResultValue (TimingStats Int) -> Maybe (ResultValue Double)
resultItemAsDoubleValue = Maybe (ResultValue Double)
-> ResultValue (TimingStats Int) -> Maybe (ResultValue Double)
forall a b. a -> b -> a
const Maybe (ResultValue Double)
forall a. Maybe a
Nothing
  resultItemAsDoubleListValue :: ResultValue (TimingStats Int) -> Maybe (ResultValue [Double])
resultItemAsDoubleListValue = Maybe (ResultValue [Double])
-> ResultValue (TimingStats Int) -> Maybe (ResultValue [Double])
forall a b. a -> b -> a
const Maybe (ResultValue [Double])
forall a. Maybe a
Nothing
  resultItemAsDoubleStatsValue :: ResultValue (TimingStats Int)
-> Maybe (ResultValue (SamplingStats Double))
resultItemAsDoubleStatsValue = ResultValue (SamplingStats Double)
-> Maybe (ResultValue (SamplingStats Double))
forall a. a -> Maybe a
Just (ResultValue (SamplingStats Double)
 -> Maybe (ResultValue (SamplingStats Double)))
-> (ResultValue (TimingStats Int)
    -> ResultValue (SamplingStats Double))
-> ResultValue (TimingStats Int)
-> Maybe (ResultValue (SamplingStats Double))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (SamplingStats Int -> SamplingStats Double)
-> ResultValue (SamplingStats Int)
-> ResultValue (SamplingStats Double)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap SamplingStats Int -> SamplingStats Double
fromIntSamplingStats (ResultValue (SamplingStats Int)
 -> ResultValue (SamplingStats Double))
-> (ResultValue (TimingStats Int)
    -> ResultValue (SamplingStats Int))
-> ResultValue (TimingStats Int)
-> ResultValue (SamplingStats Double)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultData (TimingStats Int -> SamplingStats Int)
-> ResultValue (TimingStats Int) -> ResultValue (SamplingStats Int)
forall a b. ResultData (a -> b) -> ResultValue a -> ResultValue b
apResultValue ResultData (TimingStats Int -> SamplingStats Int)
forall a.
TimingData a =>
ResultData (TimingStats a -> SamplingStats a)
normTimingStatsData
  resultItemAsDoubleTimingStatsValue :: ResultValue (TimingStats Int)
-> Maybe (ResultValue (TimingStats Double))
resultItemAsDoubleTimingStatsValue = ResultValue (TimingStats Double)
-> Maybe (ResultValue (TimingStats Double))
forall a. a -> Maybe a
Just (ResultValue (TimingStats Double)
 -> Maybe (ResultValue (TimingStats Double)))
-> (ResultValue (TimingStats Int)
    -> ResultValue (TimingStats Double))
-> ResultValue (TimingStats Int)
-> Maybe (ResultValue (TimingStats Double))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (TimingStats Int -> TimingStats Double)
-> ResultValue (TimingStats Int)
-> ResultValue (TimingStats Double)
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 = ResultValue ResultName -> Maybe (ResultValue ResultName)
forall a. a -> Maybe a
Just (ResultValue ResultName -> Maybe (ResultValue ResultName))
-> (ResultValue (TimingStats Int) -> ResultValue ResultName)
-> ResultValue (TimingStats Int)
-> Maybe (ResultValue ResultName)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (TimingStats Int -> ResultName)
-> ResultValue (TimingStats Int) -> ResultValue ResultName
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap TimingStats Int -> ResultName
forall a. Show a => a -> ResultName
show
  
  resultItemExpansion :: ResultValue (TimingStats Int) -> ResultSource
resultItemExpansion = ResultValue (TimingStats Int) -> ResultSource
forall a.
(TimingData a, ResultItemable (ResultValue a),
 ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingStats a) -> ResultSource
timingStatsResultSource
  resultItemSummary :: ResultValue (TimingStats Int) -> ResultSource
resultItemSummary = ResultValue (TimingStats Int) -> ResultSource
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 = ResultValue (TimingStats Double) -> ResultName
forall e. ResultValue e -> ResultName
resultValueName
  resultItemNamePath :: ResultValue (TimingStats Double) -> [ResultName]
resultItemNamePath = ResultValue (TimingStats Double) -> [ResultName]
forall e. ResultValue e -> [ResultName]
resultValueNamePath
  resultItemId :: ResultValue (TimingStats Double) -> ResultId
resultItemId = ResultValue (TimingStats Double) -> ResultId
forall e. ResultValue e -> ResultId
resultValueId
  resultItemIdPath :: ResultValue (TimingStats Double) -> [ResultId]
resultItemIdPath = ResultValue (TimingStats Double) -> [ResultId]
forall e. ResultValue e -> [ResultId]
resultValueIdPath
  resultItemSignal :: ResultValue (TimingStats Double) -> ResultSignal
resultItemSignal = ResultValue (TimingStats Double) -> ResultSignal
forall e. ResultValue e -> ResultSignal
resultValueSignal
  
  resultItemAsIntValue :: ResultValue (TimingStats Double) -> Maybe (ResultValue Int)
resultItemAsIntValue = Maybe (ResultValue Int)
-> ResultValue (TimingStats Double) -> Maybe (ResultValue Int)
forall a b. a -> b -> a
const Maybe (ResultValue Int)
forall a. Maybe a
Nothing
  resultItemAsIntListValue :: ResultValue (TimingStats Double) -> Maybe (ResultValue [Int])
resultItemAsIntListValue = Maybe (ResultValue [Int])
-> ResultValue (TimingStats Double) -> Maybe (ResultValue [Int])
forall a b. a -> b -> a
const Maybe (ResultValue [Int])
forall a. Maybe a
Nothing
  resultItemAsIntStatsValue :: ResultValue (TimingStats Double)
-> Maybe (ResultValue (SamplingStats Int))
resultItemAsIntStatsValue = Maybe (ResultValue (SamplingStats Int))
-> ResultValue (TimingStats Double)
-> Maybe (ResultValue (SamplingStats Int))
forall a b. a -> b -> a
const Maybe (ResultValue (SamplingStats Int))
forall a. Maybe a
Nothing
  resultItemAsIntTimingStatsValue :: ResultValue (TimingStats Double)
-> Maybe (ResultValue (TimingStats Int))
resultItemAsIntTimingStatsValue = Maybe (ResultValue (TimingStats Int))
-> ResultValue (TimingStats Double)
-> Maybe (ResultValue (TimingStats Int))
forall a b. a -> b -> a
const Maybe (ResultValue (TimingStats Int))
forall a. Maybe a
Nothing

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

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

instance ResultItemable (ResultValue Bool) where

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

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

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

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

instance ResultItemable (ResultValue String) where

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

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

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

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

instance ResultItemable (ResultValue ()) where

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

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

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

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

instance ResultItemable (ResultValue FCFS) where

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

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

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

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

instance ResultItemable (ResultValue LCFS) where

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

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

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

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

instance ResultItemable (ResultValue SIRO) where

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

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

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

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

instance ResultItemable (ResultValue StaticPriorities) where

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

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

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

  resultItemExpansion :: ResultValue StaticPriorities -> ResultSource
resultItemExpansion = ResultItem -> ResultSource
ResultItemSource (ResultItem -> ResultSource)
-> (ResultValue StaticPriorities -> ResultItem)
-> ResultValue StaticPriorities
-> ResultSource
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue StaticPriorities -> ResultItem
forall a. ResultItemable a => a -> ResultItem
ResultItem
  resultItemSummary :: ResultValue StaticPriorities -> ResultSource
resultItemSummary = ResultItem -> ResultSource
ResultItemSource (ResultItem -> ResultSource)
-> (ResultValue StaticPriorities -> ResultItem)
-> ResultValue StaticPriorities
-> ResultSource
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue StaticPriorities -> ResultItem
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) =
  [[ResultItem]] -> [ResultItem]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultItem]] -> [ResultItem]) -> [[ResultItem]] -> [ResultItem]
forall a b. (a -> b) -> a -> b
$ (ResultProperty -> [ResultItem])
-> [ResultProperty] -> [[ResultItem]]
forall a b. (a -> b) -> [a] -> [b]
map (ResultSource -> [ResultItem]
flattenResultSource (ResultSource -> [ResultItem])
-> (ResultProperty -> ResultSource)
-> ResultProperty
-> [ResultItem]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultProperty -> ResultSource
resultPropertySource) ([ResultProperty] -> [[ResultItem]])
-> [ResultProperty] -> [[ResultItem]]
forall a b. (a -> b) -> a -> b
$ ResultObject -> [ResultProperty]
resultObjectProperties ResultObject
x
flattenResultSource (ResultVectorSource ResultVector
x) =
  [[ResultItem]] -> [ResultItem]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultItem]] -> [ResultItem]) -> [[ResultItem]] -> [ResultItem]
forall a b. (a -> b) -> a -> b
$ (ResultSource -> [ResultItem]) -> [ResultSource] -> [[ResultItem]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> [ResultItem]
flattenResultSource ([ResultSource] -> [[ResultItem]])
-> [ResultSource] -> [[ResultItem]]
forall a b. (a -> b) -> a -> b
$ Array Int ResultSource -> [ResultSource]
forall i e. Array i e -> [e]
A.elems (Array Int ResultSource -> [ResultSource])
-> Array Int ResultSource -> [ResultSource]
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)) = a -> ResultName
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)) = a -> ResultSource
forall a. ResultItemable a => a -> ResultSource
resultItemExpansion a
x
expandResultSource (ResultObjectSource ResultObject
x) =
  ResultObject -> ResultSource
ResultObjectSource (ResultObject -> ResultSource) -> ResultObject -> ResultSource
forall a b. (a -> b) -> a -> b
$
  ResultObject
x { resultObjectProperties :: [ResultProperty]
resultObjectProperties =
         ((ResultProperty -> ResultProperty)
 -> [ResultProperty] -> [ResultProperty])
-> [ResultProperty]
-> (ResultProperty -> ResultProperty)
-> [ResultProperty]
forall a b c. (a -> b -> c) -> b -> a -> c
flip (ResultProperty -> ResultProperty)
-> [ResultProperty] -> [ResultProperty]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (ResultObject -> [ResultProperty]
resultObjectProperties ResultObject
x) ((ResultProperty -> ResultProperty) -> [ResultProperty])
-> (ResultProperty -> ResultProperty) -> [ResultProperty]
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 (ResultVector -> ResultSource) -> ResultVector -> ResultSource
forall a b. (a -> b) -> a -> b
$
  ResultVector
x { resultVectorItems :: Array Int ResultSource
resultVectorItems =
         (Int, Int) -> [(Int, ResultSource)] -> Array Int ResultSource
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 = Array Int ResultSource -> (Int, Int)
forall i e. Array i e -> (i, i)
A.bounds Array Int ResultSource
arr
          ies :: [(Int, ResultSource)]
ies  = Array Int ResultSource -> [(Int, ResultSource)]
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)) = a -> ResultSource
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)) = a -> ResultSignal
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 = (ResultItem -> ResultValue Int)
-> [ResultItem] -> [ResultValue Int]
forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a
x) -> a -> ResultValue Int
forall a. ResultItemable a => a -> ResultValue Int
resultItemToIntValue a
x) ([ResultItem] -> [ResultValue Int])
-> (ResultSource -> [ResultItem])
-> ResultSource
-> [ResultValue Int]
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 = (ResultItem -> ResultValue [Int])
-> [ResultItem] -> [ResultValue [Int]]
forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a
x) -> a -> ResultValue [Int]
forall a. ResultItemable a => a -> ResultValue [Int]
resultItemToIntListValue a
x) ([ResultItem] -> [ResultValue [Int]])
-> (ResultSource -> [ResultItem])
-> ResultSource
-> [ResultValue [Int]]
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 = (ResultItem -> ResultValue (SamplingStats Int))
-> [ResultItem] -> [ResultValue (SamplingStats Int)]
forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a
x) -> a -> ResultValue (SamplingStats Int)
forall a. ResultItemable a => a -> ResultValue (SamplingStats Int)
resultItemToIntStatsValue a
x) ([ResultItem] -> [ResultValue (SamplingStats Int)])
-> (ResultSource -> [ResultItem])
-> ResultSource
-> [ResultValue (SamplingStats Int)]
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 = (ResultItem -> ResultValue (Either Int (SamplingStats Int)))
-> [ResultItem] -> [ResultValue (Either Int (SamplingStats Int))]
forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a
x) -> a -> ResultValue (Either Int (SamplingStats Int))
forall a.
ResultItemable a =>
a -> ResultValue (Either Int (SamplingStats Int))
resultItemToIntStatsEitherValue a
x) ([ResultItem] -> [ResultValue (Either Int (SamplingStats Int))])
-> (ResultSource -> [ResultItem])
-> ResultSource
-> [ResultValue (Either Int (SamplingStats Int))]
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 = (ResultItem -> ResultValue (TimingStats Int))
-> [ResultItem] -> [ResultValue (TimingStats Int)]
forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a
x) -> a -> ResultValue (TimingStats Int)
forall a. ResultItemable a => a -> ResultValue (TimingStats Int)
resultItemToIntTimingStatsValue a
x) ([ResultItem] -> [ResultValue (TimingStats Int)])
-> (ResultSource -> [ResultItem])
-> ResultSource
-> [ResultValue (TimingStats Int)]
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 = (ResultItem -> ResultValue Double)
-> [ResultItem] -> [ResultValue Double]
forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a
x) -> a -> ResultValue Double
forall a. ResultItemable a => a -> ResultValue Double
resultItemToDoubleValue a
x) ([ResultItem] -> [ResultValue Double])
-> (ResultSource -> [ResultItem])
-> ResultSource
-> [ResultValue Double]
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 = (ResultItem -> ResultValue [Double])
-> [ResultItem] -> [ResultValue [Double]]
forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a
x) -> a -> ResultValue [Double]
forall a. ResultItemable a => a -> ResultValue [Double]
resultItemToDoubleListValue a
x) ([ResultItem] -> [ResultValue [Double]])
-> (ResultSource -> [ResultItem])
-> ResultSource
-> [ResultValue [Double]]
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 = (ResultItem -> ResultValue (SamplingStats Double))
-> [ResultItem] -> [ResultValue (SamplingStats Double)]
forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a
x) -> a -> ResultValue (SamplingStats Double)
forall a.
ResultItemable a =>
a -> ResultValue (SamplingStats Double)
resultItemToDoubleStatsValue a
x) ([ResultItem] -> [ResultValue (SamplingStats Double)])
-> (ResultSource -> [ResultItem])
-> ResultSource
-> [ResultValue (SamplingStats Double)]
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 = (ResultItem -> ResultValue (Either Double (SamplingStats Double)))
-> [ResultItem]
-> [ResultValue (Either Double (SamplingStats Double))]
forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a
x) -> a -> ResultValue (Either Double (SamplingStats Double))
forall a.
ResultItemable a =>
a -> ResultValue (Either Double (SamplingStats Double))
resultItemToDoubleStatsEitherValue a
x) ([ResultItem]
 -> [ResultValue (Either Double (SamplingStats Double))])
-> (ResultSource -> [ResultItem])
-> ResultSource
-> [ResultValue (Either Double (SamplingStats Double))]
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 = (ResultItem -> ResultValue (TimingStats Double))
-> [ResultItem] -> [ResultValue (TimingStats Double)]
forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a
x) -> a -> ResultValue (TimingStats Double)
forall a. ResultItemable a => a -> ResultValue (TimingStats Double)
resultItemToDoubleTimingStatsValue a
x) ([ResultItem] -> [ResultValue (TimingStats Double)])
-> (ResultSource -> [ResultItem])
-> ResultSource
-> [ResultValue (TimingStats Double)]
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 = (ResultItem -> ResultValue ResultName)
-> [ResultItem] -> [ResultValue ResultName]
forall a b. (a -> b) -> [a] -> [b]
map (\(ResultItem a
x) -> a -> ResultValue ResultName
forall a. ResultItemable a => a -> ResultValue ResultName
resultItemToStringValue a
x) ([ResultItem] -> [ResultValue ResultName])
-> (ResultSource -> [ResultItem])
-> ResultSource
-> [ResultValue ResultName]
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 = Dynamics ResultPredefinedSignals
-> Simulation ResultPredefinedSignals
forall a. Dynamics a -> Simulation a
runDynamicsInStartTime (Dynamics ResultPredefinedSignals
 -> Simulation ResultPredefinedSignals)
-> Dynamics ResultPredefinedSignals
-> Simulation ResultPredefinedSignals
forall a b. (a -> b) -> a -> b
$ EventProcessing
-> Event ResultPredefinedSignals
-> Dynamics ResultPredefinedSignals
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
         ResultPredefinedSignals -> Event ResultPredefinedSignals
forall (m :: * -> *) a. Monad m => a -> m a
return ResultPredefinedSignals :: Signal Double
-> Signal Double -> Signal Double -> ResultPredefinedSignals
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 ([ResultSource] -> Results) -> [ResultSource] -> Results
forall a b. (a -> b) -> a -> b
$ Results -> [ResultSource]
resultSourceList Results
x [ResultSource] -> [ResultSource] -> [ResultSource]
forall a. Semigroup a => a -> a -> a
<> Results -> [ResultSource]
resultSourceList Results
y

instance Monoid Results where

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

-- | Prepare the simulation results.
results :: [ResultSource] -> Results
results :: [ResultSource] -> Results
results [ResultSource]
ms =
  Results :: ResultSourceMap -> [ResultSource] -> Results
Results { resultSourceMap :: ResultSourceMap
resultSourceMap  = [(ResultName, ResultSource)] -> ResultSourceMap
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList ([(ResultName, ResultSource)] -> ResultSourceMap)
-> [(ResultName, ResultSource)] -> ResultSourceMap
forall a b. (a -> b) -> a -> b
$ (ResultSource -> (ResultName, ResultSource))
-> [ResultSource] -> [(ResultName, ResultSource)]
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 = [[ResultValue Int]] -> [ResultValue Int]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultValue Int]] -> [ResultValue Int])
-> (Results -> [[ResultValue Int]]) -> Results -> [ResultValue Int]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource -> [ResultValue Int])
-> [ResultSource] -> [[ResultValue Int]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> [ResultValue Int]
resultSourceToIntValues ([ResultSource] -> [[ResultValue Int]])
-> (Results -> [ResultSource]) -> Results -> [[ResultValue Int]]
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 = [[ResultValue [Int]]] -> [ResultValue [Int]]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultValue [Int]]] -> [ResultValue [Int]])
-> (Results -> [[ResultValue [Int]]])
-> Results
-> [ResultValue [Int]]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource -> [ResultValue [Int]])
-> [ResultSource] -> [[ResultValue [Int]]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> [ResultValue [Int]]
resultSourceToIntListValues ([ResultSource] -> [[ResultValue [Int]]])
-> (Results -> [ResultSource]) -> Results -> [[ResultValue [Int]]]
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 = [[ResultValue (SamplingStats Int)]]
-> [ResultValue (SamplingStats Int)]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultValue (SamplingStats Int)]]
 -> [ResultValue (SamplingStats Int)])
-> (Results -> [[ResultValue (SamplingStats Int)]])
-> Results
-> [ResultValue (SamplingStats Int)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource -> [ResultValue (SamplingStats Int)])
-> [ResultSource] -> [[ResultValue (SamplingStats Int)]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> [ResultValue (SamplingStats Int)]
resultSourceToIntStatsValues ([ResultSource] -> [[ResultValue (SamplingStats Int)]])
-> (Results -> [ResultSource])
-> Results
-> [[ResultValue (SamplingStats Int)]]
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 = [[ResultValue (Either Int (SamplingStats Int))]]
-> [ResultValue (Either Int (SamplingStats Int))]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultValue (Either Int (SamplingStats Int))]]
 -> [ResultValue (Either Int (SamplingStats Int))])
-> (Results -> [[ResultValue (Either Int (SamplingStats Int))]])
-> Results
-> [ResultValue (Either Int (SamplingStats Int))]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource -> [ResultValue (Either Int (SamplingStats Int))])
-> [ResultSource]
-> [[ResultValue (Either Int (SamplingStats Int))]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> [ResultValue (Either Int (SamplingStats Int))]
resultSourceToIntStatsEitherValues ([ResultSource]
 -> [[ResultValue (Either Int (SamplingStats Int))]])
-> (Results -> [ResultSource])
-> Results
-> [[ResultValue (Either Int (SamplingStats Int))]]
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 = [[ResultValue (TimingStats Int)]]
-> [ResultValue (TimingStats Int)]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultValue (TimingStats Int)]]
 -> [ResultValue (TimingStats Int)])
-> (Results -> [[ResultValue (TimingStats Int)]])
-> Results
-> [ResultValue (TimingStats Int)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource -> [ResultValue (TimingStats Int)])
-> [ResultSource] -> [[ResultValue (TimingStats Int)]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> [ResultValue (TimingStats Int)]
resultSourceToIntTimingStatsValues ([ResultSource] -> [[ResultValue (TimingStats Int)]])
-> (Results -> [ResultSource])
-> Results
-> [[ResultValue (TimingStats Int)]]
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 = [[ResultValue Double]] -> [ResultValue Double]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultValue Double]] -> [ResultValue Double])
-> (Results -> [[ResultValue Double]])
-> Results
-> [ResultValue Double]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource -> [ResultValue Double])
-> [ResultSource] -> [[ResultValue Double]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> [ResultValue Double]
resultSourceToDoubleValues ([ResultSource] -> [[ResultValue Double]])
-> (Results -> [ResultSource]) -> Results -> [[ResultValue Double]]
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 = [[ResultValue [Double]]] -> [ResultValue [Double]]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultValue [Double]]] -> [ResultValue [Double]])
-> (Results -> [[ResultValue [Double]]])
-> Results
-> [ResultValue [Double]]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource -> [ResultValue [Double]])
-> [ResultSource] -> [[ResultValue [Double]]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> [ResultValue [Double]]
resultSourceToDoubleListValues ([ResultSource] -> [[ResultValue [Double]]])
-> (Results -> [ResultSource])
-> Results
-> [[ResultValue [Double]]]
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 = [[ResultValue (SamplingStats Double)]]
-> [ResultValue (SamplingStats Double)]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultValue (SamplingStats Double)]]
 -> [ResultValue (SamplingStats Double)])
-> (Results -> [[ResultValue (SamplingStats Double)]])
-> Results
-> [ResultValue (SamplingStats Double)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource -> [ResultValue (SamplingStats Double)])
-> [ResultSource] -> [[ResultValue (SamplingStats Double)]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> [ResultValue (SamplingStats Double)]
resultSourceToDoubleStatsValues ([ResultSource] -> [[ResultValue (SamplingStats Double)]])
-> (Results -> [ResultSource])
-> Results
-> [[ResultValue (SamplingStats Double)]]
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 = [[ResultValue (Either Double (SamplingStats Double))]]
-> [ResultValue (Either Double (SamplingStats Double))]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultValue (Either Double (SamplingStats Double))]]
 -> [ResultValue (Either Double (SamplingStats Double))])
-> (Results
    -> [[ResultValue (Either Double (SamplingStats Double))]])
-> Results
-> [ResultValue (Either Double (SamplingStats Double))]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource
 -> [ResultValue (Either Double (SamplingStats Double))])
-> [ResultSource]
-> [[ResultValue (Either Double (SamplingStats Double))]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource
-> [ResultValue (Either Double (SamplingStats Double))]
resultSourceToDoubleStatsEitherValues ([ResultSource]
 -> [[ResultValue (Either Double (SamplingStats Double))]])
-> (Results -> [ResultSource])
-> Results
-> [[ResultValue (Either Double (SamplingStats Double))]]
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 = [[ResultValue (TimingStats Double)]]
-> [ResultValue (TimingStats Double)]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultValue (TimingStats Double)]]
 -> [ResultValue (TimingStats Double)])
-> (Results -> [[ResultValue (TimingStats Double)]])
-> Results
-> [ResultValue (TimingStats Double)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource -> [ResultValue (TimingStats Double)])
-> [ResultSource] -> [[ResultValue (TimingStats Double)]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> [ResultValue (TimingStats Double)]
resultSourceToDoubleTimingStatsValues ([ResultSource] -> [[ResultValue (TimingStats Double)]])
-> (Results -> [ResultSource])
-> Results
-> [[ResultValue (TimingStats Double)]]
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 = [[ResultValue ResultName]] -> [ResultValue ResultName]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultValue ResultName]] -> [ResultValue ResultName])
-> (Results -> [[ResultValue ResultName]])
-> Results
-> [ResultValue ResultName]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource -> [ResultValue ResultName])
-> [ResultSource] -> [[ResultValue ResultName]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> [ResultValue ResultName]
resultSourceToStringValues ([ResultSource] -> [[ResultValue ResultName]])
-> (Results -> [ResultSource])
-> Results
-> [[ResultValue ResultName]]
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 = [ResultSignal] -> ResultSignal
forall a. Monoid a => [a] -> a
mconcat ([ResultSignal] -> ResultSignal)
-> (Results -> [ResultSignal]) -> Results -> ResultSignal
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource -> ResultSignal) -> [ResultSource] -> [ResultSignal]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> ResultSignal
resultSourceSignal ([ResultSource] -> [ResultSignal])
-> (Results -> [ResultSource]) -> Results -> [ResultSignal]
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 ([ResultSource] -> Results)
-> (Results -> [ResultSource]) -> Results -> Results
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource -> ResultSource) -> [ResultSource] -> [ResultSource]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> ResultSource
expandResultSource ([ResultSource] -> [ResultSource])
-> (Results -> [ResultSource]) -> Results -> [ResultSource]
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 ([ResultSource] -> Results)
-> (Results -> [ResultSource]) -> Results -> Results
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource -> ResultSource) -> [ResultSource] -> [ResultSource]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> ResultSource
resultSourceSummary ([ResultSource] -> [ResultSource])
-> (Results -> [ResultSource]) -> Results -> [ResultSource]
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 ResultName -> ResultSourceMap -> Maybe ResultSource
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 ->
      ResultName -> Results
forall a. HasCallStack => ResultName -> a
error (ResultName -> Results) -> ResultName -> Results
forall a b. (a -> b) -> a -> b
$
      ResultName
"Not found result source with name " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultName
name ResultName -> ResultName -> ResultName
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 = ((ResultSource -> [ResultSource]) -> Results -> Results)
-> Results -> (ResultSource -> [ResultSource]) -> Results
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 =
                ((ResultProperty -> Bool) -> [ResultProperty] -> [ResultProperty])
-> [ResultProperty] -> (ResultProperty -> Bool) -> [ResultProperty]
forall a b c. (a -> b -> c) -> b -> a -> c
flip (ResultProperty -> Bool) -> [ResultProperty] -> [ResultProperty]
forall a. (a -> Bool) -> [a] -> [a]
filter (ResultObject -> [ResultProperty]
resultObjectProperties ResultObject
s) ((ResultProperty -> Bool) -> [ResultProperty])
-> (ResultProperty -> Bool) -> [ResultProperty]
forall a b. (a -> b) -> a -> b
$ \ResultProperty
p ->
                ResultProperty -> ResultName
resultPropertyLabel ResultProperty
p ResultName -> ResultName -> Bool
forall a. Eq a => a -> a -> Bool
== ResultName
label
          in case [ResultProperty]
ps of
            [] ->
              ResultName -> [ResultSource]
forall a. HasCallStack => ResultName -> a
error (ResultName -> [ResultSource]) -> ResultName -> [ResultSource]
forall a b. (a -> b) -> a -> b
$
              ResultName
"Not found property " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultName
label ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
              ResultName
" for object " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultObject -> ResultName
resultObjectName ResultObject
s ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
              ResultName
": resultByProperty"
            [ResultProperty]
ps ->
              (ResultProperty -> ResultSource)
-> [ResultProperty] -> [ResultSource]
forall a b. (a -> b) -> [a] -> [b]
map ResultProperty -> ResultSource
resultPropertySource [ResultProperty]
ps
        ResultVectorSource ResultVector
s ->
          [[ResultSource]] -> [ResultSource]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultSource]] -> [ResultSource])
-> [[ResultSource]] -> [ResultSource]
forall a b. (a -> b) -> a -> b
$ (ResultSource -> [ResultSource])
-> [ResultSource] -> [[ResultSource]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> [ResultSource]
loop ([ResultSource] -> [[ResultSource]])
-> [ResultSource] -> [[ResultSource]]
forall a b. (a -> b) -> a -> b
$ Array Int ResultSource -> [ResultSource]
forall i e. Array i e -> [e]
A.elems (Array Int ResultSource -> [ResultSource])
-> Array Int ResultSource -> [ResultSource]
forall a b. (a -> b) -> a -> b
$ ResultVector -> Array Int ResultSource
resultVectorItems ResultVector
s
        ResultSource
x ->
          ResultName -> [ResultSource]
forall a. HasCallStack => ResultName -> a
error (ResultName -> [ResultSource]) -> ResultName -> [ResultSource]
forall a b. (a -> b) -> a -> b
$
          ResultName
"Result source " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultSource -> ResultName
resultSourceName ResultSource
x ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
          ResultName
" is neither object, nor vector " ResultName -> ResultName -> ResultName
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 = ((ResultSource -> [ResultSource]) -> Results -> Results)
-> Results -> (ResultSource -> [ResultSource]) -> Results
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 a -> ResultId
forall a. ResultItemable a => a -> ResultId
resultItemId a
s ResultId -> ResultId -> Bool
forall a. Eq a => a -> a -> Bool
== ResultId
i
          then [ResultSource
x]
          else ResultName -> [ResultSource]
forall a. HasCallStack => ResultName -> a
error (ResultName -> [ResultSource]) -> ResultName -> [ResultSource]
forall a b. (a -> b) -> a -> b
$
               ResultName
"Expected to find item with Id = " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultId -> ResultName
forall a. Show a => a -> ResultName
show ResultId
i ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
               ResultName
", while the item " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ a -> ResultName
forall a. ResultItemable a => a -> ResultName
resultItemName a
s ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
               ResultName
" has actual Id = " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultId -> ResultName
forall a. Show a => a -> ResultName
show (a -> ResultId
forall a. ResultItemable a => a -> ResultId
resultItemId a
s) ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
               ResultName
": resultById"
        ResultObjectSource ResultObject
s ->
          if ResultObject -> ResultId
resultObjectId ResultObject
s ResultId -> ResultId -> Bool
forall a. Eq a => a -> a -> Bool
== ResultId
i
          then [ResultSource
x]
          else let ps :: [ResultProperty]
ps =
                     ((ResultProperty -> Bool) -> [ResultProperty] -> [ResultProperty])
-> [ResultProperty] -> (ResultProperty -> Bool) -> [ResultProperty]
forall a b c. (a -> b -> c) -> b -> a -> c
flip (ResultProperty -> Bool) -> [ResultProperty] -> [ResultProperty]
forall a. (a -> Bool) -> [a] -> [a]
filter (ResultObject -> [ResultProperty]
resultObjectProperties ResultObject
s) ((ResultProperty -> Bool) -> [ResultProperty])
-> (ResultProperty -> Bool) -> [ResultProperty]
forall a b. (a -> b) -> a -> b
$ \ResultProperty
p ->
                     ResultProperty -> ResultId
resultPropertyId ResultProperty
p ResultId -> ResultId -> Bool
forall a. Eq a => a -> a -> Bool
== ResultId
i
               in case [ResultProperty]
ps of
                 [] ->
                   ResultName -> [ResultSource]
forall a. HasCallStack => ResultName -> a
error (ResultName -> [ResultSource]) -> ResultName -> [ResultSource]
forall a b. (a -> b) -> a -> b
$
                   ResultName
"Not found property with Id = " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultId -> ResultName
forall a. Show a => a -> ResultName
show ResultId
i ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
                   ResultName
" for object " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultObject -> ResultName
resultObjectName ResultObject
s ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
                   ResultName
" that has actual Id = " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultId -> ResultName
forall a. Show a => a -> ResultName
show (ResultObject -> ResultId
resultObjectId ResultObject
s) ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
                   ResultName
": resultById"
                 [ResultProperty]
ps ->
                   (ResultProperty -> ResultSource)
-> [ResultProperty] -> [ResultSource]
forall a b. (a -> b) -> [a] -> [b]
map ResultProperty -> ResultSource
resultPropertySource [ResultProperty]
ps
        ResultVectorSource ResultVector
s ->
          if ResultVector -> ResultId
resultVectorId ResultVector
s ResultId -> ResultId -> Bool
forall a. Eq a => a -> a -> Bool
== ResultId
i
          then [ResultSource
x]
          else [[ResultSource]] -> [ResultSource]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultSource]] -> [ResultSource])
-> [[ResultSource]] -> [ResultSource]
forall a b. (a -> b) -> a -> b
$ (ResultSource -> [ResultSource])
-> [ResultSource] -> [[ResultSource]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> [ResultSource]
loop ([ResultSource] -> [[ResultSource]])
-> [ResultSource] -> [[ResultSource]]
forall a b. (a -> b) -> a -> b
$ Array Int ResultSource -> [ResultSource]
forall i e. Array i e -> [e]
A.elems (Array Int ResultSource -> [ResultSource])
-> Array Int ResultSource -> [ResultSource]
forall a b. (a -> b) -> a -> b
$ ResultVector -> Array Int ResultSource
resultVectorItems ResultVector
s
        ResultSource
x ->
          ResultName -> [ResultSource]
forall a. HasCallStack => ResultName -> a
error (ResultName -> [ResultSource]) -> ResultName -> [ResultSource]
forall a b. (a -> b) -> a -> b
$
          ResultName
"Result source " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultSource -> ResultName
resultSourceName ResultSource
x ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
          ResultName
" is neither item, nor object, nor vector " ResultName -> ResultName -> ResultName
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 = ((ResultSource -> [ResultSource]) -> Results -> Results)
-> Results -> (ResultSource -> [ResultSource]) -> Results
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 Array Int ResultSource -> Int -> ResultSource
forall i e. Ix i => Array i e -> i -> e
A.! Int
index] 
        ResultSource
x ->
          ResultName -> [ResultSource]
forall a. HasCallStack => ResultName -> a
error (ResultName -> [ResultSource]) -> ResultName -> [ResultSource]
forall a b. (a -> b) -> a -> b
$
          ResultName
"Result source " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultSource -> ResultName
resultSourceName ResultSource
x ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
          ResultName
" is not vector " ResultName -> ResultName -> ResultName
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 = ((ResultSource -> [ResultSource]) -> Results -> Results)
-> Results -> (ResultSource -> [ResultSource]) -> Results
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 = Array Int ResultSource -> [ResultSource]
forall i e. Array i e -> [e]
A.elems (Array Int ResultSource -> [ResultSource])
-> Array Int ResultSource -> [ResultSource]
forall a b. (a -> b) -> a -> b
$ ResultVector -> Array Int ResultSource
resultVectorItems ResultVector
s
              zs :: [ResultName]
zs = Array Int ResultName -> [ResultName]
forall i e. Array i e -> [e]
A.elems (Array Int ResultName -> [ResultName])
-> Array Int ResultName -> [ResultName]
forall a b. (a -> b) -> a -> b
$ ResultVector -> Array Int ResultName
resultVectorSubscript ResultVector
s
              ps :: [(ResultSource, ResultName)]
ps =
                (((ResultSource, ResultName) -> Bool)
 -> [(ResultSource, ResultName)] -> [(ResultSource, ResultName)])
-> [(ResultSource, ResultName)]
-> ((ResultSource, ResultName) -> Bool)
-> [(ResultSource, ResultName)]
forall a b c. (a -> b -> c) -> b -> a -> c
flip ((ResultSource, ResultName) -> Bool)
-> [(ResultSource, ResultName)] -> [(ResultSource, ResultName)]
forall a. (a -> Bool) -> [a] -> [a]
filter ([ResultSource] -> [ResultName] -> [(ResultSource, ResultName)]
forall a b. [a] -> [b] -> [(a, b)]
zip [ResultSource]
ys [ResultName]
zs) (((ResultSource, ResultName) -> Bool)
 -> [(ResultSource, ResultName)])
-> ((ResultSource, ResultName) -> Bool)
-> [(ResultSource, ResultName)]
forall a b. (a -> b) -> a -> b
$ \(ResultSource
y, ResultName
z) ->
                ResultName
z ResultName -> ResultName -> Bool
forall a. Eq a => a -> a -> Bool
== ResultName
subscript
          in case [(ResultSource, ResultName)]
ps of
            [] ->
              ResultName -> [ResultSource]
forall a. HasCallStack => ResultName -> a
error (ResultName -> [ResultSource]) -> ResultName -> [ResultSource]
forall a b. (a -> b) -> a -> b
$
              ResultName
"Not found subscript " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultName
subscript ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
              ResultName
" for vector " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultVector -> ResultName
resultVectorName ResultVector
s ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
              ResultName
": resultBySubscript"
            [(ResultSource, ResultName)]
ps ->
              ((ResultSource, ResultName) -> ResultSource)
-> [(ResultSource, ResultName)] -> [ResultSource]
forall a b. (a -> b) -> [a] -> [b]
map (ResultSource, ResultName) -> ResultSource
forall a b. (a, b) -> a
fst [(ResultSource, ResultName)]
ps
        ResultSource
x ->
          ResultName -> [ResultSource]
forall a. HasCallStack => ResultName -> a
error (ResultName -> [ResultSource]) -> ResultName -> [ResultSource]
forall a b. (a -> b) -> a -> b
$
          ResultName
"Result source " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultSource -> ResultName
resultSourceName ResultSource
x ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++
          ResultName
" is not vector " ResultName -> ResultName -> ResultName
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 ([ResultSource] -> Results)
-> (Results -> [ResultSource]) -> Results -> Results
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[ResultSource]] -> [ResultSource]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultSource]] -> [ResultSource])
-> (Results -> [[ResultSource]]) -> Results -> [ResultSource]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ResultSource -> [ResultSource])
-> [ResultSource] -> [[ResultSource]]
forall a b. (a -> b) -> [a] -> [b]
map ResultSource -> [ResultSource]
f ([ResultSource] -> [[ResultSource]])
-> (Results -> [ResultSource]) -> Results -> [[ResultSource]]
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 ([ResultSource] -> Results) -> [ResultSource] -> Results
forall a b. (a -> b) -> a -> b
$ [[ResultSource]] -> [ResultSource]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[ResultSource]] -> [ResultSource])
-> [[ResultSource]] -> [ResultSource]
forall a b. (a -> b) -> a -> b
$ ((Results -> Results) -> [ResultSource])
-> [Results -> Results] -> [[ResultSource]]
forall a b. (a -> b) -> [a] -> [b]
map (\Results -> Results
tr -> Results -> [ResultSource]
resultSourceList (Results -> [ResultSource]) -> Results -> [ResultSource]
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 =
  Signal Double -> Signal ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (ResultPredefinedSignals -> Signal Double
resultSignalInStartTime ResultPredefinedSignals
rs)
pureResultSignal ResultPredefinedSignals
rs ResultSignal
UnknownResultSignal =
  Signal Double -> Signal ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (ResultPredefinedSignals -> Signal Double
resultSignalInIntegTimes ResultPredefinedSignals
rs)
pureResultSignal ResultPredefinedSignals
rs (ResultSignal Signal ()
s) =
  Signal Double -> Signal ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (ResultPredefinedSignals -> Signal Double
resultSignalInStartTime ResultPredefinedSignals
rs) Signal () -> Signal () -> Signal ()
forall a. Semigroup a => a -> a -> a
<> Signal Double -> Signal ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (ResultPredefinedSignals -> Signal Double
resultSignalInStopTime ResultPredefinedSignals
rs) Signal () -> Signal () -> Signal ()
forall a. Semigroup a => a -> a -> a
<> Signal ()
s
pureResultSignal ResultPredefinedSignals
rs (ResultSignalMix Signal ()
s) =
  Signal Double -> Signal ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (ResultPredefinedSignals -> Signal Double
resultSignalInIntegTimes ResultPredefinedSignals
rs) Signal () -> Signal () -> Signal ()
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 :: ResultName
-> [ResultName] -> ResultId -> [ResultId] -> m a -> ResultValue a
computeResultValue ResultName
name [ResultName]
names ResultId
i [ResultId]
is m a
m =
  ResultValue :: forall e.
ResultName
-> [ResultName]
-> ResultId
-> [ResultId]
-> ResultData e
-> ResultSignal
-> ResultValue e
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   = m a -> ResultData a
forall (m :: * -> *) a. ResultComputing m => m a -> ResultData a
computeResultData m a
m,
    resultValueSignal :: ResultSignal
resultValueSignal = m a -> ResultSignal
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 { ResultComputation a -> ResultData a
resultComputationData :: ResultData a,
                      -- ^ Return data from the computation.
                      ResultComputation a -> ResultSignal
resultComputationSignal :: ResultSignal
                      -- ^ Return a signal from the computation.
                    }

instance ResultComputing ResultComputation where

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

instance ResultComputing Parameter where

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

instance ResultComputing Simulation where

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

instance ResultComputing Dynamics where

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

instance ResultComputing Event where

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

instance ResultComputing Ref where

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

instance ResultComputing BR.Ref where

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

instance ResultComputing Var where

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

instance ResultComputing Signalable where

  computeResultData :: Signalable a -> ResultData a
computeResultData = Signalable a -> ResultData a
forall a. Signalable a -> ResultData a
readSignalable
  computeResultSignal :: Signalable a -> ResultSignal
computeResultSignal = Signal () -> ResultSignal
ResultSignal (Signal () -> ResultSignal)
-> (Signalable a -> Signal ()) -> Signalable a -> ResultSignal
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Signalable a -> Signal ()
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 :: ResultValue (SamplingStats a) -> ResultSource
samplingStatsResultSource ResultValue (SamplingStats a)
x =
  ResultObject -> ResultSource
ResultObjectSource (ResultObject -> ResultSource) -> ResultObject -> ResultSource
forall a b. (a -> b) -> a -> b
$
  ResultObject :: ResultName
-> ResultId
-> ResultId
-> [ResultProperty]
-> ResultSignal
-> ResultSource
-> ResultObject
ResultObject {
    resultObjectName :: ResultName
resultObjectName      = ResultValue (SamplingStats a) -> ResultName
forall e. ResultValue e -> ResultName
resultValueName ResultValue (SamplingStats a)
x,
    resultObjectId :: ResultId
resultObjectId        = ResultValue (SamplingStats a) -> ResultId
forall e. ResultValue e -> ResultId
resultValueId ResultValue (SamplingStats a)
x,
    resultObjectTypeId :: ResultId
resultObjectTypeId    = ResultId
SamplingStatsId,
    resultObjectSignal :: ResultSignal
resultObjectSignal    = ResultValue (SamplingStats a) -> ResultSignal
forall e. ResultValue e -> ResultSignal
resultValueSignal ResultValue (SamplingStats a)
x,
    resultObjectSummary :: ResultSource
resultObjectSummary   = ResultValue (SamplingStats a) -> ResultSource
forall a.
ResultItemable (ResultValue (SamplingStats a)) =>
ResultValue (SamplingStats a) -> ResultSource
samplingStatsResultSummary ResultValue (SamplingStats a)
x,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      ResultContainer (ResultData (SamplingStats a))
-> ResultName
-> ResultId
-> (SamplingStats a -> Int)
-> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (SamplingStats a))
c ResultName
"count" ResultId
SamplingStatsCountId SamplingStats a -> Int
forall a. SamplingStats a -> Int
samplingStatsCount,
      ResultContainer (ResultData (SamplingStats a))
-> ResultName
-> ResultId
-> (SamplingStats a -> Double)
-> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (SamplingStats a))
c ResultName
"mean" ResultId
SamplingStatsMeanId SamplingStats a -> Double
forall a. SamplingStats a -> Double
samplingStatsMean,
      ResultContainer (ResultData (SamplingStats a))
-> ResultName
-> ResultId
-> (SamplingStats a -> Double)
-> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (SamplingStats a))
c ResultName
"mean2" ResultId
SamplingStatsMean2Id SamplingStats a -> Double
forall a. SamplingStats a -> Double
samplingStatsMean2,
      ResultContainer (ResultData (SamplingStats a))
-> ResultName
-> ResultId
-> (SamplingStats a -> Double)
-> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (SamplingStats a))
c ResultName
"std" ResultId
SamplingStatsDeviationId SamplingStats a -> Double
forall a. SamplingStats a -> Double
samplingStatsDeviation,
      ResultContainer (ResultData (SamplingStats a))
-> ResultName
-> ResultId
-> (SamplingStats a -> Double)
-> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (SamplingStats a))
c ResultName
"var" ResultId
SamplingStatsVarianceId SamplingStats a -> Double
forall a. SamplingStats a -> Double
samplingStatsVariance,
      ResultContainer (ResultData (SamplingStats a))
-> ResultName
-> ResultId
-> (SamplingStats a -> a)
-> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (SamplingStats a))
c ResultName
"min" ResultId
SamplingStatsMinId SamplingStats a -> a
forall a. SamplingStats a -> a
samplingStatsMin,
      ResultContainer (ResultData (SamplingStats a))
-> ResultName
-> ResultId
-> (SamplingStats a -> a)
-> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (SamplingStats a))
c ResultName
"max" ResultId
SamplingStatsMaxId SamplingStats a -> a
forall a. SamplingStats a -> a
samplingStatsMax ] }
  where
    c :: ResultContainer (ResultData (SamplingStats a))
c = ResultValue (SamplingStats a)
-> ResultContainer (ResultData (SamplingStats a))
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 :: ResultValue (SamplingStats a) -> ResultSource
samplingStatsResultSummary = ResultItem -> ResultSource
ResultItemSource (ResultItem -> ResultSource)
-> (ResultValue (SamplingStats a) -> ResultItem)
-> ResultValue (SamplingStats a)
-> ResultSource
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue ResultName -> ResultItem
forall a. ResultItemable a => a -> ResultItem
ResultItem (ResultValue ResultName -> ResultItem)
-> (ResultValue (SamplingStats a) -> ResultValue ResultName)
-> ResultValue (SamplingStats a)
-> ResultItem
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue (SamplingStats a) -> ResultValue ResultName
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 :: ResultValue (TimingStats a) -> ResultSource
timingStatsResultSource ResultValue (TimingStats a)
x =
  ResultObject -> ResultSource
ResultObjectSource (ResultObject -> ResultSource) -> ResultObject -> ResultSource
forall a b. (a -> b) -> a -> b
$
  ResultObject :: ResultName
-> ResultId
-> ResultId
-> [ResultProperty]
-> ResultSignal
-> ResultSource
-> ResultObject
ResultObject {
    resultObjectName :: ResultName
resultObjectName      = ResultValue (TimingStats a) -> ResultName
forall e. ResultValue e -> ResultName
resultValueName ResultValue (TimingStats a)
x,
    resultObjectId :: ResultId
resultObjectId        = ResultValue (TimingStats a) -> ResultId
forall e. ResultValue e -> ResultId
resultValueId ResultValue (TimingStats a)
x,
    resultObjectTypeId :: ResultId
resultObjectTypeId    = ResultId
TimingStatsId,
    resultObjectSignal :: ResultSignal
resultObjectSignal    = ResultValue (TimingStats a) -> ResultSignal
forall e. ResultValue e -> ResultSignal
resultValueSignal ResultValue (TimingStats a)
x,
    resultObjectSummary :: ResultSource
resultObjectSummary   = ResultValue (TimingStats a) -> ResultSource
forall a.
(TimingData a, ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingStats a) -> ResultSource
timingStatsResultSummary ResultValue (TimingStats a)
x,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      ResultContainer (ResultData (TimingStats a))
-> ResultName
-> ResultId
-> (TimingStats a -> Int)
-> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingStats a))
c ResultName
"count" ResultId
TimingStatsCountId TimingStats a -> Int
forall a. TimingStats a -> Int
timingStatsCount,
      ResultContainer (ResultData (TimingStats a))
-> ResultName
-> ResultId
-> (TimingStats a -> Double)
-> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingStats a))
c ResultName
"mean" ResultId
TimingStatsMeanId TimingStats a -> Double
forall a. TimingData a => TimingStats a -> Double
timingStatsMean,
      ResultContainer (ResultData (TimingStats a))
-> ResultName
-> ResultId
-> (TimingStats a -> Double)
-> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingStats a))
c ResultName
"std" ResultId
TimingStatsDeviationId TimingStats a -> Double
forall a. TimingData a => TimingStats a -> Double
timingStatsDeviation,
      ResultContainer (ResultData (TimingStats a))
-> ResultName
-> ResultId
-> (TimingStats a -> Double)
-> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingStats a))
c ResultName
"var" ResultId
TimingStatsVarianceId TimingStats a -> Double
forall a. TimingData a => TimingStats a -> Double
timingStatsVariance,
      ResultContainer (ResultData (TimingStats a))
-> ResultName -> ResultId -> (TimingStats a -> a) -> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingStats a))
c ResultName
"min" ResultId
TimingStatsMinId TimingStats a -> a
forall a. TimingStats a -> a
timingStatsMin,
      ResultContainer (ResultData (TimingStats a))
-> ResultName -> ResultId -> (TimingStats a -> a) -> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingStats a))
c ResultName
"max" ResultId
TimingStatsMaxId TimingStats a -> a
forall a. TimingStats a -> a
timingStatsMax,
      ResultContainer (ResultData (TimingStats a))
-> ResultName
-> ResultId
-> (TimingStats a -> Double)
-> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingStats a))
c ResultName
"minTime" ResultId
TimingStatsMinTimeId TimingStats a -> Double
forall a. TimingStats a -> Double
timingStatsMinTime,
      ResultContainer (ResultData (TimingStats a))
-> ResultName
-> ResultId
-> (TimingStats a -> Double)
-> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingStats a))
c ResultName
"maxTime" ResultId
TimingStatsMaxTimeId TimingStats a -> Double
forall a. TimingStats a -> Double
timingStatsMaxTime,
      ResultContainer (ResultData (TimingStats a))
-> ResultName
-> ResultId
-> (TimingStats a -> Double)
-> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingStats a))
c ResultName
"startTime" ResultId
TimingStatsStartTimeId TimingStats a -> Double
forall a. TimingStats a -> Double
timingStatsStartTime,
      ResultContainer (ResultData (TimingStats a))
-> ResultName
-> ResultId
-> (TimingStats a -> Double)
-> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingStats a))
c ResultName
"lastTime" ResultId
TimingStatsLastTimeId TimingStats a -> Double
forall a. TimingStats a -> Double
timingStatsLastTime,
      ResultContainer (ResultData (TimingStats a))
-> ResultName
-> ResultId
-> (TimingStats a -> Double)
-> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingStats a))
c ResultName
"sum" ResultId
TimingStatsSumId TimingStats a -> Double
forall a. TimingStats a -> Double
timingStatsSum,
      ResultContainer (ResultData (TimingStats a))
-> ResultName
-> ResultId
-> (TimingStats a -> Double)
-> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingStats a))
c ResultName
"sum2" ResultId
TimingStatsSum2Id TimingStats a -> Double
forall a. TimingStats a -> Double
timingStatsSum2 ] }
  where
    c :: ResultContainer (ResultData (TimingStats a))
c = ResultValue (TimingStats a)
-> ResultContainer (ResultData (TimingStats a))
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 :: ResultValue (TimingStats a) -> ResultSource
timingStatsResultSummary = ResultItem -> ResultSource
ResultItemSource (ResultItem -> ResultSource)
-> (ResultValue (TimingStats a) -> ResultItem)
-> ResultValue (TimingStats a)
-> ResultSource
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue ResultName -> ResultItem
forall a. ResultItemable a => a -> ResultItem
ResultItem (ResultValue ResultName -> ResultItem)
-> (ResultValue (TimingStats a) -> ResultValue ResultName)
-> ResultValue (TimingStats a)
-> ResultItem
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ResultValue (TimingStats a) -> ResultValue ResultName
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 :: ResultValue (SamplingCounter a) -> ResultSource
samplingCounterResultSource ResultValue (SamplingCounter a)
x =
  ResultObject -> ResultSource
ResultObjectSource (ResultObject -> ResultSource) -> ResultObject -> ResultSource
forall a b. (a -> b) -> a -> b
$
  ResultObject :: ResultName
-> ResultId
-> ResultId
-> [ResultProperty]
-> ResultSignal
-> ResultSource
-> ResultObject
ResultObject {
    resultObjectName :: ResultName
resultObjectName      = ResultValue (SamplingCounter a) -> ResultName
forall e. ResultValue e -> ResultName
resultValueName ResultValue (SamplingCounter a)
x,
    resultObjectId :: ResultId
resultObjectId        = ResultValue (SamplingCounter a) -> ResultId
forall e. ResultValue e -> ResultId
resultValueId ResultValue (SamplingCounter a)
x,
    resultObjectTypeId :: ResultId
resultObjectTypeId    = ResultId
SamplingCounterId,
    resultObjectSignal :: ResultSignal
resultObjectSignal    = ResultValue (SamplingCounter a) -> ResultSignal
forall e. ResultValue e -> ResultSignal
resultValueSignal ResultValue (SamplingCounter a)
x,
    resultObjectSummary :: ResultSource
resultObjectSummary   = ResultValue (SamplingCounter a) -> ResultSource
forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (SamplingStats a))) =>
ResultValue (SamplingCounter a) -> ResultSource
samplingCounterResultSummary ResultValue (SamplingCounter a)
x,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      ResultContainer (ResultData (SamplingCounter a))
-> ResultName
-> ResultId
-> (SamplingCounter a -> a)
-> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (SamplingCounter a))
c ResultName
"value" ResultId
SamplingCounterValueId SamplingCounter a -> a
forall a. SamplingCounter a -> a
samplingCounterValue,
      ResultContainer (ResultData (SamplingCounter a))
-> ResultName
-> ResultId
-> (SamplingCounter a -> SamplingStats a)
-> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (SamplingCounter a))
c ResultName
"stats" ResultId
SamplingCounterStatsId SamplingCounter a -> SamplingStats a
forall a. SamplingCounter a -> SamplingStats a
samplingCounterStats ] }
  where
    c :: ResultContainer (ResultData (SamplingCounter a))
c = ResultValue (SamplingCounter a)
-> ResultContainer (ResultData (SamplingCounter a))
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 :: ResultValue (SamplingCounter a) -> ResultSource
samplingCounterResultSummary ResultValue (SamplingCounter a)
x =
  ResultObject -> ResultSource
ResultObjectSource (ResultObject -> ResultSource) -> ResultObject -> ResultSource
forall a b. (a -> b) -> a -> b
$
  ResultObject :: ResultName
-> ResultId
-> ResultId
-> [ResultProperty]
-> ResultSignal
-> ResultSource
-> ResultObject
ResultObject {
    resultObjectName :: ResultName
resultObjectName      = ResultValue (SamplingCounter a) -> ResultName
forall e. ResultValue e -> ResultName
resultValueName ResultValue (SamplingCounter a)
x,
    resultObjectId :: ResultId
resultObjectId        = ResultValue (SamplingCounter a) -> ResultId
forall e. ResultValue e -> ResultId
resultValueId ResultValue (SamplingCounter a)
x,
    resultObjectTypeId :: ResultId
resultObjectTypeId    = ResultId
SamplingCounterId,
    resultObjectSignal :: ResultSignal
resultObjectSignal    = ResultValue (SamplingCounter a) -> ResultSignal
forall e. ResultValue e -> ResultSignal
resultValueSignal ResultValue (SamplingCounter a)
x,
    resultObjectSummary :: ResultSource
resultObjectSummary   = ResultValue (SamplingCounter a) -> ResultSource
forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (SamplingStats a))) =>
ResultValue (SamplingCounter a) -> ResultSource
samplingCounterResultSummary ResultValue (SamplingCounter a)
x,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      ResultContainer (ResultData (SamplingCounter a))
-> ResultName
-> ResultId
-> (SamplingCounter a -> a)
-> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (SamplingCounter a))
c ResultName
"value" ResultId
SamplingCounterValueId SamplingCounter a -> a
forall a. SamplingCounter a -> a
samplingCounterValue,
      ResultContainer (ResultData (SamplingCounter a))
-> ResultName
-> ResultId
-> (SamplingCounter a -> SamplingStats a)
-> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (SamplingCounter a))
c ResultName
"stats" ResultId
SamplingCounterStatsId SamplingCounter a -> SamplingStats a
forall a. SamplingCounter a -> SamplingStats a
samplingCounterStats ] }
  where
    c :: ResultContainer (ResultData (SamplingCounter a))
c = ResultValue (SamplingCounter a)
-> ResultContainer (ResultData (SamplingCounter a))
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 :: ResultValue (TimingCounter a) -> ResultSource
timingCounterResultSource ResultValue (TimingCounter a)
x =
  ResultObject -> ResultSource
ResultObjectSource (ResultObject -> ResultSource) -> ResultObject -> ResultSource
forall a b. (a -> b) -> a -> b
$
  ResultObject :: ResultName
-> ResultId
-> ResultId
-> [ResultProperty]
-> ResultSignal
-> ResultSource
-> ResultObject
ResultObject {
    resultObjectName :: ResultName
resultObjectName      = ResultValue (TimingCounter a) -> ResultName
forall e. ResultValue e -> ResultName
resultValueName ResultValue (TimingCounter a)
x,
    resultObjectId :: ResultId
resultObjectId        = ResultValue (TimingCounter a) -> ResultId
forall e. ResultValue e -> ResultId
resultValueId ResultValue (TimingCounter a)
x,
    resultObjectTypeId :: ResultId
resultObjectTypeId    = ResultId
TimingCounterId,
    resultObjectSignal :: ResultSignal
resultObjectSignal    = ResultValue (TimingCounter a) -> ResultSignal
forall e. ResultValue e -> ResultSignal
resultValueSignal ResultValue (TimingCounter a)
x,
    resultObjectSummary :: ResultSource
resultObjectSummary   = ResultValue (TimingCounter a) -> ResultSource
forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingCounter a) -> ResultSource
timingCounterResultSummary ResultValue (TimingCounter a)
x,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      ResultContainer (ResultData (TimingCounter a))
-> ResultName
-> ResultId
-> (TimingCounter a -> a)
-> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingCounter a))
c ResultName
"value" ResultId
TimingCounterValueId TimingCounter a -> a
forall a. TimingCounter a -> a
timingCounterValue,
      ResultContainer (ResultData (TimingCounter a))
-> ResultName
-> ResultId
-> (TimingCounter a -> TimingStats a)
-> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingCounter a))
c ResultName
"stats" ResultId
TimingCounterStatsId TimingCounter a -> TimingStats a
forall a. TimingCounter a -> TimingStats a
timingCounterStats ] }
  where
    c :: ResultContainer (ResultData (TimingCounter a))
c = ResultValue (TimingCounter a)
-> ResultContainer (ResultData (TimingCounter a))
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 :: ResultValue (TimingCounter a) -> ResultSource
timingCounterResultSummary ResultValue (TimingCounter a)
x =
  ResultObject -> ResultSource
ResultObjectSource (ResultObject -> ResultSource) -> ResultObject -> ResultSource
forall a b. (a -> b) -> a -> b
$
  ResultObject :: ResultName
-> ResultId
-> ResultId
-> [ResultProperty]
-> ResultSignal
-> ResultSource
-> ResultObject
ResultObject {
    resultObjectName :: ResultName
resultObjectName      = ResultValue (TimingCounter a) -> ResultName
forall e. ResultValue e -> ResultName
resultValueName ResultValue (TimingCounter a)
x,
    resultObjectId :: ResultId
resultObjectId        = ResultValue (TimingCounter a) -> ResultId
forall e. ResultValue e -> ResultId
resultValueId ResultValue (TimingCounter a)
x,
    resultObjectTypeId :: ResultId
resultObjectTypeId    = ResultId
TimingCounterId,
    resultObjectSignal :: ResultSignal
resultObjectSignal    = ResultValue (TimingCounter a) -> ResultSignal
forall e. ResultValue e -> ResultSignal
resultValueSignal ResultValue (TimingCounter a)
x,
    resultObjectSummary :: ResultSource
resultObjectSummary   = ResultValue (TimingCounter a) -> ResultSource
forall a.
(ResultItemable (ResultValue a),
 ResultItemable (ResultValue (TimingStats a))) =>
ResultValue (TimingCounter a) -> ResultSource
timingCounterResultSummary ResultValue (TimingCounter a)
x,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      ResultContainer (ResultData (TimingCounter a))
-> ResultName
-> ResultId
-> (TimingCounter a -> a)
-> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingCounter a))
c ResultName
"value" ResultId
TimingCounterValueId TimingCounter a -> a
forall a. TimingCounter a -> a
timingCounterValue,
      ResultContainer (ResultData (TimingCounter a))
-> ResultName
-> ResultId
-> (TimingCounter a -> TimingStats a)
-> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer (ResultData a)
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerMapProperty ResultContainer (ResultData (TimingCounter a))
c ResultName
"stats" ResultId
TimingCounterStatsId TimingCounter a -> TimingStats a
forall a. TimingCounter a -> TimingStats a
timingCounterStats ] }
  where
    c :: ResultContainer (ResultData (TimingCounter a))
c = ResultValue (TimingCounter a)
-> ResultContainer (ResultData (TimingCounter a))
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 :: ResultContainer (Queue si sm so a) -> ResultSource
queueResultSource ResultContainer (Queue si sm so a)
c =
  ResultObject -> ResultSource
ResultObjectSource (ResultObject -> ResultSource) -> ResultObject -> ResultSource
forall a b. (a -> b) -> a -> b
$
  ResultObject :: ResultName
-> ResultId
-> ResultId
-> [ResultProperty]
-> ResultSignal
-> ResultSource
-> ResultObject
ResultObject {
    resultObjectName :: ResultName
resultObjectName = ResultContainer (Queue si sm so a) -> ResultName
forall e. ResultContainer e -> ResultName
resultContainerName ResultContainer (Queue si sm so a)
c,
    resultObjectId :: ResultId
resultObjectId = ResultContainer (Queue si sm so a) -> ResultId
forall e. ResultContainer e -> ResultId
resultContainerId ResultContainer (Queue si sm so a)
c,
    resultObjectTypeId :: ResultId
resultObjectTypeId = ResultId
FiniteQueueId,
    resultObjectSignal :: ResultSignal
resultObjectSignal = ResultContainer (Queue si sm so a) -> ResultSignal
forall e. ResultContainer e -> ResultSignal
resultContainerSignal ResultContainer (Queue si sm so a)
c,
    resultObjectSummary :: ResultSource
resultObjectSummary = ResultContainer (Queue si sm so a) -> ResultSource
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 = [
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> si)
-> ResultProperty
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 Queue si sm so a -> si
forall si sm so a. Queue si sm so a -> si
Q.enqueueStrategy,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> sm)
-> ResultProperty
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 Queue si sm so a -> sm
forall si sm so a. Queue si sm so a -> sm
Q.enqueueStoringStrategy,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> so)
-> ResultProperty
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 Queue si sm so a -> so
forall si sm so a. Queue si sm so a -> so
Q.dequeueStrategy,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Event Bool)
-> (Queue si sm so a -> Signal ())
-> ResultProperty
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 Queue si sm so a -> Event Bool
forall si sm so a. Queue si sm so a -> Event Bool
Q.queueNull Queue si sm so a -> Signal ()
forall si sm so a. Queue si sm so a -> Signal ()
Q.queueNullChanged_,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Event Bool)
-> (Queue si sm so a -> Signal ())
-> ResultProperty
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 Queue si sm so a -> Event Bool
forall si sm so a. Queue si sm so a -> Event Bool
Q.queueFull Queue si sm so a -> Signal ()
forall si sm so a. Queue si sm so a -> Signal ()
Q.queueFullChanged_,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Int)
-> ResultProperty
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 Queue si sm so a -> Int
forall si sm so a. Queue si sm so a -> Int
Q.queueMaxCount,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Event Int)
-> (Queue si sm so a -> Signal ())
-> ResultProperty
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 Queue si sm so a -> Event Int
forall si sm so a. Queue si sm so a -> Event Int
Q.queueCount Queue si sm so a -> Signal ()
forall si sm so a. Queue si sm so a -> Signal ()
Q.queueCountChanged_,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Event (TimingStats Int))
-> (Queue si sm so a -> Signal ())
-> ResultProperty
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 Queue si sm so a -> Event (TimingStats Int)
forall si sm so a. Queue si sm so a -> Event (TimingStats Int)
Q.queueCountStats Queue si sm so a -> Signal ()
forall si sm so a. Queue si sm so a -> Signal ()
Q.queueCountChanged_,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Event Int)
-> (Queue si sm so a -> Signal ())
-> ResultProperty
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 Queue si sm so a -> Event Int
forall si sm so a. Queue si sm so a -> Event Int
Q.enqueueCount Queue si sm so a -> Signal ()
forall si sm so a. Queue si sm so a -> Signal ()
Q.enqueueCountChanged_,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Event Int)
-> (Queue si sm so a -> Signal ())
-> ResultProperty
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 Queue si sm so a -> Event Int
forall si sm so a. Queue si sm so a -> Event Int
Q.enqueueLostCount Queue si sm so a -> Signal ()
forall si sm so a. Queue si sm so a -> Signal ()
Q.enqueueLostCountChanged_,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Event Int)
-> (Queue si sm so a -> Signal ())
-> ResultProperty
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 Queue si sm so a -> Event Int
forall si sm so a. Queue si sm so a -> Event Int
Q.enqueueStoreCount Queue si sm so a -> Signal ()
forall si sm so a. Queue si sm so a -> Signal ()
Q.enqueueStoreCountChanged_,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Event Int)
-> (Queue si sm so a -> Signal ())
-> ResultProperty
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 Queue si sm so a -> Event Int
forall si sm so a. Queue si sm so a -> Event Int
Q.dequeueCount Queue si sm so a -> Signal ()
forall si sm so a. Queue si sm so a -> Signal ()
Q.dequeueCountChanged_,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Event Int)
-> (Queue si sm so a -> Signal ())
-> ResultProperty
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 Queue si sm so a -> Event Int
forall si sm so a. Queue si sm so a -> Event Int
Q.dequeueExtractCount Queue si sm so a -> Signal ()
forall si sm so a. Queue si sm so a -> Signal ()
Q.dequeueExtractCountChanged_,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Event Double)
-> (Queue si sm so a -> Signal ())
-> ResultProperty
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 Queue si sm so a -> Event Double
forall si sm so a. Queue si sm so a -> Event Double
Q.queueLoadFactor Queue si sm so a -> Signal ()
forall si sm so a. Queue si sm so a -> Signal ()
Q.queueLoadFactorChanged_,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Event Double)
-> ResultProperty
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 Queue si sm so a -> Event Double
forall si sm so a. Queue si sm so a -> Event Double
Q.enqueueRate,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Event Double)
-> ResultProperty
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 Queue si sm so a -> Event Double
forall si sm so a. Queue si sm so a -> Event Double
Q.enqueueStoreRate,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Event Double)
-> ResultProperty
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 Queue si sm so a -> Event Double
forall si sm so a. Queue si sm so a -> Event Double
Q.dequeueRate,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Event Double)
-> ResultProperty
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 Queue si sm so a -> Event Double
forall si sm so a. Queue si sm so a -> Event Double
Q.dequeueExtractRate,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Event (SamplingStats Double))
-> (Queue si sm so a -> Signal ())
-> ResultProperty
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 Queue si sm so a -> Event (SamplingStats Double)
forall si sm so a. Queue si sm so a -> Event (SamplingStats Double)
Q.queueWaitTime Queue si sm so a -> Signal ()
forall si sm so a. Queue si sm so a -> Signal ()
Q.queueWaitTimeChanged_,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Event (SamplingStats Double))
-> (Queue si sm so a -> Signal ())
-> ResultProperty
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 Queue si sm so a -> Event (SamplingStats Double)
forall si sm so a. Queue si sm so a -> Event (SamplingStats Double)
Q.queueTotalWaitTime Queue si sm so a -> Signal ()
forall si sm so a. Queue si sm so a -> Signal ()
Q.queueTotalWaitTimeChanged_,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Event (SamplingStats Double))
-> (Queue si sm so a -> Signal ())
-> ResultProperty
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 Queue si sm so a -> Event (SamplingStats Double)
forall si sm so a. Queue si sm so a -> Event (SamplingStats Double)
Q.enqueueWaitTime Queue si sm so a -> Signal ()
forall si sm so a. Queue si sm so a -> Signal ()
Q.enqueueWaitTimeChanged_,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Event (SamplingStats Double))
-> (Queue si sm so a -> Signal ())
-> ResultProperty
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 Queue si sm so a -> Event (SamplingStats Double)
forall si sm so a. Queue si sm so a -> Event (SamplingStats Double)
Q.dequeueWaitTime Queue si sm so a -> Signal ()
forall si sm so a. Queue si sm so a -> Signal ()
Q.dequeueWaitTimeChanged_,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Event Double)
-> (Queue si sm so a -> Signal ())
-> ResultProperty
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 Queue si sm so a -> Event Double
forall si sm so a. Queue si sm so a -> Event Double
Q.queueRate Queue si sm so a -> Signal ()
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 :: ResultContainer (Queue si sm so a) -> ResultSource
queueResultSummary ResultContainer (Queue si sm so a)
c =
  ResultObject -> ResultSource
ResultObjectSource (ResultObject -> ResultSource) -> ResultObject -> ResultSource
forall a b. (a -> b) -> a -> b
$
  ResultObject :: ResultName
-> ResultId
-> ResultId
-> [ResultProperty]
-> ResultSignal
-> ResultSource
-> ResultObject
ResultObject {
    resultObjectName :: ResultName
resultObjectName = ResultContainer (Queue si sm so a) -> ResultName
forall e. ResultContainer e -> ResultName
resultContainerName ResultContainer (Queue si sm so a)
c,
    resultObjectId :: ResultId
resultObjectId = ResultContainer (Queue si sm so a) -> ResultId
forall e. ResultContainer e -> ResultId
resultContainerId ResultContainer (Queue si sm so a)
c,
    resultObjectTypeId :: ResultId
resultObjectTypeId = ResultId
FiniteQueueId,
    resultObjectSignal :: ResultSignal
resultObjectSignal = ResultContainer (Queue si sm so a) -> ResultSignal
forall e. ResultContainer e -> ResultSignal
resultContainerSignal ResultContainer (Queue si sm so a)
c,
    resultObjectSummary :: ResultSource
resultObjectSummary = ResultContainer (Queue si sm so a) -> ResultSource
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 = [
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Int)
-> ResultProperty
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 Queue si sm so a -> Int
forall si sm so a. Queue si sm so a -> Int
Q.queueMaxCount,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Event (TimingStats Int))
-> (Queue si sm so a -> Signal ())
-> ResultProperty
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 Queue si sm so a -> Event (TimingStats Int)
forall si sm so a. Queue si sm so a -> Event (TimingStats Int)
Q.queueCountStats Queue si sm so a -> Signal ()
forall si sm so a. Queue si sm so a -> Signal ()
Q.queueCountChanged_,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Event Int)
-> (Queue si sm so a -> Signal ())
-> ResultProperty
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 Queue si sm so a -> Event Int
forall si sm so a. Queue si sm so a -> Event Int
Q.enqueueCount Queue si sm so a -> Signal ()
forall si sm so a. Queue si sm so a -> Signal ()
Q.enqueueCountChanged_,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Event Int)
-> (Queue si sm so a -> Signal ())
-> ResultProperty
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 Queue si sm so a -> Event Int
forall si sm so a. Queue si sm so a -> Event Int
Q.enqueueLostCount Queue si sm so a -> Signal ()
forall si sm so a. Queue si sm so a -> Signal ()
Q.enqueueLostCountChanged_,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Event Int)
-> (Queue si sm so a -> Signal ())
-> ResultProperty
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 Queue si sm so a -> Event Int
forall si sm so a. Queue si sm so a -> Event Int
Q.enqueueStoreCount Queue si sm so a -> Signal ()
forall si sm so a. Queue si sm so a -> Signal ()
Q.enqueueStoreCountChanged_,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Event Int)
-> (Queue si sm so a -> Signal ())
-> ResultProperty
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 Queue si sm so a -> Event Int
forall si sm so a. Queue si sm so a -> Event Int
Q.dequeueCount Queue si sm so a -> Signal ()
forall si sm so a. Queue si sm so a -> Signal ()
Q.dequeueCountChanged_,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Event Int)
-> (Queue si sm so a -> Signal ())
-> ResultProperty
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 Queue si sm so a -> Event Int
forall si sm so a. Queue si sm so a -> Event Int
Q.dequeueExtractCount Queue si sm so a -> Signal ()
forall si sm so a. Queue si sm so a -> Signal ()
Q.dequeueExtractCountChanged_,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Event Double)
-> (Queue si sm so a -> Signal ())
-> ResultProperty
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 Queue si sm so a -> Event Double
forall si sm so a. Queue si sm so a -> Event Double
Q.queueLoadFactor Queue si sm so a -> Signal ()
forall si sm so a. Queue si sm so a -> Signal ()
Q.queueLoadFactorChanged_,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Event (SamplingStats Double))
-> (Queue si sm so a -> Signal ())
-> ResultProperty
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 Queue si sm so a -> Event (SamplingStats Double)
forall si sm so a. Queue si sm so a -> Event (SamplingStats Double)
Q.queueWaitTime Queue si sm so a -> Signal ()
forall si sm so a. Queue si sm so a -> Signal ()
Q.queueWaitTimeChanged_,
      ResultContainer (Queue si sm so a)
-> ResultName
-> ResultId
-> (Queue si sm so a -> Event Double)
-> (Queue si sm so a -> Signal ())
-> ResultProperty
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 Queue si sm so a -> Event Double
forall si sm so a. Queue si sm so a -> Event Double
Q.queueRate Queue si sm so a -> Signal ()
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 :: ResultContainer (Queue sm so a) -> ResultSource
infiniteQueueResultSource ResultContainer (Queue sm so a)
c =
  ResultObject -> ResultSource
ResultObjectSource (ResultObject -> ResultSource) -> ResultObject -> ResultSource
forall a b. (a -> b) -> a -> b
$
  ResultObject :: ResultName
-> ResultId
-> ResultId
-> [ResultProperty]
-> ResultSignal
-> ResultSource
-> ResultObject
ResultObject {
    resultObjectName :: ResultName
resultObjectName = ResultContainer (Queue sm so a) -> ResultName
forall e. ResultContainer e -> ResultName
resultContainerName ResultContainer (Queue sm so a)
c,
    resultObjectId :: ResultId
resultObjectId = ResultContainer (Queue sm so a) -> ResultId
forall e. ResultContainer e -> ResultId
resultContainerId ResultContainer (Queue sm so a)
c,
    resultObjectTypeId :: ResultId
resultObjectTypeId = ResultId
FiniteQueueId,
    resultObjectSignal :: ResultSignal
resultObjectSignal = ResultContainer (Queue sm so a) -> ResultSignal
forall e. ResultContainer e -> ResultSignal
resultContainerSignal ResultContainer (Queue sm so a)
c,
    resultObjectSummary :: ResultSource
resultObjectSummary = ResultContainer (Queue sm so a) -> ResultSource
forall sm so a.
(Show sm, Show so) =>
ResultContainer (Queue sm so a) -> ResultSource
infiniteQueueResultSummary ResultContainer (Queue sm so a)
c,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      ResultContainer (Queue sm so a)
-> ResultName
-> ResultId
-> (Queue sm so a -> sm)
-> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerConstProperty ResultContainer (Queue sm so a)
c ResultName
"enqueueStoringStrategy" ResultId
EnqueueStoringStrategyId Queue sm so a -> sm
forall sm so a. Queue sm so a -> sm
IQ.enqueueStoringStrategy,
      ResultContainer (Queue sm so a)
-> ResultName
-> ResultId
-> (Queue sm so a -> so)
-> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerConstProperty ResultContainer (Queue sm so a)
c ResultName
"dequeueStrategy" ResultId
DequeueStrategyId Queue sm so a -> so
forall sm so a. Queue sm so a -> so
IQ.dequeueStrategy,
      ResultContainer (Queue sm so a)
-> ResultName
-> ResultId
-> (Queue sm so a -> Event Bool)
-> (Queue sm so a -> Signal ())
-> ResultProperty
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 Queue sm so a -> Event Bool
forall sm so a. Queue sm so a -> Event Bool
IQ.queueNull Queue sm so a -> Signal ()
forall sm so a. Queue sm so a -> Signal ()
IQ.queueNullChanged_,
      ResultContainer (Queue sm so a)
-> ResultName
-> ResultId
-> (Queue sm so a -> Event Int)
-> (Queue sm so a -> Signal ())
-> ResultProperty
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 Queue sm so a -> Event Int
forall sm so a. Queue sm so a -> Event Int
IQ.queueCount Queue sm so a -> Signal ()
forall sm so a. Queue sm so a -> Signal ()
IQ.queueCountChanged_,
      ResultContainer (Queue sm so a)
-> ResultName
-> ResultId
-> (Queue sm so a -> Event (TimingStats Int))
-> (Queue sm so a -> Signal ())
-> ResultProperty
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 Queue sm so a -> Event (TimingStats Int)
forall sm so a. Queue sm so a -> Event (TimingStats Int)
IQ.queueCountStats Queue sm so a -> Signal ()
forall sm so a. Queue sm so a -> Signal ()
IQ.queueCountChanged_,
      ResultContainer (Queue sm so a)
-> ResultName
-> ResultId
-> (Queue sm so a -> Event Int)
-> (Queue sm so a -> Signal ())
-> ResultProperty
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 Queue sm so a -> Event Int
forall sm so a. Queue sm so a -> Event Int
IQ.enqueueStoreCount Queue sm so a -> Signal ()
forall sm so a. Queue sm so a -> Signal ()
IQ.enqueueStoreCountChanged_,
      ResultContainer (Queue sm so a)
-> ResultName
-> ResultId
-> (Queue sm so a -> Event Int)
-> (Queue sm so a -> Signal ())
-> ResultProperty
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 Queue sm so a -> Event Int
forall sm so a. Queue sm so a -> Event Int
IQ.dequeueCount Queue sm so a -> Signal ()
forall sm so a. Queue sm so a -> Signal ()
IQ.dequeueCountChanged_,
      ResultContainer (Queue sm so a)
-> ResultName
-> ResultId
-> (Queue sm so a -> Event Int)
-> (Queue sm so a -> Signal ())
-> ResultProperty
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 Queue sm so a -> Event Int
forall sm so a. Queue sm so a -> Event Int
IQ.dequeueExtractCount Queue sm so a -> Signal ()
forall sm so a. Queue sm so a -> Signal ()
IQ.dequeueExtractCountChanged_,
      ResultContainer (Queue sm so a)
-> ResultName
-> ResultId
-> (Queue sm so a -> Event Double)
-> ResultProperty
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 Queue sm so a -> Event Double
forall sm so a. Queue sm so a -> Event Double
IQ.enqueueStoreRate,
      ResultContainer (Queue sm so a)
-> ResultName
-> ResultId
-> (Queue sm so a -> Event Double)
-> ResultProperty
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 Queue sm so a -> Event Double
forall sm so a. Queue sm so a -> Event Double
IQ.dequeueRate,
      ResultContainer (Queue sm so a)
-> ResultName
-> ResultId
-> (Queue sm so a -> Event Double)
-> ResultProperty
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 Queue sm so a -> Event Double
forall sm so a. Queue sm so a -> Event Double
IQ.dequeueExtractRate,
      ResultContainer (Queue sm so a)
-> ResultName
-> ResultId
-> (Queue sm so a -> Event (SamplingStats Double))
-> (Queue sm so a -> Signal ())
-> ResultProperty
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 Queue sm so a -> Event (SamplingStats Double)
forall sm so a. Queue sm so a -> Event (SamplingStats Double)
IQ.queueWaitTime Queue sm so a -> Signal ()
forall sm so a. Queue sm so a -> Signal ()
IQ.queueWaitTimeChanged_,
      ResultContainer (Queue sm so a)
-> ResultName
-> ResultId
-> (Queue sm so a -> Event (SamplingStats Double))
-> (Queue sm so a -> Signal ())
-> ResultProperty
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 Queue sm so a -> Event (SamplingStats Double)
forall sm so a. Queue sm so a -> Event (SamplingStats Double)
IQ.dequeueWaitTime Queue sm so a -> Signal ()
forall sm so a. Queue sm so a -> Signal ()
IQ.dequeueWaitTimeChanged_,
      ResultContainer (Queue sm so a)
-> ResultName
-> ResultId
-> (Queue sm so a -> Event Double)
-> (Queue sm so a -> Signal ())
-> ResultProperty
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 Queue sm so a -> Event Double
forall sm so a. Queue sm so a -> Event Double
IQ.queueRate Queue sm so a -> Signal ()
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 :: ResultContainer (Queue sm so a) -> ResultSource
infiniteQueueResultSummary ResultContainer (Queue sm so a)
c =
  ResultObject -> ResultSource
ResultObjectSource (ResultObject -> ResultSource) -> ResultObject -> ResultSource
forall a b. (a -> b) -> a -> b
$
  ResultObject :: ResultName
-> ResultId
-> ResultId
-> [ResultProperty]
-> ResultSignal
-> ResultSource
-> ResultObject
ResultObject {
    resultObjectName :: ResultName
resultObjectName = ResultContainer (Queue sm so a) -> ResultName
forall e. ResultContainer e -> ResultName
resultContainerName ResultContainer (Queue sm so a)
c,
    resultObjectId :: ResultId
resultObjectId = ResultContainer (Queue sm so a) -> ResultId
forall e. ResultContainer e -> ResultId
resultContainerId ResultContainer (Queue sm so a)
c,
    resultObjectTypeId :: ResultId
resultObjectTypeId = ResultId
FiniteQueueId,
    resultObjectSignal :: ResultSignal
resultObjectSignal = ResultContainer (Queue sm so a) -> ResultSignal
forall e. ResultContainer e -> ResultSignal
resultContainerSignal ResultContainer (Queue sm so a)
c,
    resultObjectSummary :: ResultSource
resultObjectSummary = ResultContainer (Queue sm so a) -> ResultSource
forall sm so a.
(Show sm, Show so) =>
ResultContainer (Queue sm so a) -> ResultSource
infiniteQueueResultSummary ResultContainer (Queue sm so a)
c,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      ResultContainer (Queue sm so a)
-> ResultName
-> ResultId
-> (Queue sm so a -> Event (TimingStats Int))
-> (Queue sm so a -> Signal ())
-> ResultProperty
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 Queue sm so a -> Event (TimingStats Int)
forall sm so a. Queue sm so a -> Event (TimingStats Int)
IQ.queueCountStats Queue sm so a -> Signal ()
forall sm so a. Queue sm so a -> Signal ()
IQ.queueCountChanged_,
      ResultContainer (Queue sm so a)
-> ResultName
-> ResultId
-> (Queue sm so a -> Event Int)
-> (Queue sm so a -> Signal ())
-> ResultProperty
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 Queue sm so a -> Event Int
forall sm so a. Queue sm so a -> Event Int
IQ.enqueueStoreCount Queue sm so a -> Signal ()
forall sm so a. Queue sm so a -> Signal ()
IQ.enqueueStoreCountChanged_,
      ResultContainer (Queue sm so a)
-> ResultName
-> ResultId
-> (Queue sm so a -> Event Int)
-> (Queue sm so a -> Signal ())
-> ResultProperty
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 Queue sm so a -> Event Int
forall sm so a. Queue sm so a -> Event Int
IQ.dequeueCount Queue sm so a -> Signal ()
forall sm so a. Queue sm so a -> Signal ()
IQ.dequeueCountChanged_,
      ResultContainer (Queue sm so a)
-> ResultName
-> ResultId
-> (Queue sm so a -> Event Int)
-> (Queue sm so a -> Signal ())
-> ResultProperty
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 Queue sm so a -> Event Int
forall sm so a. Queue sm so a -> Event Int
IQ.dequeueExtractCount Queue sm so a -> Signal ()
forall sm so a. Queue sm so a -> Signal ()
IQ.dequeueExtractCountChanged_,
      ResultContainer (Queue sm so a)
-> ResultName
-> ResultId
-> (Queue sm so a -> Event (SamplingStats Double))
-> (Queue sm so a -> Signal ())
-> ResultProperty
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 Queue sm so a -> Event (SamplingStats Double)
forall sm so a. Queue sm so a -> Event (SamplingStats Double)
IQ.queueWaitTime Queue sm so a -> Signal ()
forall sm so a. Queue sm so a -> Signal ()
IQ.queueWaitTimeChanged_,
      ResultContainer (Queue sm so a)
-> ResultName
-> ResultId
-> (Queue sm so a -> Event Double)
-> (Queue sm so a -> Signal ())
-> ResultProperty
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 Queue sm so a -> Event Double
forall sm so a. Queue sm so a -> Event Double
IQ.queueRate Queue sm so a -> Signal ()
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 (ResultObject -> ResultSource) -> ResultObject -> ResultSource
forall a b. (a -> b) -> a -> b
$
  ResultObject :: ResultName
-> ResultId
-> ResultId
-> [ResultProperty]
-> ResultSignal
-> ResultSource
-> ResultObject
ResultObject {
    resultObjectName :: ResultName
resultObjectName = ResultContainer ArrivalTimer -> ResultName
forall e. ResultContainer e -> ResultName
resultContainerName ResultContainer ArrivalTimer
c,
    resultObjectId :: ResultId
resultObjectId = ResultContainer ArrivalTimer -> ResultId
forall e. ResultContainer e -> ResultId
resultContainerId ResultContainer ArrivalTimer
c,
    resultObjectTypeId :: ResultId
resultObjectTypeId = ResultId
ArrivalTimerId,
    resultObjectSignal :: ResultSignal
resultObjectSignal = ResultContainer ArrivalTimer -> ResultSignal
forall e. ResultContainer e -> ResultSignal
resultContainerSignal ResultContainer ArrivalTimer
c,
    resultObjectSummary :: ResultSource
resultObjectSummary = ResultContainer ArrivalTimer -> ResultSource
arrivalTimerResultSummary ResultContainer ArrivalTimer
c,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      ResultContainer ArrivalTimer
-> ResultName
-> ResultId
-> (ArrivalTimer -> Event (SamplingStats Double))
-> (ArrivalTimer -> Signal ())
-> ResultProperty
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 (ResultObject -> ResultSource) -> ResultObject -> ResultSource
forall a b. (a -> b) -> a -> b
$
  ResultObject :: ResultName
-> ResultId
-> ResultId
-> [ResultProperty]
-> ResultSignal
-> ResultSource
-> ResultObject
ResultObject {
    resultObjectName :: ResultName
resultObjectName = ResultContainer ArrivalTimer -> ResultName
forall e. ResultContainer e -> ResultName
resultContainerName ResultContainer ArrivalTimer
c,
    resultObjectId :: ResultId
resultObjectId = ResultContainer ArrivalTimer -> ResultId
forall e. ResultContainer e -> ResultId
resultContainerId ResultContainer ArrivalTimer
c,
    resultObjectTypeId :: ResultId
resultObjectTypeId = ResultId
ArrivalTimerId,
    resultObjectSignal :: ResultSignal
resultObjectSignal = ResultContainer ArrivalTimer -> ResultSignal
forall e. ResultContainer e -> ResultSignal
resultContainerSignal ResultContainer ArrivalTimer
c,
    resultObjectSummary :: ResultSource
resultObjectSummary = ResultContainer ArrivalTimer -> ResultSource
arrivalTimerResultSummary ResultContainer ArrivalTimer
c,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      ResultContainer ArrivalTimer
-> ResultName
-> ResultId
-> (ArrivalTimer -> Event (SamplingStats Double))
-> (ArrivalTimer -> Signal ())
-> ResultProperty
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 :: ResultContainer (Server s a b) -> ResultSource
serverResultSource ResultContainer (Server s a b)
c =
  ResultObject -> ResultSource
ResultObjectSource (ResultObject -> ResultSource) -> ResultObject -> ResultSource
forall a b. (a -> b) -> a -> b
$
  ResultObject :: ResultName
-> ResultId
-> ResultId
-> [ResultProperty]
-> ResultSignal
-> ResultSource
-> ResultObject
ResultObject {
    resultObjectName :: ResultName
resultObjectName = ResultContainer (Server s a b) -> ResultName
forall e. ResultContainer e -> ResultName
resultContainerName ResultContainer (Server s a b)
c,
    resultObjectId :: ResultId
resultObjectId = ResultContainer (Server s a b) -> ResultId
forall e. ResultContainer e -> ResultId
resultContainerId ResultContainer (Server s a b)
c,
    resultObjectTypeId :: ResultId
resultObjectTypeId = ResultId
ServerId,
    resultObjectSignal :: ResultSignal
resultObjectSignal = ResultContainer (Server s a b) -> ResultSignal
forall e. ResultContainer e -> ResultSignal
resultContainerSignal ResultContainer (Server s a b)
c,
    resultObjectSummary :: ResultSource
resultObjectSummary = ResultContainer (Server s a b) -> ResultSource
forall s a b. ResultContainer (Server s a b) -> ResultSource
serverResultSummary ResultContainer (Server s a b)
c,
    resultObjectProperties :: [ResultProperty]
resultObjectProperties = [
      ResultContainer (Server s a b)
-> ResultName -> ResultId -> (Server s a b -> s) -> ResultProperty
forall b a.
ResultItemable (ResultValue b) =>
ResultContainer a
-> ResultName -> ResultId -> (a -> b) -> ResultProperty
resultContainerConstProperty ResultContainer (Server s a b)
c ResultName
"initState" ResultId
ServerInitStateId Server s a b -> s
forall s a b. Server s a b -> s
serverInitState,
      ResultContainer (Server s a b)
-> ResultName
-> ResultId
-> (Server s a b -> Event s)
-> (Server s a b -> Signal ())
-> ResultProperty
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 Server s a b -> Event s
forall s a b. Server s a b -> Event s
serverState Server s a b -> Signal ()
forall s a b. Server s a b -> Signal ()
serverStateChanged_,
      ResultContainer (Server s a b)
-> ResultName
-> ResultId
-> (Server s a b -> Event Double)
-> (Server s a b -> Signal ())
-> ResultProperty
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 Server s a b -> Event Double
forall s a b. Server s a b -> Event Double
serverTotalInputWaitTime Server s a b -> Signal ()
forall s a b. Server s a b -> Signal ()
serverTotalInputWaitTimeChanged_,
      ResultContainer (Server s a b)
-> ResultName
-> ResultId
-> (Server s a b -> Event Double)
-> (Server s a b -> Signal ())
-> ResultProperty
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 Server s a b -> Event Double
forall s a b. Server s a b -> Event Double
serverTotalProcessingTime Server s a b -> Signal ()
forall s a b. Server s a b -> Signal ()
serverTotalProcessingTimeChanged_,
      ResultContainer (Server s a b)
-> ResultName
-> ResultId
-> (Server s a b -> Event Double)
-> (Server s a b -> Signal ())
-> ResultProperty
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 Server s a b -> Event Double
forall s a b. Server s a b -> Event Double
serverTotalOutputWaitTime Server s a b -> Signal ()
forall s a b. Server s a b -> Signal ()
serverTotalOutputWaitTimeChanged_,
      ResultContainer (Server s a b)
-> ResultName
-> ResultId
-> (Server s a b -> Event Double)
-> (Server s a b -> Signal ())
-> ResultProperty
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 Server s a b -> Event Double
forall s a b. Server s a b -> Event Double
serverTotalPreemptionTime Server s a b -> Signal ()
forall s a b. Server s a b -> Signal ()
serverTotalPreemptionTimeChanged_,
      ResultContainer (Server s a b)
-> ResultName
-> ResultId
-> (Server s a b -> Event (SamplingStats Double))
-> (Server s a b -> Signal ())
-> ResultProperty
forall b a.
ResultItemable