Convert Drawer to a monad transformer
This commit is contained in:
parent
c4065b4b1b
commit
1c6b2bd4a1
|
@ -6,7 +6,7 @@ import Data.MonadicStreamFunction
|
||||||
import Graphics.Gloss
|
import Graphics.Gloss
|
||||||
import Utils
|
import Utils
|
||||||
|
|
||||||
mainSF :: MSF Drawer () ()
|
mainSF :: MSF (DrawerT IO) () ()
|
||||||
mainSF = proc () -> do
|
mainSF = proc () -> do
|
||||||
draw -< color white $ circleSolid 40
|
draw -< color white $ circleSolid 40
|
||||||
|
|
||||||
|
|
|
@ -33,10 +33,10 @@ playMSF display color freq msf = do
|
||||||
|
|
||||||
playIO display color freq () toPic handleInput stepWorld
|
playIO display color freq () toPic handleInput stepWorld
|
||||||
|
|
||||||
type Drawer = WriterT Picture (ReaderT (Maybe Event) IO)
|
type DrawerT m = WriterT Picture (ReaderT (Maybe Event) m)
|
||||||
|
|
||||||
runDrawerS :: MSF Drawer () () -> MSF IO (Maybe Event) Picture
|
runDrawerS :: Monad m => MSF (DrawerT m) () () -> MSF m (Maybe Event) Picture
|
||||||
runDrawerS msf = arr (,()) >>> runReaderS (runWriterS msf) >>> arr fst
|
runDrawerS msf = arr (,()) >>> runReaderS (runWriterS msf) >>> arr fst
|
||||||
|
|
||||||
draw :: MSF Drawer Picture ()
|
draw :: Monad m => MSF (DrawerT m) Picture ()
|
||||||
draw = arrM tell
|
draw = arrM tell
|
||||||
|
|
Loading…
Reference in a new issue