From d235a180b642f62b19acc582166255f015d38438 Mon Sep 17 00:00:00 2001 From: Carlos Sosa Date: Sat, 21 Mar 2020 18:41:35 -0700 Subject: Move to stack src directory --- src/ch3/SimpleGraphics.hs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/ch3/SimpleGraphics.hs (limited to 'src/ch3/SimpleGraphics.hs') diff --git a/src/ch3/SimpleGraphics.hs b/src/ch3/SimpleGraphics.hs new file mode 100644 index 0000000..5e160a7 --- /dev/null +++ b/src/ch3/SimpleGraphics.hs @@ -0,0 +1,24 @@ +module SimpleGraphics where + +import Graphics.SOE + +main0 = runGraphics ( + do w <- openWindow "My First Graphics Program" (300,300) + drawInWindow w (text (100,200) "HelloGraphicsWolrd") + spaceClose w + ) + +spaceClose :: Window -> IO () +spaceClose w = do k <- getKey w + if k == ' ' then closeWindow w + else spaceClose w +getLine :: IO String +getLine = do c <- getChar + if c == '\n' then return "" + else do v <- SimpleGraphics.getLine + return (c:v) + +putStr :: String -> IO () +putStr [] = return () +putStr (x:xs) = do putChar x + SimpleGraphics.putStr xs -- cgit v1.3-2-g0d8e