[<<][meta_siso][>>][..]
Wed Jul 29 22:11:50 EDT 2015

So what's the type for mix?


mix :: ...

the point is to _avoid_ higher order functions.
these are functionals as in backus' formulation.

this means that functions should never be values, and that 'mix'
itself acts as a macro.

so 1: mix operates on arrows (systems and signals).


-- Mix multiple signal generators.
-- Each generator is parameterized by an integer.
mix :: Ring m r o => (r Int) -> (r Int -> Sys m () (r o)) -> Sys m () (r o)
mix num body = undefined


See Lib.hs


The more general question is how to map an arrow..

Some other ideas:

-- Mix multiple signal generators.
-- Each generator is parameterized by an integer.
mix :: (Vec a i, Ring m r o) =>
       Int ->                         -- nb of instances (known at compile time)
       (r Int -> Sys m (r i) (r o))   -- instance generator
       -> Sys m (r (v i)) (r o)       -- resulting system
mix num body = undefined


-- Map Sys
maps :: (Vec ai i, Vec ao o) =>
        Sys m (r     i)  (r     o)  ->
        Sys m (r (ai i)) (r (ao o))
maps sys = undefined



But this seems better:


class Vec v t where
  vec :: t -> v t


-- Note: 'r' is always the outer type constructor wrt. 'v'.
-- And 'm' is outer wrt. 'r'.

class (Vec v t1, Vec v t2, Data m r)
      => VecMap v m r t1 t2 where
  vmap :: (r a -> m (r b)) ->
          r (v a) ->
          r (v b)

class (Vec v e, Data m r)
      => VecFold v m r e a where
  vfold :: (r e -> r a -> m (r a)) ->
           r a ->
           r (v e) ->
           m (r a)


Now let's try to implement this for Eval.



[Reply][About]
[<<][meta_siso][>>][..]