diff options
-rw-r--r-- | IntMapClass.hs | 9 | ||||
-rwxr-xr-x | t | 16 |
2 files changed, 24 insertions, 1 deletions
diff --git a/IntMapClass.hs b/IntMapClass.hs index 9ab83db..28ae5ba 100644 --- a/IntMapClass.hs +++ b/IntMapClass.hs | |||
@@ -51,6 +51,8 @@ adapt_m_m f m = adapt_m (adapt_m f m) | |||
51 | adapt_m :: (IntMap a -> x) -> IMap k a -> x | 51 | adapt_m :: (IntMap a -> x) -> IMap k a -> x |
52 | adapt_m f (IMap m) = f m | 52 | adapt_m f (IMap m) = f m |
53 | 53 | ||
54 | first f (x,y) = (f x,y) | ||
55 | |||
54 | 56 | ||
55 | (!) :: Coercible k Int => IMap k a -> k -> a | 57 | (!) :: Coercible k Int => IMap k a -> k -> a |
56 | (!) = adapt_m_k (IntMap.!) | 58 | (!) = adapt_m_k (IntMap.!) |
@@ -75,4 +77,9 @@ findWithDefault a = adapt_k_m (IntMap.findWithDefault a) | |||
75 | 77 | ||
76 | lookupLT :: ( Coercible Int k, Coercible k Int ) => k -> IMap k a -> Maybe (k, a) | 78 | lookupLT :: ( Coercible Int k, Coercible k Int ) => k -> IMap k a -> Maybe (k, a) |
77 | lookupLT k m = fmap (first coerce) $ adapt_k_m (IntMap.lookupLT) k m | 79 | lookupLT k m = fmap (first coerce) $ adapt_k_m (IntMap.lookupLT) k m |
78 | where first f (x,y) = (f x,y) | 80 | lookupGT :: ( Coercible Int k, Coercible k Int ) => k -> IMap k a -> Maybe (k, a) |
81 | lookupGT k m = fmap (first coerce) $ adapt_k_m (IntMap.lookupGT) k m | ||
82 | lookupLE :: ( Coercible Int k, Coercible k Int ) => k -> IMap k a -> Maybe (k, a) | ||
83 | lookupLE k m = fmap (first coerce) $ adapt_k_m (IntMap.lookupLE) k m | ||
84 | lookupGE :: ( Coercible Int k, Coercible k Int ) => k -> IMap k a -> Maybe (k, a) | ||
85 | lookupGE k m = fmap (first coerce) $ adapt_k_m (IntMap.lookupGE) k m | ||
@@ -0,0 +1,16 @@ | |||
1 | #!/bin/bash | ||
2 | args="-threaded -fwarn-unused-binds -fwarn-unused-imports -rtsopts -DRENDERFLUSH -optP-include -optPdist/build/autogen/cabal_macros.h" | ||
3 | |||
4 | cfiles="dotlock.c" | ||
5 | |||
6 | root=${0%/*} | ||
7 | cd "$root" | ||
8 | |||
9 | me=${0##*/} | ||
10 | me=${me%.*} | ||
11 | ghc \ | ||
12 | -hidir build/$me -odir build/$me \ | ||
13 | -iPresence \ | ||
14 | $cfiles \ | ||
15 | $args \ | ||
16 | "$@" | ||