turion / rhine

Haskell Functional Reactive Programming framework with type-level clocks
http://hackage.haskell.org/package/rhine
121 stars 21 forks source link

Hide more clock constraints #72

Open turion opened 6 years ago

turion commented 6 years ago

Right now, many combinators like **@ @** etc. require a lot of constraints on clock types, especially on their time domains. It would be great if those could be hidden, maybe via GADTs or in the type classes, in the reusable components, i.e. Schedules, ResamplingBuffers and so on.

turion commented 6 years ago

As a benchmark, try to get the following to compile with as few constraints as possible:

rhine1 :: Rhine m cl1 a b
rhine1 = undefined

rhine2 :: Rhine m cl1 a b
rhine2 = undefined

schedule :: Schedule m cl1 cl2
schedule = undefined

parRhine
  :: (Time cl1 ~ Time (Out cl1), Time cl2 ~ Time (Out cl2), Time cl1 ~ Time (In cl1), Time cl2 ~ Time (In cl2), Time cl1 ~ Time cl2, Clock m cl1, Clock m cl2)
  => Rhine m (ParClock m cl1 cl2) a b
parRhine = rhine1 **@ schedule @** rhine2
turion commented 6 years ago

Some ideas in https://github.com/turion/rhine/tree/dev_hide_clock_constraints_#72

turion commented 4 years ago

Another kind of constraints are all the GetClockProxy constraints, introduced in #140.