diff options
Diffstat (limited to 'src/Data/Dependent/EnumMap/Strict')
| -rw-r--r-- | src/Data/Dependent/EnumMap/Strict/Internal.hs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/Data/Dependent/EnumMap/Strict/Internal.hs b/src/Data/Dependent/EnumMap/Strict/Internal.hs index 05e130e..4b2264c 100644 --- a/src/Data/Dependent/EnumMap/Strict/Internal.hs +++ b/src/Data/Dependent/EnumMap/Strict/Internal.hs @@ -115,13 +115,13 @@ fromListWith f (l :: [DSum k v]) = Refl -> KV inf1 (f v1 v2)) (dSumToKV <$> l)) -fromListWithKey :: (Enum1 k, TestEquality k) +fromListWithKey :: forall k v. (Enum1 k, TestEquality k) => (forall a. k a -> v a -> v a -> v a) -> [DSum k v] -> DEnumMap k v fromListWithKey f l = DEnumMap (IM.fromListWithKey (\i (KV inf1 v1) (KV inf2 v2) -> - case toEnum1 i inf1 of + case toEnum1 @k i inf1 of k1 -> case typeCheck1 k1 i inf2 of Refl -> KV inf1 (f k1 v1 v2)) (dSumToKV <$> l)) @@ -141,13 +141,13 @@ fromAscListWith f (l :: [DSum k v]) = Refl -> KV inf1 (f v1 v2)) (dSumToKV <$> l)) -fromAscListWithKey :: (Enum1 k, TestEquality k) +fromAscListWithKey :: forall k v. (Enum1 k, TestEquality k) => (forall a. k a -> v a -> v a -> v a) -> [DSum k v] -> DEnumMap k v fromAscListWithKey f l = DEnumMap (IM.fromAscListWithKey (\i (KV inf1 v1) (KV inf2 v2) -> - case toEnum1 i inf1 of + case toEnum1 @k i inf1 of k1 -> case typeCheck1 k1 i inf2 of Refl -> KV inf1 (f k1 v1 v2)) (dSumToKV <$> l)) @@ -314,12 +314,12 @@ unionWith f (DEnumMap m1 :: DEnumMap k v) (DEnumMap m2) = DEnumMap (IM.unionWith f' i (KV inf1 v1) (KV inf2 v2) = case typeCheck2 (Proxy @k) i inf1 inf2 of Refl -> KV inf1 (f v1 v2) -unionWithKey :: (Enum1 k, TestEquality k) +unionWithKey :: forall k v. (Enum1 k, TestEquality k) => (forall a. k a -> v a -> v a -> v a) -> DEnumMap k v -> DEnumMap k v -> DEnumMap k v unionWithKey f (DEnumMap m1 :: DEnumMap k v) (DEnumMap m2) = DEnumMap (IM.unionWithKey f' m1 m2) where f' :: Int -> KV k v -> KV k v -> KV k v - f' i (KV inf1 v1) (KV inf2 v2) = case toEnum1 i inf1 of + f' i (KV inf1 v1) (KV inf2 v2) = case toEnum1 @k i inf1 of k1 -> case typeCheck1 k1 i inf2 of Refl -> KV inf1 (f k1 v1 v2) @@ -352,7 +352,7 @@ differenceWithKey :: forall k v1 v2. (Enum1 k, TestEquality k) differenceWithKey f (DEnumMap m1) (DEnumMap m2) = DEnumMap (IM.differenceWithKey f' m1 m2) where f' :: Int -> KV k v1 -> KV k v2 -> Maybe (KV k v1) - f' i (KV inf1 v1) (KV inf2 v2) = case toEnum1 i inf1 of + f' i (KV inf1 v1) (KV inf2 v2) = case toEnum1 @k i inf1 of k1 -> case typeCheck1 k1 i inf2 of Refl -> KV inf1 <$> f k1 v1 v2 @@ -393,7 +393,7 @@ intersectionWithKey :: forall k v1 v2 v3. (Enum1 k, TestEquality k) intersectionWithKey f (DEnumMap m1) (DEnumMap m2) = DEnumMap (IM.intersectionWithKey f' m1 m2) where f' :: Int -> KV k v1 -> KV k v2 -> KV k v3 - f' i (KV inf1 v1) (KV inf2 v2) = case toEnum1 i inf1 of + f' i (KV inf1 v1) (KV inf2 v2) = case toEnum1 @k i inf1 of k1 -> case typeCheck1 k1 i inf2 of Refl -> KV inf1 $ f k1 v1 v2 @@ -430,7 +430,7 @@ mergeWithKey f g1 g2 (DEnumMap m1) (DEnumMap m2) = DEnumMap (IM.mergeWithKey f' (coerce g1) (coerce g2) m1 m2) where f' :: Int -> KV k v1 -> KV k v2 -> Maybe (KV k v3) - f' i (KV inf1 v1) (KV inf2 v2) = case toEnum1 i inf1 of + f' i (KV inf1 v1) (KV inf2 v2) = case toEnum1 @k i inf1 of k1 -> case typeCheck1 k1 i inf2 of Refl -> KV inf1 <$> f k1 v1 v2 |
