Last active
September 12, 2015 10:58
-
-
Save timjb/7dca910fa730012a4b6f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TypeOperators, ScopedTypeVariables #-} | |
import Prelude hiding (until) | |
import Control.Monad hiding (when) | |
import Control.Applicative hiding (empty) | |
import Data.Set hiding (filter,fold, foldl,map) | |
import Control.FRPNow | |
import Control.FRPNow.Gloss | |
import Graphics.Gloss.Interface.Pure.Game | |
picture :: Int -> Picture | |
picture numCurry = Text $ show numCurry | |
mainFRP :: Behavior Float -> EvStream GEvent -> Behavior (Behavior Picture) | |
mainFRP time evs = mainBehavior 0 | |
where mainBehavior :: Int -> Behavior (Behavior Picture) | |
mainBehavior n = do | |
pressPlusEv <- next $ void $ filterEs isPressPlus evs | |
nextMain <- snapshot (mainBehavior (n+1)) pressPlusEv | |
pure $ picture n `step` nextMain | |
isPressPlus (EventKey (Char '+') Down _ _) = True | |
isPressPlus _ = False | |
main = runNowGlossPure (InWindow "CurryCounter" (800, 600) (10, 10)) white 60 mainFRP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment