Here is the code that was used to work (reliably truncated)
makeNetworkDescription :: forall t . Frameworks t => Parameters -> Moment t () makeNetworkDescription params = do eInput <- fromAddHandler (input params) eTick <- fromAddHandler (tick params) .. let bResourceMap :: Behavior t ResourceMap bResourceMap = accumB initRmap $ adjustMarket <$> bMarketRolls <@ eTick
But now the types have changed.
we have:
makeNetworkDescription :: Parameters -> MomentIO () as well as accumB :: MonadMoment m => a -> Event (a -> a) -> m (Behavior a)
Let's say I change the definition of bResourceMap to
bResourceMap :: Behavior ResourceMap bResourceMap = accumB initRmap $ adjustMarket <$> bMarketRolls <@ eTick
deviated slightly from the definition of accumB , but let's see what happens.
ghc gives an error
Couldn't match type 'Behavior ResourceMap' with 'ResourceMap' Expected type: Behavior ResourceMap Actual type: Behavior (Behavior ResourceMap)
That's right, due to the accumB type accumB behavior should be in the context of MonadMoment . Looking at MonadMoment , I find two instances
instance MonadMoment Moment where liftMoment = id instance MonadMoment MomentIO where liftMoment = MIO . unM
So, why the actual type allowed Behavior (Behavior ResourceMap) , the external type should be MonadMoment , which does not match.
I would like to know how to solve this problem, this happens with all my Behavior definitions.
source share