|
1 |
| -{-# LANGUAGE DeriveAnyClass #-} |
2 |
| -{-# LANGUAGE DeriveDataTypeable #-} |
3 |
| -{-# LANGUAGE DeriveGeneric #-} |
4 |
| -{-# LANGUAGE DeriveLift #-} |
5 |
| -{-# LANGUAGE ExplicitForAll #-} |
6 |
| -{-# LANGUAGE TypeFamilies #-} |
| 1 | +{-# LANGUAGE DeriveAnyClass #-} |
| 2 | +{-# LANGUAGE DeriveDataTypeable #-} |
| 3 | +{-# LANGUAGE DeriveGeneric #-} |
| 4 | +{-# LANGUAGE DeriveLift #-} |
| 5 | +{-# LANGUAGE ExplicitForAll #-} |
| 6 | +{-# LANGUAGE FlexibleInstances #-} |
| 7 | +{-# LANGUAGE MultiParamTypeClasses #-} |
| 8 | +{-# LANGUAGE TypeFamilies #-} |
7 | 9 |
|
8 | 10 | -- | `Map` type used to represent records and unions
|
9 | 11 |
|
@@ -76,9 +78,12 @@ import Instances.TH.Lift ()
|
76 | 78 | import Language.Haskell.TH.Syntax (Lift)
|
77 | 79 | import Prelude hiding (filter, lookup)
|
78 | 80 |
|
| 81 | +import qualified Data.Foldable.WithIndex as Foldable.WithIndex |
| 82 | +import qualified Data.Functor.WithIndex as Functor.WithIndex |
79 | 83 | import qualified Data.List
|
80 | 84 | import qualified Data.Map.Strict
|
81 | 85 | import qualified Data.Set
|
| 86 | +import qualified Data.Traversable.WithIndex as Traversable.WithIndex |
82 | 87 | import qualified GHC.Exts
|
83 | 88 | import qualified Prelude
|
84 | 89 |
|
@@ -158,6 +163,18 @@ instance Ord k => GHC.Exts.IsList (Map k v) where
|
158 | 163 |
|
159 | 164 | toList = Dhall.Map.toList
|
160 | 165 |
|
| 166 | +instance Ord k => Foldable.WithIndex.FoldableWithIndex k (Map k) where |
| 167 | + ifoldMap = foldMapWithKey |
| 168 | + {-# INLINABLE ifoldMap #-} |
| 169 | + |
| 170 | +instance Functor.WithIndex.FunctorWithIndex k (Map k) where |
| 171 | + imap = mapWithKey |
| 172 | + {-# INLINABLE imap #-} |
| 173 | + |
| 174 | +instance Ord k => Traversable.WithIndex.TraversableWithIndex k (Map k) where |
| 175 | + itraverse = traverseWithKey |
| 176 | + {-# INLINABLE itraverse #-} |
| 177 | + |
161 | 178 | -- | Create an empty `Map`
|
162 | 179 | empty :: Ord k => Map k v
|
163 | 180 | empty = mempty
|
|
0 commit comments