summaryrefslogtreecommitdiffstats
path: root/StackSet.hs
diff options
context:
space:
mode:
authorJason Creighton <jcreigh@gmail.com>2007-03-18 00:49:04 +0100
committerJason Creighton <jcreigh@gmail.com>2007-03-18 00:49:04 +0100
commit6ed3ba2d0e2cc40d1cabcb51d22a71bcecbbc851 (patch)
treed4c4759fde1bc0c5cf7827a46def25c22d5b4fff /StackSet.hs
parent32cd5baf1f5ef4b83a329fa6d335b956e5d694ec (diff)
downloadmetatile-6ed3ba2d0e2cc40d1cabcb51d22a71bcecbbc851.tar
metatile-6ed3ba2d0e2cc40d1cabcb51d22a71bcecbbc851.zip
basic xinerama support (depends on Graphics.X11.Xinerama in X11-extras)
darcs-hash:20070317234904-b9aa7-ef29cf597970298a24d770ec789f83638390d22a
Diffstat (limited to 'StackSet.hs')
-rw-r--r--StackSet.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/StackSet.hs b/StackSet.hs
index 15788bc..1453c97 100644
--- a/StackSet.hs
+++ b/StackSet.hs
@@ -61,6 +61,10 @@ empty n = StackSet { current = 0
member :: Ord a => a -> StackSet a -> Bool
member a w = M.member a (cache w)
+-- | /O(log n)/. Looks up the stack that x is in, if it is in the StackSet
+lookup :: (Monad m, Ord a) => a -> StackSet a -> m Int
+lookup x w = M.lookup x (cache w)
+
-- | /O(n)/. Number of stacks
size :: StackSet a -> Int
size = M.size . stacks