module Simulation.Aivika.Results.IO
(
ResultSourcePrint,
ResultSourceShowS,
printResultsWithTime,
printResultsInStartTime,
printResultsInStopTime,
printResultsInIntegTimes,
printResultsInTime,
printResultsInTimes,
printSimulationResultsInStartTime,
printSimulationResultsInStopTime,
printSimulationResultsInIntegTimes,
printSimulationResultsInTime,
printSimulationResultsInTimes,
showResultsWithTime,
showResultsInStartTime,
showResultsInStopTime,
showResultsInIntegTimes,
showResultsInTime,
showResultsInTimes,
showSimulationResultsInStartTime,
showSimulationResultsInStopTime,
showSimulationResultsInIntegTimes,
showSimulationResultsInTime,
showSimulationResultsInTimes,
hPrintResultSourceIndented,
hPrintResultSource,
hPrintResultSourceInRussian,
hPrintResultSourceInEnglish,
printResultSourceIndented,
printResultSource,
printResultSourceInRussian,
printResultSourceInEnglish,
showResultSourceIndented,
showResultSource,
showResultSourceInRussian,
showResultSourceInEnglish) where
import Control.Monad
import Control.Monad.Trans
import qualified Data.Map as M
import qualified Data.Array as A
import System.IO
import Simulation.Aivika.Specs
import Simulation.Aivika.Simulation
import Simulation.Aivika.Dynamics
import Simulation.Aivika.Event
import Simulation.Aivika.Results
import Simulation.Aivika.Results.Locale
type ResultSourceShowS = ResultSource -> Event ShowS
type ResultSourcePrint = ResultSource -> Event ()
hPrintResultSourceIndented :: Handle
-> Int
-> ResultLocalisation
-> ResultSourcePrint
hPrintResultSourceIndented :: Handle -> Int -> ResultLocalisation -> ResultSourcePrint
hPrintResultSourceIndented Handle
h Int
indent ResultLocalisation
loc source :: ResultSource
source@(ResultItemSource (ResultItem a
x)) =
Handle
-> Int -> ResultName -> ResultLocalisation -> ResultSourcePrint
hPrintResultSourceIndentedLabelled Handle
h Int
indent (a -> ResultName
forall a. ResultItemable a => a -> ResultName
resultItemName a
x) ResultLocalisation
loc ResultSource
source
hPrintResultSourceIndented Handle
h Int
indent ResultLocalisation
loc source :: ResultSource
source@(ResultVectorSource ResultVector
x) =
Handle
-> Int -> ResultName -> ResultLocalisation -> ResultSourcePrint
hPrintResultSourceIndentedLabelled Handle
h Int
indent (ResultVector -> ResultName
resultVectorName ResultVector
x) ResultLocalisation
loc ResultSource
source
hPrintResultSourceIndented Handle
h Int
indent ResultLocalisation
loc source :: ResultSource
source@(ResultObjectSource ResultObject
x) =
Handle
-> Int -> ResultName -> ResultLocalisation -> ResultSourcePrint
hPrintResultSourceIndentedLabelled Handle
h Int
indent (ResultObject -> ResultName
resultObjectName ResultObject
x) ResultLocalisation
loc ResultSource
source
hPrintResultSourceIndented Handle
h Int
indent ResultLocalisation
loc source :: ResultSource
source@(ResultSeparatorSource ResultSeparator
x) =
Handle
-> Int -> ResultName -> ResultLocalisation -> ResultSourcePrint
hPrintResultSourceIndentedLabelled Handle
h Int
indent (ResultSeparator -> ResultName
resultSeparatorText ResultSeparator
x) ResultLocalisation
loc ResultSource
source
hPrintResultSourceIndentedLabelled :: Handle
-> Int
-> ResultName
-> ResultLocalisation
-> ResultSourcePrint
hPrintResultSourceIndentedLabelled :: Handle
-> Int -> ResultName -> ResultLocalisation -> ResultSourcePrint
hPrintResultSourceIndentedLabelled Handle
h Int
indent ResultName
label ResultLocalisation
loc (ResultItemSource (ResultItem a
x)) =
do ResultName
a <- ResultValue ResultName -> ResultData ResultName
forall e. ResultValue e -> ResultData e
resultValueData (ResultValue ResultName -> ResultData ResultName)
-> ResultValue ResultName -> ResultData ResultName
forall a b. (a -> b) -> a -> b
$ a -> ResultValue ResultName
forall a. ResultItemable a => a -> ResultValue ResultName
resultItemToStringValue a
x
let tab :: ResultName
tab = Int -> Char -> ResultName
forall a. Int -> a -> [a]
replicate Int
indent Char
' '
IO () -> Event ()
forall a. IO a -> Event a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> Event ()) -> IO () -> Event ()
forall a b. (a -> b) -> a -> b
$
do Handle -> ResultName -> IO ()
hPutStr Handle
h ResultName
tab
Handle -> ResultName -> IO ()
hPutStr Handle
h ResultName
"-- "
Handle -> ResultName -> IO ()
hPutStr Handle
h (ResultLocalisation -> ResultId -> ResultName
localiseResultDescription ResultLocalisation
loc (ResultId -> ResultName) -> ResultId -> ResultName
forall a b. (a -> b) -> a -> b
$ a -> ResultId
forall a. ResultItemable a => a -> ResultId
resultItemId a
x)
Handle -> ResultName -> IO ()
hPutStrLn Handle
h ResultName
""
Handle -> ResultName -> IO ()
hPutStr Handle
h ResultName
tab
Handle -> ResultName -> IO ()
hPutStr Handle
h ResultName
label
Handle -> ResultName -> IO ()
hPutStr Handle
h ResultName
" = "
Handle -> ResultName -> IO ()
hPutStrLn Handle
h ResultName
a
Handle -> ResultName -> IO ()
hPutStrLn Handle
h ResultName
""
hPrintResultSourceIndentedLabelled Handle
h Int
indent ResultName
label ResultLocalisation
loc (ResultVectorSource ResultVector
x) =
do let tab :: ResultName
tab = Int -> Char -> ResultName
forall a. Int -> a -> [a]
replicate Int
indent Char
' '
IO () -> Event ()
forall a. IO a -> Event a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> Event ()) -> IO () -> Event ()
forall a b. (a -> b) -> a -> b
$
do Handle -> ResultName -> IO ()
hPutStr Handle
h ResultName
tab
Handle -> ResultName -> IO ()
hPutStr Handle
h ResultName
"-- "
Handle -> ResultName -> IO ()
hPutStr Handle
h (ResultLocalisation -> ResultId -> ResultName
localiseResultDescription ResultLocalisation
loc (ResultId -> ResultName) -> ResultId -> ResultName
forall a b. (a -> b) -> a -> b
$ ResultVector -> ResultId
resultVectorId ResultVector
x)
Handle -> ResultName -> IO ()
hPutStrLn Handle
h ResultName
""
Handle -> ResultName -> IO ()
hPutStr Handle
h ResultName
tab
Handle -> ResultName -> IO ()
hPutStr Handle
h ResultName
label
Handle -> ResultName -> IO ()
hPutStrLn Handle
h ResultName
":"
Handle -> ResultName -> IO ()
hPutStrLn Handle
h ResultName
""
let items :: [ResultSource]
items = Array Int ResultSource -> [ResultSource]
forall i e. Array i e -> [e]
A.elems (ResultVector -> Array Int ResultSource
resultVectorItems ResultVector
x)
subscript :: [ResultName]
subscript = Array Int ResultName -> [ResultName]
forall i e. Array i e -> [e]
A.elems (ResultVector -> Array Int ResultName
resultVectorSubscript ResultVector
x)
[(ResultSource, ResultName)]
-> ((ResultSource, ResultName) -> Event ()) -> Event ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
t a -> (a -> m b) -> m ()
forM_ ([ResultSource] -> [ResultName] -> [(ResultSource, ResultName)]
forall a b. [a] -> [b] -> [(a, b)]
zip [ResultSource]
items [ResultName]
subscript) (((ResultSource, ResultName) -> Event ()) -> Event ())
-> ((ResultSource, ResultName) -> Event ()) -> Event ()
forall a b. (a -> b) -> a -> b
$ \(ResultSource
i, ResultName
s) ->
Handle
-> Int -> ResultName -> ResultLocalisation -> ResultSourcePrint
hPrintResultSourceIndentedLabelled Handle
h (Int
indent Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
2) (ResultName
label ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultName
s) ResultLocalisation
loc ResultSource
i
hPrintResultSourceIndentedLabelled Handle
h Int
indent ResultName
label ResultLocalisation
loc (ResultObjectSource ResultObject
x) =
do let tab :: ResultName
tab = Int -> Char -> ResultName
forall a. Int -> a -> [a]
replicate Int
indent Char
' '
IO () -> Event ()
forall a. IO a -> Event a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> Event ()) -> IO () -> Event ()
forall a b. (a -> b) -> a -> b
$
do Handle -> ResultName -> IO ()
hPutStr Handle
h ResultName
tab
Handle -> ResultName -> IO ()
hPutStr Handle
h ResultName
"-- "
Handle -> ResultName -> IO ()
hPutStr Handle
h (ResultLocalisation -> ResultId -> ResultName
localiseResultDescription ResultLocalisation
loc (ResultId -> ResultName) -> ResultId -> ResultName
forall a b. (a -> b) -> a -> b
$ ResultObject -> ResultId
resultObjectId ResultObject
x)
Handle -> ResultName -> IO ()
hPutStrLn Handle
h ResultName
""
Handle -> ResultName -> IO ()
hPutStr Handle
h ResultName
tab
Handle -> ResultName -> IO ()
hPutStr Handle
h ResultName
label
Handle -> ResultName -> IO ()
hPutStrLn Handle
h ResultName
":"
Handle -> ResultName -> IO ()
hPutStrLn Handle
h ResultName
""
[ResultProperty] -> (ResultProperty -> Event ()) -> Event ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
t a -> (a -> m b) -> m ()
forM_ (ResultObject -> [ResultProperty]
resultObjectProperties ResultObject
x) ((ResultProperty -> Event ()) -> Event ())
-> (ResultProperty -> Event ()) -> Event ()
forall a b. (a -> b) -> a -> b
$ \ResultProperty
p ->
do let indent' :: Int
indent' = Int
2 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
indent
tab' :: ResultName
tab' = ResultName
" " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultName
tab
label' :: ResultName
label' = ResultProperty -> ResultName
resultPropertyLabel ResultProperty
p
source' :: ResultSource
source' = ResultProperty -> ResultSource
resultPropertySource ResultProperty
p
Handle
-> Int -> ResultName -> ResultLocalisation -> ResultSourcePrint
hPrintResultSourceIndentedLabelled Handle
h Int
indent' ResultName
label' ResultLocalisation
loc ResultSource
source'
hPrintResultSourceIndentedLabelled Handle
h Int
indent ResultName
label ResultLocalisation
loc (ResultSeparatorSource ResultSeparator
x) =
do let tab :: ResultName
tab = Int -> Char -> ResultName
forall a. Int -> a -> [a]
replicate Int
indent Char
' '
IO () -> Event ()
forall a. IO a -> Event a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> Event ()) -> IO () -> Event ()
forall a b. (a -> b) -> a -> b
$
do Handle -> ResultName -> IO ()
hPutStr Handle
h ResultName
tab
Handle -> ResultName -> IO ()
hPutStr Handle
h ResultName
label
Handle -> ResultName -> IO ()
hPutStrLn Handle
h ResultName
""
Handle -> ResultName -> IO ()
hPutStrLn Handle
h ResultName
""
printResultSourceIndented :: Int
-> ResultLocalisation
-> ResultSourcePrint
printResultSourceIndented :: Int -> ResultLocalisation -> ResultSourcePrint
printResultSourceIndented = Handle -> Int -> ResultLocalisation -> ResultSourcePrint
hPrintResultSourceIndented Handle
stdout
hPrintResultSource :: Handle
-> ResultLocalisation
-> ResultSourcePrint
hPrintResultSource :: Handle -> ResultLocalisation -> ResultSourcePrint
hPrintResultSource Handle
h = Handle -> Int -> ResultLocalisation -> ResultSourcePrint
hPrintResultSourceIndented Handle
h Int
0
printResultSource :: ResultLocalisation
-> ResultSourcePrint
printResultSource :: ResultLocalisation -> ResultSourcePrint
printResultSource = Handle -> ResultLocalisation -> ResultSourcePrint
hPrintResultSource Handle
stdout
hPrintResultSourceInRussian :: Handle -> ResultSourcePrint
hPrintResultSourceInRussian :: Handle -> ResultSourcePrint
hPrintResultSourceInRussian Handle
h = Handle -> ResultLocalisation -> ResultSourcePrint
hPrintResultSource Handle
h ResultLocalisation
russianResultLocalisation
hPrintResultSourceInEnglish :: Handle -> ResultSourcePrint
hPrintResultSourceInEnglish :: Handle -> ResultSourcePrint
hPrintResultSourceInEnglish Handle
h = Handle -> ResultLocalisation -> ResultSourcePrint
hPrintResultSource Handle
h ResultLocalisation
englishResultLocalisation
printResultSourceInRussian :: ResultSourcePrint
printResultSourceInRussian :: ResultSourcePrint
printResultSourceInRussian = Handle -> ResultSourcePrint
hPrintResultSourceInRussian Handle
stdout
printResultSourceInEnglish :: ResultSourcePrint
printResultSourceInEnglish :: ResultSourcePrint
printResultSourceInEnglish = Handle -> ResultSourcePrint
hPrintResultSourceInEnglish Handle
stdout
showResultSourceIndented :: Int
-> ResultLocalisation
-> ResultSourceShowS
showResultSourceIndented :: Int -> ResultLocalisation -> ResultSourceShowS
showResultSourceIndented Int
indent ResultLocalisation
loc source :: ResultSource
source@(ResultItemSource (ResultItem a
x)) =
Int -> ResultName -> ResultLocalisation -> ResultSourceShowS
showResultSourceIndentedLabelled Int
indent (a -> ResultName
forall a. ResultItemable a => a -> ResultName
resultItemName a
x) ResultLocalisation
loc ResultSource
source
showResultSourceIndented Int
indent ResultLocalisation
loc source :: ResultSource
source@(ResultVectorSource ResultVector
x) =
Int -> ResultName -> ResultLocalisation -> ResultSourceShowS
showResultSourceIndentedLabelled Int
indent (ResultVector -> ResultName
resultVectorName ResultVector
x) ResultLocalisation
loc ResultSource
source
showResultSourceIndented Int
indent ResultLocalisation
loc source :: ResultSource
source@(ResultObjectSource ResultObject
x) =
Int -> ResultName -> ResultLocalisation -> ResultSourceShowS
showResultSourceIndentedLabelled Int
indent (ResultObject -> ResultName
resultObjectName ResultObject
x) ResultLocalisation
loc ResultSource
source
showResultSourceIndented Int
indent ResultLocalisation
loc source :: ResultSource
source@(ResultSeparatorSource ResultSeparator
x) =
Int -> ResultName -> ResultLocalisation -> ResultSourceShowS
showResultSourceIndentedLabelled Int
indent (ResultSeparator -> ResultName
resultSeparatorText ResultSeparator
x) ResultLocalisation
loc ResultSource
source
showResultSourceIndentedLabelled :: Int
-> String
-> ResultLocalisation
-> ResultSourceShowS
showResultSourceIndentedLabelled :: Int -> ResultName -> ResultLocalisation -> ResultSourceShowS
showResultSourceIndentedLabelled Int
indent ResultName
label ResultLocalisation
loc (ResultItemSource (ResultItem a
x)) =
do ResultName
a <- ResultValue ResultName -> ResultData ResultName
forall e. ResultValue e -> ResultData e
resultValueData (ResultValue ResultName -> ResultData ResultName)
-> ResultValue ResultName -> ResultData ResultName
forall a b. (a -> b) -> a -> b
$ a -> ResultValue ResultName
forall a. ResultItemable a => a -> ResultValue ResultName
resultItemToStringValue a
x
let tab :: ResultName
tab = Int -> Char -> ResultName
forall a. Int -> a -> [a]
replicate Int
indent Char
' '
(ResultName -> ResultName) -> Event (ResultName -> ResultName)
forall a. a -> Event a
forall (m :: * -> *) a. Monad m => a -> m a
return ((ResultName -> ResultName) -> Event (ResultName -> ResultName))
-> (ResultName -> ResultName) -> Event (ResultName -> ResultName)
forall a b. (a -> b) -> a -> b
$
ResultName -> ResultName -> ResultName
showString ResultName
tab (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
ResultName -> ResultName -> ResultName
showString ResultName
"-- " (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
ResultName -> ResultName -> ResultName
showString (ResultLocalisation -> ResultId -> ResultName
localiseResultDescription ResultLocalisation
loc (ResultId -> ResultName) -> ResultId -> ResultName
forall a b. (a -> b) -> a -> b
$ a -> ResultId
forall a. ResultItemable a => a -> ResultId
resultItemId a
x) (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
ResultName -> ResultName -> ResultName
showString ResultName
"\n" (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
ResultName -> ResultName -> ResultName
showString ResultName
tab (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
ResultName -> ResultName -> ResultName
showString ResultName
label (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
ResultName -> ResultName -> ResultName
showString ResultName
" = " (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
ResultName -> ResultName -> ResultName
showString ResultName
a (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
ResultName -> ResultName -> ResultName
showString ResultName
"\n\n"
showResultSourceIndentedLabelled Int
indent ResultName
label ResultLocalisation
loc (ResultVectorSource ResultVector
x) =
do let tab :: ResultName
tab = Int -> Char -> ResultName
forall a. Int -> a -> [a]
replicate Int
indent Char
' '
items :: [ResultSource]
items = Array Int ResultSource -> [ResultSource]
forall i e. Array i e -> [e]
A.elems (ResultVector -> Array Int ResultSource
resultVectorItems ResultVector
x)
subscript :: [ResultName]
subscript = Array Int ResultName -> [ResultName]
forall i e. Array i e -> [e]
A.elems (ResultVector -> Array Int ResultName
resultVectorSubscript ResultVector
x)
[ResultName -> ResultName]
contents <-
[(ResultSource, ResultName)]
-> ((ResultSource, ResultName) -> Event (ResultName -> ResultName))
-> Event [ResultName -> ResultName]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
t a -> (a -> m b) -> m (t b)
forM ([ResultSource] -> [ResultName] -> [(ResultSource, ResultName)]
forall a b. [a] -> [b] -> [(a, b)]
zip [ResultSource]
items [ResultName]
subscript) (((ResultSource, ResultName) -> Event (ResultName -> ResultName))
-> Event [ResultName -> ResultName])
-> ((ResultSource, ResultName) -> Event (ResultName -> ResultName))
-> Event [ResultName -> ResultName]
forall a b. (a -> b) -> a -> b
$ \(ResultSource
i, ResultName
s) ->
Int -> ResultName -> ResultLocalisation -> ResultSourceShowS
showResultSourceIndentedLabelled (Int
indent Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
2) (ResultName
label ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultName
s) ResultLocalisation
loc ResultSource
i
let showContents :: ResultName -> ResultName
showContents = ((ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName)
-> (ResultName -> ResultName)
-> [ResultName -> ResultName]
-> ResultName
-> ResultName
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
(.) ResultName -> ResultName
forall a. a -> a
id [ResultName -> ResultName]
contents
(ResultName -> ResultName) -> Event (ResultName -> ResultName)
forall a. a -> Event a
forall (m :: * -> *) a. Monad m => a -> m a
return ((ResultName -> ResultName) -> Event (ResultName -> ResultName))
-> (ResultName -> ResultName) -> Event (ResultName -> ResultName)
forall a b. (a -> b) -> a -> b
$
ResultName -> ResultName -> ResultName
showString ResultName
tab (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
ResultName -> ResultName -> ResultName
showString ResultName
"-- " (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
ResultName -> ResultName -> ResultName
showString (ResultLocalisation -> ResultId -> ResultName
localiseResultDescription ResultLocalisation
loc (ResultId -> ResultName) -> ResultId -> ResultName
forall a b. (a -> b) -> a -> b
$ ResultVector -> ResultId
resultVectorId ResultVector
x) (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
ResultName -> ResultName -> ResultName
showString ResultName
"\n" (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
ResultName -> ResultName -> ResultName
showString ResultName
tab (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
ResultName -> ResultName -> ResultName
showString ResultName
label (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
ResultName -> ResultName -> ResultName
showString ResultName
":\n\n" (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
ResultName -> ResultName
showContents
showResultSourceIndentedLabelled Int
indent ResultName
label ResultLocalisation
loc (ResultObjectSource ResultObject
x) =
do let tab :: ResultName
tab = Int -> Char -> ResultName
forall a. Int -> a -> [a]
replicate Int
indent Char
' '
[ResultName -> ResultName]
contents <-
[ResultProperty]
-> (ResultProperty -> Event (ResultName -> ResultName))
-> Event [ResultName -> ResultName]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
t a -> (a -> m b) -> m (t b)
forM (ResultObject -> [ResultProperty]
resultObjectProperties ResultObject
x) ((ResultProperty -> Event (ResultName -> ResultName))
-> Event [ResultName -> ResultName])
-> (ResultProperty -> Event (ResultName -> ResultName))
-> Event [ResultName -> ResultName]
forall a b. (a -> b) -> a -> b
$ \ResultProperty
p ->
do let indent' :: Int
indent' = Int
2 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
indent
tab' :: ResultName
tab' = ResultName
" " ResultName -> ResultName -> ResultName
forall a. [a] -> [a] -> [a]
++ ResultName
tab
label' :: ResultName
label' = ResultProperty -> ResultName
resultPropertyLabel ResultProperty
p
output' :: ResultSource
output' = ResultProperty -> ResultSource
resultPropertySource ResultProperty
p
Int -> ResultName -> ResultLocalisation -> ResultSourceShowS
showResultSourceIndentedLabelled Int
indent' ResultName
label' ResultLocalisation
loc ResultSource
output'
let showContents :: ResultName -> ResultName
showContents = ((ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName)
-> (ResultName -> ResultName)
-> [ResultName -> ResultName]
-> ResultName
-> ResultName
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
(.) ResultName -> ResultName
forall a. a -> a
id [ResultName -> ResultName]
contents
(ResultName -> ResultName) -> Event (ResultName -> ResultName)
forall a. a -> Event a
forall (m :: * -> *) a. Monad m => a -> m a
return ((ResultName -> ResultName) -> Event (ResultName -> ResultName))
-> (ResultName -> ResultName) -> Event (ResultName -> ResultName)
forall a b. (a -> b) -> a -> b
$
ResultName -> ResultName -> ResultName
showString ResultName
tab (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
ResultName -> ResultName -> ResultName
showString ResultName
"-- " (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
ResultName -> ResultName -> ResultName
showString (ResultLocalisation -> ResultId -> ResultName
localiseResultDescription ResultLocalisation
loc (ResultId -> ResultName) -> ResultId -> ResultName
forall a b. (a -> b) -> a -> b
$ ResultObject -> ResultId
resultObjectId ResultObject
x) (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
ResultName -> ResultName -> ResultName
showString ResultName
"\n" (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
ResultName -> ResultName -> ResultName
showString ResultName
tab (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
ResultName -> ResultName -> ResultName
showString ResultName
label (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
ResultName -> ResultName -> ResultName
showString ResultName
":\n\n" (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
ResultName -> ResultName
showContents
showResultSourceIndentedLabelled Int
indent ResultName
label ResultLocalisation
loc (ResultSeparatorSource ResultSeparator
x) =
do let tab :: ResultName
tab = Int -> Char -> ResultName
forall a. Int -> a -> [a]
replicate Int
indent Char
' '
(ResultName -> ResultName) -> Event (ResultName -> ResultName)
forall a. a -> Event a
forall (m :: * -> *) a. Monad m => a -> m a
return ((ResultName -> ResultName) -> Event (ResultName -> ResultName))
-> (ResultName -> ResultName) -> Event (ResultName -> ResultName)
forall a b. (a -> b) -> a -> b
$
ResultName -> ResultName -> ResultName
showString ResultName
tab (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
ResultName -> ResultName -> ResultName
showString ResultName
label (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
ResultName -> ResultName -> ResultName
showString ResultName
"\n\n"
showResultSource :: ResultLocalisation
-> ResultSourceShowS
showResultSource :: ResultLocalisation -> ResultSourceShowS
showResultSource = Int -> ResultLocalisation -> ResultSourceShowS
showResultSourceIndented Int
0
showResultSourceInRussian :: ResultSourceShowS
showResultSourceInRussian :: ResultSourceShowS
showResultSourceInRussian = ResultLocalisation -> ResultSourceShowS
showResultSource ResultLocalisation
russianResultLocalisation
showResultSourceInEnglish :: ResultSourceShowS
showResultSourceInEnglish :: ResultSourceShowS
showResultSourceInEnglish = ResultLocalisation -> ResultSourceShowS
showResultSource ResultLocalisation
englishResultLocalisation
printResultsWithTime :: ResultSourcePrint -> Results -> Event ()
printResultsWithTime :: ResultSourcePrint -> Results -> Event ()
printResultsWithTime ResultSourcePrint
print Results
results =
do let x1 :: ResultSource
x1 = ResultName -> ResultSource
textResultSource ResultName
"----------"
x2 :: ResultSource
x2 = ResultSource
timeResultSource
x3 :: ResultSource
x3 = ResultName -> ResultSource
textResultSource ResultName
""
xs :: [ResultSource]
xs = Results -> [ResultSource]
resultSourceList Results
results
ResultSourcePrint
print ResultSource
x1
ResultSourcePrint
print ResultSource
x2
ResultSourcePrint -> [ResultSource] -> Event ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ ResultSourcePrint
print [ResultSource]
xs
printResultsInStartTime :: ResultSourcePrint -> Results -> Simulation ()
printResultsInStartTime :: ResultSourcePrint -> Results -> Simulation ()
printResultsInStartTime ResultSourcePrint
print Results
results =
Event () -> Simulation ()
forall a. Event a -> Simulation a
runEventInStartTime (Event () -> Simulation ()) -> Event () -> Simulation ()
forall a b. (a -> b) -> a -> b
$ ResultSourcePrint -> Results -> Event ()
printResultsWithTime ResultSourcePrint
print Results
results
printResultsInStopTime :: ResultSourcePrint -> Results -> Simulation ()
printResultsInStopTime :: ResultSourcePrint -> Results -> Simulation ()
printResultsInStopTime ResultSourcePrint
print Results
results =
Event () -> Simulation ()
forall a. Event a -> Simulation a
runEventInStopTime (Event () -> Simulation ()) -> Event () -> Simulation ()
forall a b. (a -> b) -> a -> b
$ ResultSourcePrint -> Results -> Event ()
printResultsWithTime ResultSourcePrint
print Results
results
printResultsInIntegTimes :: ResultSourcePrint -> Results -> Simulation ()
printResultsInIntegTimes :: ResultSourcePrint -> Results -> Simulation ()
printResultsInIntegTimes ResultSourcePrint
print Results
results =
do let loop :: [m a] -> m ()
loop (m a
m : [m a]
ms) = m a
m m a -> m () -> m ()
forall a b. m a -> m b -> m b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [m a] -> m ()
loop [m a]
ms
loop [] = () -> m ()
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
[IO ()]
ms <- Dynamics () -> Simulation [IO ()]
forall a. Dynamics a -> Simulation [IO a]
runDynamicsInIntegTimes (Dynamics () -> Simulation [IO ()])
-> Dynamics () -> Simulation [IO ()]
forall a b. (a -> b) -> a -> b
$ Event () -> Dynamics ()
forall a. Event a -> Dynamics a
runEvent (Event () -> Dynamics ()) -> Event () -> Dynamics ()
forall a b. (a -> b) -> a -> b
$
ResultSourcePrint -> Results -> Event ()
printResultsWithTime ResultSourcePrint
print Results
results
IO () -> Simulation ()
forall a. IO a -> Simulation a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> Simulation ()) -> IO () -> Simulation ()
forall a b. (a -> b) -> a -> b
$ [IO ()] -> IO ()
forall {m :: * -> *} {a}. Monad m => [m a] -> m ()
loop [IO ()]
ms
printResultsInTime :: Double -> ResultSourcePrint -> Results -> Simulation ()
printResultsInTime :: Double -> ResultSourcePrint -> Results -> Simulation ()
printResultsInTime Double
t ResultSourcePrint
print Results
results =
Double -> Dynamics () -> Simulation ()
forall a. Double -> Dynamics a -> Simulation a
runDynamicsInTime Double
t (Dynamics () -> Simulation ()) -> Dynamics () -> Simulation ()
forall a b. (a -> b) -> a -> b
$ Event () -> Dynamics ()
forall a. Event a -> Dynamics a
runEvent (Event () -> Dynamics ()) -> Event () -> Dynamics ()
forall a b. (a -> b) -> a -> b
$
ResultSourcePrint -> Results -> Event ()
printResultsWithTime ResultSourcePrint
print Results
results
printResultsInTimes :: [Double] -> ResultSourcePrint -> Results -> Simulation ()
printResultsInTimes :: [Double] -> ResultSourcePrint -> Results -> Simulation ()
printResultsInTimes [Double]
ts ResultSourcePrint
print Results
results =
do let loop :: [m a] -> m ()
loop (m a
m : [m a]
ms) = m a
m m a -> m () -> m ()
forall a b. m a -> m b -> m b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [m a] -> m ()
loop [m a]
ms
loop [] = () -> m ()
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
[IO ()]
ms <- [Double] -> Dynamics () -> Simulation [IO ()]
forall a. [Double] -> Dynamics a -> Simulation [IO a]
runDynamicsInTimes [Double]
ts (Dynamics () -> Simulation [IO ()])
-> Dynamics () -> Simulation [IO ()]
forall a b. (a -> b) -> a -> b
$ Event () -> Dynamics ()
forall a. Event a -> Dynamics a
runEvent (Event () -> Dynamics ()) -> Event () -> Dynamics ()
forall a b. (a -> b) -> a -> b
$
ResultSourcePrint -> Results -> Event ()
printResultsWithTime ResultSourcePrint
print Results
results
IO () -> Simulation ()
forall a. IO a -> Simulation a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> Simulation ()) -> IO () -> Simulation ()
forall a b. (a -> b) -> a -> b
$ [IO ()] -> IO ()
forall {m :: * -> *} {a}. Monad m => [m a] -> m ()
loop [IO ()]
ms
showResultsWithTime :: ResultSourceShowS -> Results -> Event ShowS
showResultsWithTime :: ResultSourceShowS -> Results -> Event (ResultName -> ResultName)
showResultsWithTime ResultSourceShowS
f Results
results =
do let x1 :: ResultSource
x1 = ResultName -> ResultSource
textResultSource ResultName
"----------"
x2 :: ResultSource
x2 = ResultSource
timeResultSource
x3 :: ResultSource
x3 = ResultName -> ResultSource
textResultSource ResultName
""
xs :: [ResultSource]
xs = Results -> [ResultSource]
resultSourceList Results
results
ResultName -> ResultName
y1 <- ResultSourceShowS
f ResultSource
x1
ResultName -> ResultName
y2 <- ResultSourceShowS
f ResultSource
x2
ResultName -> ResultName
y3 <- ResultSourceShowS
f ResultSource
x3
[ResultName -> ResultName]
ys <- [ResultSource]
-> ResultSourceShowS -> Event [ResultName -> ResultName]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
t a -> (a -> m b) -> m (t b)
forM [ResultSource]
xs ResultSourceShowS
f
(ResultName -> ResultName) -> Event (ResultName -> ResultName)
forall a. a -> Event a
forall (m :: * -> *) a. Monad m => a -> m a
return ((ResultName -> ResultName) -> Event (ResultName -> ResultName))
-> (ResultName -> ResultName) -> Event (ResultName -> ResultName)
forall a b. (a -> b) -> a -> b
$
ResultName -> ResultName
y1 (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
ResultName -> ResultName
y2 (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
((ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName)
-> (ResultName -> ResultName)
-> [ResultName -> ResultName]
-> ResultName
-> ResultName
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (ResultName -> ResultName)
-> (ResultName -> ResultName) -> ResultName -> ResultName
forall b c a. (b -> c) -> (a -> b) -> a -> c
(.) ResultName -> ResultName
forall a. a -> a
id [ResultName -> ResultName]
ys
showResultsInStartTime :: ResultSourceShowS -> Results -> Simulation ShowS
showResultsInStartTime :: ResultSourceShowS
-> Results -> Simulation (ResultName -> ResultName)
showResultsInStartTime ResultSourceShowS
f Results
results =
Event (ResultName -> ResultName)
-> Simulation (ResultName -> ResultName)
forall a. Event a -> Simulation a
runEventInStartTime (Event (ResultName -> ResultName)
-> Simulation (ResultName -> ResultName))
-> Event (ResultName -> ResultName)
-> Simulation (ResultName -> ResultName)
forall a b. (a -> b) -> a -> b
$ ResultSourceShowS -> Results -> Event (ResultName -> ResultName)
showResultsWithTime ResultSourceShowS
f Results
results
showResultsInStopTime :: ResultSourceShowS -> Results -> Simulation ShowS
showResultsInStopTime :: ResultSourceShowS
-> Results -> Simulation (ResultName -> ResultName)
showResultsInStopTime ResultSourceShowS
f Results
results =
Event (ResultName -> ResultName)
-> Simulation (ResultName -> ResultName)
forall a. Event a -> Simulation a
runEventInStopTime (Event (ResultName -> ResultName)
-> Simulation (ResultName -> ResultName))
-> Event (ResultName -> ResultName)
-> Simulation (ResultName -> ResultName)
forall a b. (a -> b) -> a -> b
$ ResultSourceShowS -> Results -> Event (ResultName -> ResultName)
showResultsWithTime ResultSourceShowS
f Results
results
showResultsInIntegTimes :: ResultSourceShowS -> Results -> Simulation ShowS
showResultsInIntegTimes :: ResultSourceShowS
-> Results -> Simulation (ResultName -> ResultName)
showResultsInIntegTimes ResultSourceShowS
f Results
results =
do let loop :: [m (b -> b)] -> m (b -> b)
loop (m (b -> b)
m : [m (b -> b)]
ms) = ((b -> b) -> (b -> b) -> b -> b)
-> m ((b -> b) -> (b -> b) -> b -> b)
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return (b -> b) -> (b -> b) -> b -> b
forall b c a. (b -> c) -> (a -> b) -> a -> c
(.) m ((b -> b) -> (b -> b) -> b -> b)
-> m (b -> b) -> m ((b -> b) -> b -> b)
forall (m :: * -> *) a b. Monad m => m (a -> b) -> m a -> m b
`ap` m (b -> b)
m m ((b -> b) -> b -> b) -> m (b -> b) -> m (b -> b)
forall (m :: * -> *) a b. Monad m => m (a -> b) -> m a -> m b
`ap` [m (b -> b)] -> m (b -> b)
loop [m (b -> b)]
ms
loop [] = (b -> b) -> m (b -> b)
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return b -> b
forall a. a -> a
id
[IO (ResultName -> ResultName)]
ms <- Dynamics (ResultName -> ResultName)
-> Simulation [IO (ResultName -> ResultName)]
forall a. Dynamics a -> Simulation [IO a]
runDynamicsInIntegTimes (Dynamics (ResultName -> ResultName)
-> Simulation [IO (ResultName -> ResultName)])
-> Dynamics (ResultName -> ResultName)
-> Simulation [IO (ResultName -> ResultName)]
forall a b. (a -> b) -> a -> b
$ Event (ResultName -> ResultName)
-> Dynamics (ResultName -> ResultName)
forall a. Event a -> Dynamics a
runEvent (Event (ResultName -> ResultName)
-> Dynamics (ResultName -> ResultName))
-> Event (ResultName -> ResultName)
-> Dynamics (ResultName -> ResultName)
forall a b. (a -> b) -> a -> b
$
ResultSourceShowS -> Results -> Event (ResultName -> ResultName)
showResultsWithTime ResultSourceShowS
f Results
results
IO (ResultName -> ResultName)
-> Simulation (ResultName -> ResultName)
forall a. IO a -> Simulation a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (ResultName -> ResultName)
-> Simulation (ResultName -> ResultName))
-> IO (ResultName -> ResultName)
-> Simulation (ResultName -> ResultName)
forall a b. (a -> b) -> a -> b
$ [IO (ResultName -> ResultName)] -> IO (ResultName -> ResultName)
forall {m :: * -> *} {b}. Monad m => [m (b -> b)] -> m (b -> b)
loop [IO (ResultName -> ResultName)]
ms
showResultsInTime :: Double -> ResultSourceShowS -> Results -> Simulation ShowS
showResultsInTime :: Double
-> ResultSourceShowS
-> Results
-> Simulation (ResultName -> ResultName)
showResultsInTime Double
t ResultSourceShowS
f Results
results =
Double
-> Dynamics (ResultName -> ResultName)
-> Simulation (ResultName -> ResultName)
forall a. Double -> Dynamics a -> Simulation a
runDynamicsInTime Double
t (Dynamics (ResultName -> ResultName)
-> Simulation (ResultName -> ResultName))
-> Dynamics (ResultName -> ResultName)
-> Simulation (ResultName -> ResultName)
forall a b. (a -> b) -> a -> b
$ Event (ResultName -> ResultName)
-> Dynamics (ResultName -> ResultName)
forall a. Event a -> Dynamics a
runEvent (Event (ResultName -> ResultName)
-> Dynamics (ResultName -> ResultName))
-> Event (ResultName -> ResultName)
-> Dynamics (ResultName -> ResultName)
forall a b. (a -> b) -> a -> b
$
ResultSourceShowS -> Results -> Event (ResultName -> ResultName)
showResultsWithTime ResultSourceShowS
f Results
results
showResultsInTimes :: [Double] -> ResultSourceShowS -> Results -> Simulation ShowS
showResultsInTimes :: [Double]
-> ResultSourceShowS
-> Results
-> Simulation (ResultName -> ResultName)
showResultsInTimes [Double]
ts ResultSourceShowS
f Results
results =
do let loop :: [m (b -> b)] -> m (b -> b)
loop (m (b -> b)
m : [m (b -> b)]
ms) = ((b -> b) -> (b -> b) -> b -> b)
-> m ((b -> b) -> (b -> b) -> b -> b)
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return (b -> b) -> (b -> b) -> b -> b
forall b c a. (b -> c) -> (a -> b) -> a -> c
(.) m ((b -> b) -> (b -> b) -> b -> b)
-> m (b -> b) -> m ((b -> b) -> b -> b)
forall (m :: * -> *) a b. Monad m => m (a -> b) -> m a -> m b
`ap` m (b -> b)
m m ((b -> b) -> b -> b) -> m (b -> b) -> m (b -> b)
forall (m :: * -> *) a b. Monad m => m (a -> b) -> m a -> m b
`ap` [m (b -> b)] -> m (b -> b)
loop [m (b -> b)]
ms
loop [] = (b -> b) -> m (b -> b)
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return b -> b
forall a. a -> a
id
[IO (ResultName -> ResultName)]
ms <- [Double]
-> Dynamics (ResultName -> ResultName)
-> Simulation [IO (ResultName -> ResultName)]
forall a. [Double] -> Dynamics a -> Simulation [IO a]
runDynamicsInTimes [Double]
ts (Dynamics (ResultName -> ResultName)
-> Simulation [IO (ResultName -> ResultName)])
-> Dynamics (ResultName -> ResultName)
-> Simulation [IO (ResultName -> ResultName)]
forall a b. (a -> b) -> a -> b
$ Event (ResultName -> ResultName)
-> Dynamics (ResultName -> ResultName)
forall a. Event a -> Dynamics a
runEvent (Event (ResultName -> ResultName)
-> Dynamics (ResultName -> ResultName))
-> Event (ResultName -> ResultName)
-> Dynamics (ResultName -> ResultName)
forall a b. (a -> b) -> a -> b
$
ResultSourceShowS -> Results -> Event (ResultName -> ResultName)
showResultsWithTime ResultSourceShowS
f Results
results
IO (ResultName -> ResultName)
-> Simulation (ResultName -> ResultName)
forall a. IO a -> Simulation a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (ResultName -> ResultName)
-> Simulation (ResultName -> ResultName))
-> IO (ResultName -> ResultName)
-> Simulation (ResultName -> ResultName)
forall a b. (a -> b) -> a -> b
$ [IO (ResultName -> ResultName)] -> IO (ResultName -> ResultName)
forall {m :: * -> *} {b}. Monad m => [m (b -> b)] -> m (b -> b)
loop [IO (ResultName -> ResultName)]
ms
printSimulationResultsInStartTime :: ResultSourcePrint -> Simulation Results -> Specs -> IO ()
printSimulationResultsInStartTime :: ResultSourcePrint -> Simulation Results -> Specs -> IO ()
printSimulationResultsInStartTime ResultSourcePrint
print Simulation Results
model Specs
specs =
(Simulation () -> Specs -> IO ())
-> Specs -> Simulation () -> IO ()
forall a b c. (a -> b -> c) -> b -> a -> c
flip Simulation () -> Specs -> IO ()
forall a. Simulation a -> Specs -> IO a
runSimulation Specs
specs (Simulation () -> IO ()) -> Simulation () -> IO ()
forall a b. (a -> b) -> a -> b
$
Simulation Results
model Simulation Results -> (Results -> Simulation ()) -> Simulation ()
forall a b. Simulation a -> (a -> Simulation b) -> Simulation b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ResultSourcePrint -> Results -> Simulation ()
printResultsInStartTime ResultSourcePrint
print
printSimulationResultsInStopTime :: ResultSourcePrint -> Simulation Results -> Specs -> IO ()
printSimulationResultsInStopTime :: ResultSourcePrint -> Simulation Results -> Specs -> IO ()
printSimulationResultsInStopTime ResultSourcePrint
print Simulation Results
model Specs
specs =
(Simulation () -> Specs -> IO ())
-> Specs -> Simulation () -> IO ()
forall a b c. (a -> b -> c) -> b -> a -> c
flip Simulation () -> Specs -> IO ()
forall a. Simulation a -> Specs -> IO a
runSimulation Specs
specs (Simulation () -> IO ()) -> Simulation () -> IO ()
forall a b. (a -> b) -> a -> b
$
Simulation Results
model Simulation Results -> (Results -> Simulation ()) -> Simulation ()
forall a b. Simulation a -> (a -> Simulation b) -> Simulation b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ResultSourcePrint -> Results -> Simulation ()
printResultsInStopTime ResultSourcePrint
print
printSimulationResultsInIntegTimes :: ResultSourcePrint -> Simulation Results -> Specs -> IO ()
printSimulationResultsInIntegTimes :: ResultSourcePrint -> Simulation Results -> Specs -> IO ()
printSimulationResultsInIntegTimes ResultSourcePrint
print Simulation Results
model Specs
specs =
(Simulation () -> Specs -> IO ())
-> Specs -> Simulation () -> IO ()
forall a b c. (a -> b -> c) -> b -> a -> c
flip Simulation () -> Specs -> IO ()
forall a. Simulation a -> Specs -> IO a
runSimulation Specs
specs (Simulation () -> IO ()) -> Simulation () -> IO ()
forall a b. (a -> b) -> a -> b
$
Simulation Results
model Simulation Results -> (Results -> Simulation ()) -> Simulation ()
forall a b. Simulation a -> (a -> Simulation b) -> Simulation b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ResultSourcePrint -> Results -> Simulation ()
printResultsInIntegTimes ResultSourcePrint
print
printSimulationResultsInTime :: Double -> ResultSourcePrint -> Simulation Results -> Specs -> IO ()
printSimulationResultsInTime :: Double -> ResultSourcePrint -> Simulation Results -> Specs -> IO ()
printSimulationResultsInTime Double
t ResultSourcePrint
print Simulation Results
model Specs
specs =
(Simulation () -> Specs -> IO ())
-> Specs -> Simulation () -> IO ()
forall a b c. (a -> b -> c) -> b -> a -> c
flip Simulation () -> Specs -> IO ()
forall a. Simulation a -> Specs -> IO a
runSimulation Specs
specs (Simulation () -> IO ()) -> Simulation () -> IO ()
forall a b. (a -> b) -> a -> b
$
Simulation Results
model Simulation Results -> (Results -> Simulation ()) -> Simulation ()
forall a b. Simulation a -> (a -> Simulation b) -> Simulation b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Double -> ResultSourcePrint -> Results -> Simulation ()
printResultsInTime Double
t ResultSourcePrint
print
printSimulationResultsInTimes :: [Double] -> ResultSourcePrint -> Simulation Results -> Specs -> IO ()
printSimulationResultsInTimes :: [Double]
-> ResultSourcePrint -> Simulation Results -> Specs -> IO ()
printSimulationResultsInTimes [Double]
ts ResultSourcePrint
print Simulation Results
model Specs
specs =
(Simulation () -> Specs -> IO ())
-> Specs -> Simulation () -> IO ()
forall a b c. (a -> b -> c) -> b -> a -> c
flip Simulation () -> Specs -> IO ()
forall a. Simulation a -> Specs -> IO a
runSimulation Specs
specs (Simulation () -> IO ()) -> Simulation () -> IO ()
forall a b. (a -> b) -> a -> b
$
Simulation Results
model Simulation Results -> (Results -> Simulation ()) -> Simulation ()
forall a b. Simulation a -> (a -> Simulation b) -> Simulation b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= [Double] -> ResultSourcePrint -> Results -> Simulation ()
printResultsInTimes [Double]
ts ResultSourcePrint
print
showSimulationResultsInStartTime :: ResultSourceShowS -> Simulation Results -> Specs -> IO ShowS
showSimulationResultsInStartTime :: ResultSourceShowS
-> Simulation Results -> Specs -> IO (ResultName -> ResultName)
showSimulationResultsInStartTime ResultSourceShowS
f Simulation Results
model Specs
specs =
(Simulation (ResultName -> ResultName)
-> Specs -> IO (ResultName -> ResultName))
-> Specs
-> Simulation (ResultName -> ResultName)
-> IO (ResultName -> ResultName)
forall a b c. (a -> b -> c) -> b -> a -> c
flip Simulation (ResultName -> ResultName)
-> Specs -> IO (ResultName -> ResultName)
forall a. Simulation a -> Specs -> IO a
runSimulation Specs
specs (Simulation (ResultName -> ResultName)
-> IO (ResultName -> ResultName))
-> Simulation (ResultName -> ResultName)
-> IO (ResultName -> ResultName)
forall a b. (a -> b) -> a -> b
$
Simulation Results
model Simulation Results
-> (Results -> Simulation (ResultName -> ResultName))
-> Simulation (ResultName -> ResultName)
forall a b. Simulation a -> (a -> Simulation b) -> Simulation b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ResultSourceShowS
-> Results -> Simulation (ResultName -> ResultName)
showResultsInStartTime ResultSourceShowS
f
showSimulationResultsInStopTime :: ResultSourceShowS -> Simulation Results -> Specs -> IO ShowS
showSimulationResultsInStopTime :: ResultSourceShowS
-> Simulation Results -> Specs -> IO (ResultName -> ResultName)
showSimulationResultsInStopTime ResultSourceShowS
f Simulation Results
model Specs
specs =
(Simulation (ResultName -> ResultName)
-> Specs -> IO (ResultName -> ResultName))
-> Specs
-> Simulation (ResultName -> ResultName)
-> IO (ResultName -> ResultName)
forall a b c. (a -> b -> c) -> b -> a -> c
flip Simulation (ResultName -> ResultName)
-> Specs -> IO (ResultName -> ResultName)
forall a. Simulation a -> Specs -> IO a
runSimulation Specs
specs (Simulation (ResultName -> ResultName)
-> IO (ResultName -> ResultName))
-> Simulation (ResultName -> ResultName)
-> IO (ResultName -> ResultName)
forall a b. (a -> b) -> a -> b
$
Simulation Results
model Simulation Results
-> (Results -> Simulation (ResultName -> ResultName))
-> Simulation (ResultName -> ResultName)
forall a b. Simulation a -> (a -> Simulation b) -> Simulation b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ResultSourceShowS
-> Results -> Simulation (ResultName -> ResultName)
showResultsInStopTime ResultSourceShowS
f
showSimulationResultsInIntegTimes :: ResultSourceShowS -> Simulation Results -> Specs -> IO ShowS
showSimulationResultsInIntegTimes :: ResultSourceShowS
-> Simulation Results -> Specs -> IO (ResultName -> ResultName)
showSimulationResultsInIntegTimes ResultSourceShowS
f Simulation Results
model Specs
specs =
(Simulation (ResultName -> ResultName)
-> Specs -> IO (ResultName -> ResultName))
-> Specs
-> Simulation (ResultName -> ResultName)
-> IO (ResultName -> ResultName)
forall a b c. (a -> b -> c) -> b -> a -> c
flip Simulation (ResultName -> ResultName)
-> Specs -> IO (ResultName -> ResultName)
forall a. Simulation a -> Specs -> IO a
runSimulation Specs
specs (Simulation (ResultName -> ResultName)
-> IO (ResultName -> ResultName))
-> Simulation (ResultName -> ResultName)
-> IO (ResultName -> ResultName)
forall a b. (a -> b) -> a -> b
$
Simulation Results
model Simulation Results
-> (Results -> Simulation (ResultName -> ResultName))
-> Simulation (ResultName -> ResultName)
forall a b. Simulation a -> (a -> Simulation b) -> Simulation b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ResultSourceShowS
-> Results -> Simulation (ResultName -> ResultName)
showResultsInIntegTimes ResultSourceShowS
f
showSimulationResultsInTime :: Double -> ResultSourceShowS -> Simulation Results -> Specs -> IO ShowS
showSimulationResultsInTime :: Double
-> ResultSourceShowS
-> Simulation Results
-> Specs
-> IO (ResultName -> ResultName)
showSimulationResultsInTime Double
t ResultSourceShowS
f Simulation Results
model Specs
specs =
(Simulation (ResultName -> ResultName)
-> Specs -> IO (ResultName -> ResultName))
-> Specs
-> Simulation (ResultName -> ResultName)
-> IO (ResultName -> ResultName)
forall a b c. (a -> b -> c) -> b -> a -> c
flip Simulation (ResultName -> ResultName)
-> Specs -> IO (ResultName -> ResultName)
forall a. Simulation a -> Specs -> IO a
runSimulation Specs
specs (Simulation (ResultName -> ResultName)
-> IO (ResultName -> ResultName))
-> Simulation (ResultName -> ResultName)
-> IO (ResultName -> ResultName)
forall a b. (a -> b) -> a -> b
$
Simulation Results
model Simulation Results
-> (Results -> Simulation (ResultName -> ResultName))
-> Simulation (ResultName -> ResultName)
forall a b. Simulation a -> (a -> Simulation b) -> Simulation b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Double
-> ResultSourceShowS
-> Results
-> Simulation (ResultName -> ResultName)
showResultsInTime Double
t ResultSourceShowS
f
showSimulationResultsInTimes :: [Double] -> ResultSourceShowS -> Simulation Results -> Specs -> IO ShowS
showSimulationResultsInTimes :: [Double]
-> ResultSourceShowS
-> Simulation Results
-> Specs
-> IO (ResultName -> ResultName)
showSimulationResultsInTimes [Double]
ts ResultSourceShowS
f Simulation Results
model Specs
specs =
(Simulation (ResultName -> ResultName)
-> Specs -> IO (ResultName -> ResultName))
-> Specs
-> Simulation (ResultName -> ResultName)
-> IO (ResultName -> ResultName)
forall a b c. (a -> b -> c) -> b -> a -> c
flip Simulation (ResultName -> ResultName)
-> Specs -> IO (ResultName -> ResultName)
forall a. Simulation a -> Specs -> IO a
runSimulation Specs
specs (Simulation (ResultName -> ResultName)
-> IO (ResultName -> ResultName))
-> Simulation (ResultName -> ResultName)
-> IO (ResultName -> ResultName)
forall a b. (a -> b) -> a -> b
$
Simulation Results
model Simulation Results
-> (Results -> Simulation (ResultName -> ResultName))
-> Simulation (ResultName -> ResultName)
forall a b. Simulation a -> (a -> Simulation b) -> Simulation b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= [Double]
-> ResultSourceShowS
-> Results
-> Simulation (ResultName -> ResultName)
showResultsInTimes [Double]
ts ResultSourceShowS
f