diff options
author | daniel <daniel@wagner-home.com> | 2007-06-05 00:55:34 +0200 |
---|---|---|
committer | daniel <daniel@wagner-home.com> | 2007-06-05 00:55:34 +0200 |
commit | eed29a62d982f028370d4a9957bead22fcb27dda (patch) | |
tree | 6b9e7c286de3dd9ba4342778e2102c5a78f9400c /ReadMap.hs | |
parent | 84ac66c9f2e4fb0aacc569e33427719e5efb9661 (diff) | |
download | XMonadContrib-eed29a62d982f028370d4a9957bead22fcb27dda.tar.gz XMonadContrib-eed29a62d982f028370d4a9957bead22fcb27dda.tar.xz XMonadContrib-eed29a62d982f028370d4a9957bead22fcb27dda.zip |
Contrib package for 6.4 users
darcs-hash:20070604225534-c98ca-f7374f75c0e30ff72391ad1f226c94ca7519f590.gz
Diffstat (limited to 'ReadMap.hs')
-rw-r--r-- | ReadMap.hs | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/ReadMap.hs b/ReadMap.hs deleted file mode 100644 index ab64815..0000000 --- a/ReadMap.hs +++ /dev/null @@ -1,33 +0,0 @@ -module XMonadContrib.ReadMap () where - -{- An instance of Read for Data.Map.Map's; useful for people that are still - - compiling under 6.4. To use it, add the following line to StackSet.hs: - - import XMonadContrib.ReadMap - -} - -import Data.Map (Map, fromList) -import GHC.Read - -instance (Ord k, Read k, Read e) => Read (Map k e) where - readsPrec _ = \s1 -> do - ("{", s2) <- lex s1 - (xs, s3) <- readPairs s2 - ("}", s4) <- lex s3 - return (fromList xs, s4) - --- parses a pair of things with the syntax a:=b --- stolen from the GHC 6.6 sources -readPair :: (Read a, Read b) => ReadS (a,b) -readPair s = do (a, ct1) <- reads s - (":=", ct2) <- lex ct1 - (b, ct3) <- reads ct2 - return ((a,b), ct3) - -readPairs :: (Read a, Read b) => ReadS [(a,b)] -readPairs s1 = case readPair s1 of - [(p, s2)] -> case s2 of - (',':s3) -> do - (ps, s4) <- readPairs s3 - return (p:ps, s4) - _ -> [([p], s2)] - _ -> [([],s1)] |