{-# 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 (ResultValue b) =>
ResultContainer a
-> ResultName
-> ResultId
-> (a -> Event b)
-> (a -> Signal ())
-> ResultProperty
resultContainerProperty ResultContainer (Server s a b)
c ResultName
"inputWaitTime" ResultId
ServerInputWaitTimeId Server s a b -> Event (SamplingStats Double)
forall s a b. Server s a b -> Event (SamplingStats Double)
serverInputWaitTime Server s a b -> Signal ()
forall s a b. Server s a b -> Signal ()
serverInputWaitTimeChanged_,
      ResultContainer (Server s a b)
-> ResultName
-> ResultId
-> (Server s a b -> Event (SamplingStats 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
"processingTime" ResultId
ServerProcessingTimeId Server s a b -> Event (SamplingStats Double)
forall s a b. Server s a b -> Event (SamplingStats Double)
serverProcessingTime Server s a b -> Signal ()
forall s a b. Server s a b -> Signal ()
serverProcessingTimeChanged_,
      ResultContainer (Server s a b)
-> ResultName
-> ResultId
-> (Server s a b -> Event (SamplingStats 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
"outputWaitTime" ResultId
ServerOutputWaitTimeId Server s a b -> Event (SamplingStats Double)
forall s a b. Server s a b -> Event (SamplingStats Double)
serverOutputWaitTime Server s a b -> Signal ()
forall s a b. Server s a b -> Signal ()
serverOutputWaitTimeChanged_,
      ResultContainer (Server s a b)
-> ResultName
-> ResultId
-> (Server s a b -> Event (SamplingStats 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
"preemptionTime" ResultId
ServerPreemptionTimeId Server s a b -> Event (SamplingStats Double)
forall s a b. Server s a b -> Event (SamplingStats Double)
serverPreemptionTime Server s a b -> Signal ()
forall s a b. Server s a b -> Signal ()
serverPreemptionTimeChanged_,
      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
"inputWaitFactor" ResultId
ServerInputWaitFactorId Server s a b -> Event Double
forall s a b. Server s a b -> Event Double
serverInputWaitFactor Server s a b -> Signal ()
forall s a b. Server s a b -> Signal ()
serverInputWaitFactorChanged_,
      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
"processingFactor" ResultId
ServerProcessingFactorId Server s a b -> Event Double
forall s a b. Server s a b -> Event Double
serverProcessingFactor Server s a b -> Signal ()
forall s a b. Server s a b -> Signal ()
serverProcessingFactorChanged_,
      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
"outputWaitFactor" ResultId
ServerOutputWaitFactorId Server s a b -> Event Double
forall s a b. Server s a b -> Event Double
serverOutputWaitFactor Server s a b -> Signal ()
forall s a b. Server s a b -> Signal ()
serverOutputWaitFactorChanged_,
      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
"preemptionFactor" ResultId
ServerPreemptionFactorId Server s a b -> Event Double
forall s a b. Server s a b -> Event Double
serverPreemptionFactor Server s a b -> Signal ()
forall s a b. Server s a b -> Signal ()
serverPreemptionFactorChanged_ ] }

-- | Return the summary by the specified server.
serverResultSummary :: ResultContainer (Server s a b)
                       -- ^ the server container
                       -> ResultSource
serverResultSummary :: ResultContainer (Server s a b) -> ResultSource
serverResultSummary 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 -> Event (SamplingStats 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
"inputWaitTime" ResultId
ServerInputWaitTimeId Server s a b -> Event (SamplingStats Double)
forall s a b. Server s a b -> Event (SamplingStats Double)
serverInputWaitTime Server s a b -> Signal ()
forall s a b. Server s a b -> Signal ()
serverInputWaitTimeChanged_,
      ResultContainer (Server s a b)
-> ResultName
-> ResultId
-> (Server s a b -> Event (SamplingStats 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
"processingTime" ResultId
ServerProcessingTimeId Server s a b -> Event (SamplingStats Double)
forall s a b. Server s a b -> Event (SamplingStats Double)
serverProcessingTime Server s a b -> Signal ()
forall s a b. Server s a b -> Signal ()
serverProcessingTimeChanged_,
      ResultContainer (Server s a b)
-> ResultName
-> ResultId
-> (Server s a b -> Event (SamplingStats 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
"outputWaitTime" ResultId
ServerOutputWaitTimeId Server s a b -> Event (SamplingStats Double)
forall s a b. Server s a b -> Event (SamplingStats Double)
serverOutputWaitTime Server s a b -> Signal ()
forall s a b. Server s a b -> Signal ()
serverOutputWaitTimeChanged_,
      ResultContainer (Server s a b)
-> ResultName
-> ResultId
-> (Server s a b -> Event (SamplingStats 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
"preemptionTime" ResultId
ServerPreemptionTimeId Server s a b -> Event (SamplingStats Double)
forall s a b. Server s a b -> Event (SamplingStats Double)
serverPreemptionTime Server s a b -> Signal ()
forall s a b. Server s a b -> Signal ()
serverPreemptionTimeChanged_,
      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
"inputWaitFactor" ResultId
ServerInputWaitFactorId Server s a b -> Event Double
forall s a b. Server s a b -> Event Double
serverInputWaitFactor Server s a b -> Signal ()
forall s a b. Server s a b -> Signal ()
serverInputWaitFactorChanged_,
      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
"processingFactor" ResultId
ServerProcessingFactorId Server s a b -> Event Double
forall s a b. Server s a b -> Event Double
serverProcessingFactor Server s a b -> Signal ()
forall s a b. Server s a b -> Signal ()
serverProcessingFactorChanged_,
      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
"outputWaitFactor" ResultId
ServerOutputWaitFactorId Server s a b -> Event Double
forall s a b. Server s a b -> Event Double
serverOutputWaitFactor Server s a b -> Signal ()
forall s a b. Server s a b -> Signal ()
serverOutputWaitFactorChanged_,
      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
"preemptionFactor" ResultId
ServerPreemptionFactorId Server s a b -> Event Double
forall s a b. Server s a b -> Event Double
serverPreemptionFactor Server s a b -> Signal ()
forall s a b. Server s a b -> Signal ()
serverPreemptionFactorChanged_ ] }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

instance ResultProvider p => ResultProvider [p] where

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

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

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

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

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

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

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

instance ResultProvider p => ResultProvider (ResultListWithSubscript p) where

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

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

instance ResultProvider p => ResultProvider (ResultVectorWithSubscript p) where

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

instance ResultProvider ArrivalTimer where

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

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

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

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

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

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

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

instance ResultProvider PR.Resource where

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

instance ResultProvider (Operation a b) where

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