Created
June 27, 2017 02:33
-
-
Save dobkeratops/f53ac3253ce7b3629e3c95a055c01f9e to your computer and use it in GitHub Desktop.
This file contains 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
callUpdateWith::UIEvent ->IO () | |
callUpdateWith ev=do | |
mw <-readIORef gWorld | |
mu <-readIORef gUpdate | |
ma <-readIORef gAssets | |
-- is there a cleaner way to do this part:- | |
-- I think of 'if let' in Rust (if let Some(a),Some(w),Some(u)) ... | |
-- I also wonder if there's a way to 'pipe' the output of 'callUf u a ev w' into | |
-- the assignments and 'putStrLn | |
case (ma,mw,mu) of | |
(Just a,Just w,Just u)-> | |
let (nw,nu,dbstr)= (callUf u a ev w) in | |
(gWorld$=Just nw) >> (gUpdate$=Just nu) >> (putStrLn dbstr) | |
_ -> return () | |
{- was.. | |
(nw, nu,dbstr)<-return ( | |
case (ma,mw,mu) of | |
(Just a,Just w,Just uf)-> | |
let (a,b,dbstr)=callUf uf a ev w in (Just a, Just b, dbstr) | |
_->(Nothing,Nothing,"no world set") | |
) | |
gWorld$=nw | |
gUpdate$=nu | |
putStrLn dbstr | |
-} | |
return () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment