I'm currently trying to embed Cloud Haskell with Yesod framework. I currently want to store data into database when a Process gets data from the cloud. The backend I'm using is
P2P and I'm using the following code:
-- To start the peer
bootstrap "127.0.0.1" "9001" "
127.0.0.1:9002" mainProcess
mainProcess :: Process ()
mainProcess = do
forever $ do
liftIO $ threadDelay (2*1000000)
nodeIds <- P2P.getPeers
-- yesod persistent syntex
_ <- runDB $ insert $ Peers (T.pack (show nodeIds))
return ()
So whats the best way to run a database query inside a Process? Do I need to make an instance for insert?