Skip to content

Commit ca65bb9

Browse files
authored
Fix warnings for -XStarIsType (#149)
This is backwards compatible for all GHC >= 8.0
1 parent 18e222f commit ca65bb9

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

Haxl/Core/DataSource.hs

+3-2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import Control.Exception
5757
import Control.Monad
5858
import Data.Hashable
5959
import Data.Text (Text)
60+
import Data.Kind (Type)
6061
import Data.Typeable
6162

6263
import Haxl.Core.Exception
@@ -109,7 +110,7 @@ class (DataSourceName req, StateKey req, ShowP req) => DataSource u req where
109110
classifyFailure :: u -> req a -> SomeException -> FailureClassification
110111
classifyFailure _ _ _ = StandardFailure
111112

112-
class DataSourceName (req :: * -> *) where
113+
class DataSourceName (req :: Type -> Type) where
113114
-- | The name of this 'DataSource', used in tracing and stats. Must
114115
-- take a dummy request.
115116
dataSourceName :: Proxy req -> Text
@@ -130,7 +131,7 @@ type Request req a =
130131
)
131132

132133
-- | Hints to the scheduler about this data source
133-
data SchedulerHint (req :: * -> *)
134+
data SchedulerHint (req :: Type -> Type)
134135
= TryToBatch
135136
-- ^ Hold data-source requests while we execute as much as we can, so
136137
-- that we can hopefully collect more requests to batch.

Haxl/Core/Fetch.hs

+3-2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import Data.Monoid
4848
import Data.Proxy
4949
import Data.Typeable
5050
import Data.Text (Text)
51+
import Data.Kind (Type)
5152
import qualified Data.Text as Text
5253
import Text.Printf
5354
#ifdef PROFILING
@@ -316,7 +317,7 @@ dataFetchWithInsert showFn insertFn req =
316317
-- allows a transparent run afterwards. Without this, the test would try to
317318
-- call the datasource during testing and that would be an exception.
318319
uncachedRequest
319-
:: forall a u w (r :: * -> *). (DataSource u r, Request r a)
320+
:: forall a u w (r :: Type -> Type). (DataSource u r, Request r a)
320321
=> r a -> GenHaxl u w a
321322
uncachedRequest req = do
322323
flg <- env flags
@@ -485,7 +486,7 @@ performFetches env@Env{flags=f, statsRef=sref, statsBatchIdRef=sbref} jobs = do
485486

486487
data FetchToDo where
487488
FetchToDo
488-
:: forall (req :: * -> *). (DataSourceName req, Typeable req)
489+
:: forall (req :: Type -> Type). (DataSourceName req, Typeable req)
489490
=> [BlockedFetch req] -> PerformFetch req -> FetchToDo
490491

491492
-- Catch exceptions arising from the data source and stuff them into

Haxl/Core/RequestStore.hs

+4-3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import qualified Data.HashMap.Strict as HashMap
4444
import qualified Data.Map.Strict as Map
4545
import Data.Proxy
4646
import Data.Text (Text)
47+
import Data.Kind (Type)
4748
import Data.Typeable
4849
import Unsafe.Coerce
4950

@@ -110,23 +111,23 @@ emptyReqCounts :: ReqCountMap
110111
emptyReqCounts = ReqCountMap Map.empty
111112

112113
addToCountMap
113-
:: forall (r :: * -> *). (DataSourceName r, Typeable r)
114+
:: forall (r :: Type -> Type). (DataSourceName r, Typeable r)
114115
=> Proxy r
115116
-> Int -- type and number of requests
116117
-> ReqCountMap
117118
-> ReqCountMap
118119
addToCountMap = updateCountMap (+)
119120

120121
subFromCountMap
121-
:: forall (r :: * -> *). (DataSourceName r, Typeable r)
122+
:: forall (r :: Type -> Type). (DataSourceName r, Typeable r)
122123
=> Proxy r
123124
-> Int -- type and number of requests
124125
-> ReqCountMap
125126
-> ReqCountMap
126127
subFromCountMap = updateCountMap (-)
127128

128129
updateCountMap
129-
:: forall (r :: * -> *). (DataSourceName r, Typeable r)
130+
:: forall (r :: Type -> Type). (DataSourceName r, Typeable r)
130131
=> (Int -> Int -> Int)
131132
-> Proxy r
132133
-> Int -- type and number of requests

Haxl/Core/StateStore.hs

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ module Haxl.Core.StateStore
2323
) where
2424

2525
import Data.Map (Map)
26+
import Data.Kind (Type)
2627
import qualified Data.Map.Strict as Map
2728
#if __GLASGOW_HASKELL__ < 804
2829
import Data.Monoid
@@ -34,7 +35,7 @@ import Unsafe.Coerce
3435
-- instance of 'StateKey' can store and retrieve information from a
3536
-- 'StateStore'.
3637
--
37-
class Typeable f => StateKey (f :: * -> *) where
38+
class Typeable f => StateKey (f :: Type -> Type) where
3839
data State f
3940

4041
-- | We default this to typeOf1, but if f is itself a complex type that is

0 commit comments

Comments
 (0)