module Synthesizer.Dimensional.Map where
import qualified Data.Tuple as Tuple
import Data.Tuple.HT as TupleHT (swap, )
import Prelude hiding (map, id, fst, snd, )
newtype T amp0 amp1 yv0 yv1 =
Cons (amp0 -> (amp1, yv0 -> yv1))
independent ::
(amp0 -> amp1) -> (yv0 -> yv1) ->
T amp0 amp1 yv0 yv1
independent f g =
Cons (\amp -> (f amp, g))
double ::
T amp (amp, amp)
y (y, y)
double =
let aux = \x -> (x, x)
in independent aux aux
fst ::
T (amp0,amp1) amp0
(y0,y1) y0
fst =
let aux = Tuple.fst
in independent aux aux
snd ::
T (amp0,amp1) amp1
(y0,y1) y1
snd =
let aux = Tuple.snd
in independent aux aux
swap ::
T (amp0,amp1) (amp1,amp0)
(y0,y1) (y1,y0)
swap =
let aux = TupleHT.swap
in independent aux aux
balanceRight ::
T ((amp0,amp1), amp2) (amp0, (amp1,amp2))
((y0,y1), y2) (y0, (y1,y2))
balanceRight =
let aux = \((a,b), c) -> (a, (b,c))
in independent aux aux
balanceLeft ::
T (amp0, (amp1,amp2)) ((amp0,amp1), amp2)
(y0, (y1,y2)) ((y0,y1), y2)
balanceLeft =
let aux = \(a, (b,c)) -> ((a,b), c)
in independent aux aux
packTriple ::
T (amp0,(amp1,amp2)) (amp0,amp1,amp2)
(y0,(y1,y2)) (y0,y1,y2)
packTriple =
let aux = \(a,(b,c)) -> (a,b,c)
in independent aux aux
unpackTriple ::
T (amp0,amp1,amp2) (amp0,(amp1,amp2))
(y0,y1,y2) (y0,(y1,y2))
unpackTriple =
let aux = \(a,b,c) -> (a,(b,c))
in independent aux aux