|
16 | 16 | {-# LANGUAGE RecordWildCards #-}
|
17 | 17 | {-# LANGUAGE ScopedTypeVariables #-}
|
18 | 18 | {-# LANGUAGE TypeFamilies #-}
|
| 19 | +#if __GLASGOW_HASKELL >= 800 |
| 20 | +{-# OPTIONS_GHC -Wno-name-shadowing #-} |
| 21 | +#else |
| 22 | +{-# OPTIONS_GHC -fno-warn-name-shadowing #-} |
| 23 | +#endif |
19 | 24 |
|
20 | 25 | -- | Base types used by all of Haxl. Most users should import
|
21 | 26 | -- "Haxl.Core" instead of importing this module directly.
|
@@ -135,17 +140,25 @@ defaultFlags = Flags
|
135 | 140 | , caching = 1
|
136 | 141 | }
|
137 | 142 |
|
| 143 | +#if __GLASGOW_HASKELL__ >= 710 |
| 144 | +#define FUNMONAD Monad m |
| 145 | +#else |
| 146 | +#define FUNMONAD (Functor m, Monad m) |
| 147 | +#endif |
| 148 | + |
138 | 149 | -- | Runs an action if the tracing level is above the given threshold.
|
139 |
| -ifTrace :: (Functor m, Monad m) => Flags -> Int -> m a -> m () |
| 150 | +ifTrace :: FUNMONAD => Flags -> Int -> m a -> m () |
140 | 151 | ifTrace flags i = when (trace flags >= i) . void
|
141 | 152 |
|
142 | 153 | -- | Runs an action if the report level is above the given threshold.
|
143 |
| -ifReport :: (Functor m, Monad m) => Flags -> Int -> m a -> m () |
| 154 | +ifReport :: FUNMONAD => Flags -> Int -> m a -> m () |
144 | 155 | ifReport flags i = when (report flags >= i) . void
|
145 | 156 |
|
146 |
| -ifProfiling :: (Functor m, Monad m) => Flags -> m a -> m () |
| 157 | +ifProfiling :: FUNMONAD => Flags -> m a -> m () |
147 | 158 | ifProfiling flags = when (report flags >= 4) . void
|
148 | 159 |
|
| 160 | +#undef FUNMONAD |
| 161 | + |
149 | 162 | -- ---------------------------------------------------------------------------
|
150 | 163 | -- Stats
|
151 | 164 |
|
|
0 commit comments