Background
I am using repa
more as a "management" tool. I pass around reactive-banana
s AddHandlers
in an Array
: Array D DIM2 (AddHandler Bool)
.
Currently I am using this kludge:
mapMArray :: (Monad m, R.Source r a, R.Shape sh) => (a -> m b) -> Array r sh a -> m (Array D sh b)
mapMArray f a = do
l <- mapM f . R.toList $ a
return $ R.fromFunction sh (\i -> l !! R.toIndex sh i)
where sh = R.extent a
So I can do something like this:
makeNetworkDesc :: Frameworks t => Array D DIM2 (AddHandler Bool) -> Moment t ()
makeNetworkDesc events = do
-- inputs
aes <- mapMArray fromAddHandler events
-- outputs
_ <- mapMArray (reactimate . (print <$>)) aes
Question
Is there a reason why this is not included in repa
?