File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,6 @@ module Data.Graph.Inductive.PatriciaTree
28
28
import Data.Graph.Inductive.Graph
29
29
30
30
import Control.Applicative (liftA2 )
31
- import Control.Arrow (second )
32
31
import Data.IntMap (IntMap )
33
32
import qualified Data.IntMap as IM
34
33
import Data.List (sort )
@@ -42,6 +41,12 @@ import Control.DeepSeq (NFData (..))
42
41
import GHC.Generics (Generic )
43
42
#endif
44
43
44
+ #if MIN_VERSION_base (4,8,0)
45
+ import Data.Bifunctor
46
+ #else
47
+ import Control.Arrow (second )
48
+ #endif
49
+
45
50
----------------------------------------------------------------------
46
51
-- GRAPH REPRESENTATION
47
52
----------------------------------------------------------------------
@@ -120,6 +125,15 @@ instance (NFData a, NFData b) => NFData (Gr a b) where
120
125
rnf (Gr g) = rnf g
121
126
#endif
122
127
128
+ #if MIN_VERSION_base (4,8,0)
129
+ instance Bifunctor Gr where
130
+ bimap = fastNEMap
131
+
132
+ first = fastNMap
133
+
134
+ second = fastEMap
135
+ #endif
136
+
123
137
matchGr :: Node -> Gr a b -> Decomp Gr a b
124
138
matchGr node (Gr g)
125
139
= case IM. lookup node g of
Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ module Data.Graph.Inductive.Tree (Gr,UGr) where
14
14
import Data.Graph.Inductive.Graph
15
15
16
16
import Control.Applicative (liftA2 )
17
- import Control.Arrow (first , second )
18
17
import Data.List (foldl' , sort )
19
18
import Data.Map (Map )
20
19
import qualified Data.Map as M
@@ -28,6 +27,12 @@ import Control.DeepSeq (NFData (..))
28
27
import GHC.Generics (Generic )
29
28
#endif
30
29
30
+ #if MIN_VERSION_base (4,8,0)
31
+ import Data.Bifunctor
32
+ #else
33
+ import Control.Arrow (first , second )
34
+ #endif
35
+
31
36
----------------------------------------------------------------------
32
37
-- GRAPH REPRESENTATION
33
38
----------------------------------------------------------------------
@@ -130,6 +135,15 @@ instance (NFData a, NFData b) => NFData (Gr a b) where
130
135
rnf (Gr g) = rnf g
131
136
#endif
132
137
138
+ #if MIN_VERSION_base (4,8,0)
139
+ instance Bifunctor Gr where
140
+ bimap = nemap
141
+
142
+ first = nmap
143
+
144
+ second = emap
145
+ #endif
146
+
133
147
----------------------------------------------------------------------
134
148
-- UTILITIES
135
149
----------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments