Convert Drawer to a monad transformer

This commit is contained in:
Kiana Sheibani 2023-01-24 13:43:48 -05:00
parent c4065b4b1b
commit 1c6b2bd4a1
Signed by: toki
GPG key ID: 6CB106C25E86A9F7
2 changed files with 4 additions and 4 deletions

View file

@ -6,7 +6,7 @@ import Data.MonadicStreamFunction
import Graphics.Gloss
import Utils
mainSF :: MSF Drawer () ()
mainSF :: MSF (DrawerT IO) () ()
mainSF = proc () -> do
draw -< color white $ circleSolid 40

View file

@ -33,10 +33,10 @@ playMSF display color freq msf = do
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
draw :: MSF Drawer Picture ()
draw :: Monad m => MSF (DrawerT m) Picture ()
draw = arrM tell