summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IntMapClass.hs9
-rwxr-xr-xt16
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)
51adapt_m :: (IntMap a -> x) -> IMap k a -> x 51adapt_m :: (IntMap a -> x) -> IMap k a -> x
52adapt_m f (IMap m) = f m 52adapt_m f (IMap m) = f m
53 53
54first 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
76lookupLT :: ( Coercible Int k, Coercible k Int ) => k -> IMap k a -> Maybe (k, a) 78lookupLT :: ( Coercible Int k, Coercible k Int ) => k -> IMap k a -> Maybe (k, a)
77lookupLT k m = fmap (first coerce) $ adapt_k_m (IntMap.lookupLT) k m 79lookupLT k m = fmap (first coerce) $ adapt_k_m (IntMap.lookupLT) k m
78 where first f (x,y) = (f x,y) 80lookupGT :: ( Coercible Int k, Coercible k Int ) => k -> IMap k a -> Maybe (k, a)
81lookupGT k m = fmap (first coerce) $ adapt_k_m (IntMap.lookupGT) k m
82lookupLE :: ( Coercible Int k, Coercible k Int ) => k -> IMap k a -> Maybe (k, a)
83lookupLE k m = fmap (first coerce) $ adapt_k_m (IntMap.lookupLE) k m
84lookupGE :: ( Coercible Int k, Coercible k Int ) => k -> IMap k a -> Maybe (k, a)
85lookupGE k m = fmap (first coerce) $ adapt_k_m (IntMap.lookupGE) k m
diff --git a/t b/t
new file mode 100755
index 0000000..78daeab
--- /dev/null
+++ b/t
@@ -0,0 +1,16 @@
1#!/bin/bash
2args="-threaded -fwarn-unused-binds -fwarn-unused-imports -rtsopts -DRENDERFLUSH -optP-include -optPdist/build/autogen/cabal_macros.h"
3
4cfiles="dotlock.c"
5
6root=${0%/*}
7cd "$root"
8
9me=${0##*/}
10me=${me%.*}
11ghc \
12 -hidir build/$me -odir build/$me \
13 -iPresence \
14 $cfiles \
15 $args \
16 "$@"