summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSpencer Janssen <sjanssen@cse.unl.edu>2007-11-01 16:23:02 +0100
committerSpencer Janssen <sjanssen@cse.unl.edu>2007-11-01 16:23:02 +0100
commitcea3e0dfd8b4f1b1fcab1ce85947a040174ac902 (patch)
treeb5fab07fe16bb3fbd085770992596aa4831f7c7c
parent58f44a028428a30b3b6cc8e32039b48b9066841a (diff)
downloadmetatile-cea3e0dfd8b4f1b1fcab1ce85947a040174ac902.tar
metatile-cea3e0dfd8b4f1b1fcab1ce85947a040174ac902.zip
Layouts.Choose: handle ReleaseResources
darcs-hash:20071101152302-a5988-8e1379ea75eb0423007776e9ea4e9d293f61840e
-rw-r--r--Layouts.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/Layouts.hs b/Layouts.hs
index 2d9facf..30c70ea 100644
--- a/Layouts.hs
+++ b/Layouts.hs
@@ -71,6 +71,14 @@ instance (LayoutClass l a, LayoutClass r a) => LayoutClass (Choose l r) a where
mr <- handleMessage r (SomeMessage FirstLayout)
return . Just . SRight l $ fromMaybe r mr
+ handleMessage lr m | Just ReleaseResources <- fromMessage m =
+ liftM2 ((Just .) . cons)
+ (fmap (fromMaybe l) $ handleMessage l m)
+ (fmap (fromMaybe r) $ handleMessage r m)
+ where (cons, l, r) = case lr of
+ (SLeft r l) -> (flip SLeft, l, r)
+ (SRight l r) -> (SRight, l, r)
+
-- The default cases for left and right:
handleMessage (SLeft r l) m = fmap (fmap $ SLeft r) $ handleMessage l m
handleMessage (SRight l r) m = fmap (fmap $ SRight l) $ handleMessage r m