From d12f4d54a9d13b6c01abc2707042d61577c7c970 Mon Sep 17 00:00:00 2001 From: defanor Date: Tue, 28 Oct 2014 16:04:23 +0400 Subject: [PATCH] updated etest to new effects --- test/etest.idr | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/test/etest.idr b/test/etest.idr index 1521eb0..e841563 100644 --- a/test/etest.idr +++ b/test/etest.idr @@ -26,28 +26,28 @@ data Vars = Position -- position of ellipse -- generation and console I/O Prog : Type -> Type -> Type -Prog i t = Eff IO [SDL i, - Position ::: STATE (Int, Int), - XMove ::: STATE Int, - YMove ::: STATE Int, - Frames ::: STATE Integer, - Starfield ::: STATE (List (Int, Int)), - RND, - STDIO] t +Prog i t = {[SDL i, + Position ::: STATE (Int, Int), + XMove ::: STATE Int, + YMove ::: STATE Int, + Frames ::: STATE Integer, + Starfield ::: STATE (List (Int, Int)), + RND, + STDIO]} Eff t -- Convenient shorthand for initialised SDL Running : Type -> Type Running t = Prog SDLSurface t -initStarfield : List (Int, Int) -> Int -> Eff m [RND] (List (Int, Int)) +initStarfield : List (Int, Int) -> Int -> { [RND] } Eff (List (Int, Int)) initStarfield acc 0 = return acc initStarfield acc n = do x <- rndInt 0 639 y <- rndInt 0 479 initStarfield ((fromInteger x, fromInteger y) :: acc) (n - 1) -updateStarfield : List (Int, Int) -> Eff m [RND] (List (Int, Int)) +updateStarfield : List (Int, Int) -> { [RND] } Eff (List (Int, Int)) updateStarfield xs = upd [] xs where - upd : List (Int, Int) -> List (Int, Int) -> Eff m [RND] (List (Int, Int)) + upd : List (Int, Int) -> List (Int, Int) -> { [RND] } Eff (List (Int, Int)) upd acc [] = return acc upd acc ((x, y) :: xs) = if (y > 479) then do @@ -56,7 +56,7 @@ updateStarfield xs = upd [] xs where else upd ((x, y+1) :: acc) xs -drawStarfield : List (Int, Int) -> Eff IO [SDL_ON] () +drawStarfield : List (Int, Int) -> { [SDL_ON] } Eff () drawStarfield [] = return () drawStarfield ((x, y) :: xs) = do line white x y x y drawStarfield xs @@ -132,7 +132,7 @@ emain = do initialise 640 480 when continue eventLoop main : IO () -main = run [(), Position := (320,200), +main = runInit [(), Position := (320,200), XMove := 0, YMove := 0, Frames := 0,