summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-regress/programs/barton-mangler-bug/PlotExample.lhs
blob: 66a13fbca7a196ab68f15863c6427cae8db46a31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
This file contains code that is explicitly designed to plot examples
from the signal modeling language.

> module PlotExample where

> import Plot
> import Physical
> import Basic

Our main task is to take a signal and a begin and start point (both
reals) and convert it into something that plotExam can take in the
Plot module.

> plotExample:: (Signal s, Physical a, Physical b) =>
>               String -> [(Float, Float)] -> s a b -> Float -> Float -> String
> plotExample fl expected sig s e = plotExam fl expected s e f
>                    where f  = toFloatFunc f'
>                          f' = mapSignal sig

> toFloatFunc:: (Physical a, Physical b) => (a -> b) -> Float -> Float
> toFloatFunc f x = fromPhysical (f (toPhysical x))