From 1c6b2bd4a13d4cb4700c57147dd7e0833bd15681 Mon Sep 17 00:00:00 2001 From: Kiana Sheibani Date: Tue, 24 Jan 2023 13:43:48 -0500 Subject: [PATCH] Convert Drawer to a monad transformer --- src/Main.hs | 2 +- src/Utils.hs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Main.hs b/src/Main.hs index 329631c..f901016 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -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 diff --git a/src/Utils.hs b/src/Utils.hs index 5edac2e..10a1047 100644 --- a/src/Utils.hs +++ b/src/Utils.hs @@ -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