Skip to content

Instantly share code, notes, and snippets.

@turion
Created May 28, 2020 12:24
Show Gist options
  • Save turion/ad1dc77f53b0729929403c3313f3810c to your computer and use it in GitHub Desktop.
Save turion/ad1dc77f53b0729929403c3313f3810c to your computer and use it in GitHub Desktop.
data ProbT m a where
ProbT :: m [(Double, a)] -> ProbT m a -- sum double = 1
| GaussianDist
:: Double -- | Mean
-> Double -- | Width
-> ProbT m Double
| ...
return a = [(1, a)]
-- Real system
system :: MSF IO cmd sense
-- Simulation
sim :: Monad m => MSF (ProbT m) cmd (sense, state)
bayesFilter :: MSF (ProbT IO) cmd state
bayesFilter = proc cmd -> do
realSense <- liftTransS system -< cmd
(simSense, state) <- sim -< cmd
arrM guard -< simSense == realSense
returnA -< state
data ContT m r a = ContT ((a -> m r) -> m r)
data LogicT m r a = LogicT ((a -> m r -> m r) -> m r -> m r)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment