This is all fine except when I instantiate the class with:
data Input a = Input [(a, String)]
instance Signal (Input a)
type SignalData (Input a) = a
The concrete type of Input a is not known, so its difficult to store in lists, to serialize...
So I need to create a "view" for the it:
class (Signal s, Signal v) => SignalView s v where
view :: s -> v
data InputView = InputView [(Int, String)]instance Signal InputView
type SignalData InputView = Int
instance SignalView (Input a) InputView
view (Input as) = InputView (zip [0…] (snd <$> as))
Is this a common pattern?
I'm not sure I get it right...