netwire

Console interactivity in Netwire?

两盒软妹~` 提交于 2019-11-28 11:35:17
I am testing with the Netwire haskell library and made it work with a simple time wire: import Control.Wire import Prelude hiding ((.), id) import Control.Monad.IO.Class import Data.Functor.Identity import System.IO wire :: (HasTime t s) => Wire s () m a t wire = time run :: (HasTime t s, MonadIO m, Show b, Show e) => Session m s -> Wire s e m a b -> m () run session wire = do (dt, session') <- stepSession session (wt', wire') <- stepWire wire dt $ Right undefined case wt' of -- | Exit Left _ -> return () Right x -> do liftIO $ do putChar '\r' putStr $ either (\ex -> show ex) show wt' hFlush

Kleisli Arrow in Netwire 5?

不想你离开。 提交于 2019-11-27 08:06:12
问题 I am trying to create a game using Haskell + Netwire 5 (+ SDL). Now I am working on the output part, where I would like to create wires that read in some game state and output the SDL surfaces to be blitted on screen. However, the problem is that SDL surfaces are contained in IO monad, so any function that creates such surfaces must have type a -> IO b . Of course, arr does not construct a Wire from a -> m b . However, since the type signature of a wire is (Monad m, Monoid e) => Wire s e m a

Console interactivity in Netwire?

妖精的绣舞 提交于 2019-11-27 06:22:14
问题 I am testing with the Netwire haskell library and made it work with a simple time wire: import Control.Wire import Prelude hiding ((.), id) import Control.Monad.IO.Class import Data.Functor.Identity import System.IO wire :: (HasTime t s) => Wire s () m a t wire = time run :: (HasTime t s, MonadIO m, Show b, Show e) => Session m s -> Wire s e m a b -> m () run session wire = do (dt, session') <- stepSession session (wt', wire') <- stepWire wire dt $ Right undefined case wt' of -- | Exit Left _