support GHC 7.10
- no `Data.Kind` module in this old GHC, so use CPP for conditional include
- also use CPP to define `Type=*` for backward compatibility
commit8d5ef502be1d7141105afd4c9f667e875204fe55
authorClaude Heiland-Allen <claude@mathr.co.uk>
dateFri 14 Dec 2018, 18:40 (8 years ago)
parent49a4280
grenade.cabal+1
@@ -57,6 +57,7 @@ library
5757
5858 if impl(ghc < 8.0)
5959 ghc-options: -fno-warn-incomplete-patterns
60+ cpp-options: -DType=*
6061
6162 if impl(ghc >= 8.6)
6263 default-extensions: NoStarIsType
src/Grenade/Core/Layer.hs+3
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
12{-# LANGUAGE DataKinds #-}
23{-# LANGUAGE GADTs #-}
34{-# LANGUAGE TypeOperators #-}
@@ -41,7 +42,9 @@ import Control.Monad.Random ( MonadRandom )
4142
4243import Data.List ( foldl' )
4344
45+#if MIN_VERSION_base(4,9,0)
4446import Data.Kind (Type)
47+#endif
4548
4649import Grenade.Core.Shape
4750import Grenade.Core.LearningParameters
src/Grenade/Core/Network.hs+3
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
12{-# LANGUAGE DataKinds #-}
23{-# LANGUAGE BangPatterns #-}
34{-# LANGUAGE GADTs #-}
@@ -36,7 +37,9 @@ import Data.Singletons
3637import Data.Singletons.Prelude
3738import Data.Serialize
3839
40+#if MIN_VERSION_base(4,9,0)
3941import Data.Kind (Type)
42+#endif
4043
4144import Grenade.Core.Layer
4245import Grenade.Core.LearningParameters
src/Grenade/Layers/Concat.hs+4
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
12{-# LANGUAGE DataKinds #-}
23{-# LANGUAGE GADTs #-}
34{-# LANGUAGE TypeOperators #-}
@@ -26,7 +27,10 @@ import Data.Serialize
2627
2728import Data.Singletons
2829import GHC.TypeLits
30+
31+#if MIN_VERSION_base(4,9,0)
2932import Data.Kind (Type)
33+#endif
3034
3135import Grenade.Core
3236
src/Grenade/Layers/Convolution.hs+2
@@ -36,7 +36,9 @@ import GHC.TypeLits hiding (natVal)
3636#else
3737import GHC.TypeLits
3838#endif
39+#if MIN_VERSION_base(4,9,0)
3940import Data.Kind (Type)
41+#endif
4042
4143import Numeric.LinearAlgebra hiding ( uniformSample, konst )
4244import qualified Numeric.LinearAlgebra as LA
src/Grenade/Layers/Crop.hs+2
@@ -28,7 +28,9 @@ import GHC.TypeLits hiding (natVal)
2828#else
2929import GHC.TypeLits
3030#endif
31+#if MIN_VERSION_base(4,9,0)
3132import Data.Kind (Type)
33+#endif
3234
3335import Grenade.Core
3436import Grenade.Layers.Internal.Pad
src/Grenade/Layers/Deconvolution.hs+2
@@ -40,7 +40,9 @@ import GHC.TypeLits hiding (natVal)
4040#else
4141import GHC.TypeLits
4242#endif
43+#if MIN_VERSION_base(4,9,0)
4344import Data.Kind (Type)
45+#endif
4446
4547import Numeric.LinearAlgebra hiding ( uniformSample, konst )
4648import qualified Numeric.LinearAlgebra as LA
src/Grenade/Layers/Merge.hs+3
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
12{-# LANGUAGE DataKinds #-}
23{-# LANGUAGE GADTs #-}
34{-# LANGUAGE TypeOperators #-}
@@ -23,7 +24,9 @@ import Data.Serialize
2324
2425import Data.Singletons
2526
27+#if MIN_VERSION_base(4,9,0)
2628import Data.Kind (Type)
29+#endif
2730
2831import Grenade.Core
2932
src/Grenade/Layers/Pad.hs+2
@@ -28,7 +28,9 @@ import GHC.TypeLits hiding (natVal)
2828#else
2929import GHC.TypeLits
3030#endif
31+#if MIN_VERSION_base(4,9,0)
3132import Data.Kind (Type)
33+#endif
3234
3335import Grenade.Core
3436import Grenade.Layers.Internal.Pad
src/Grenade/Layers/Pooling.hs+2
@@ -29,7 +29,9 @@ import GHC.TypeLits hiding (natVal)
2929#else
3030import GHC.TypeLits
3131#endif
32+#if MIN_VERSION_base(4,9,0)
3233import Data.Kind (Type)
34+#endif
3335
3436import Grenade.Core
3537import Grenade.Layers.Internal.Pooling
src/Grenade/Recurrent/Core/Layer.hs+3
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
12{-# LANGUAGE DataKinds #-}
23{-# LANGUAGE TypeFamilies #-}
34{-# LANGUAGE MultiParamTypeClasses #-}
@@ -8,7 +9,9 @@ module Grenade.Recurrent.Core.Layer (
89 , RecurrentUpdateLayer (..)
910 ) where
1011
12+#if MIN_VERSION_base(4,9,0)
1113import Data.Kind (Type)
14+#endif
1215
1316import Grenade.Core
1417
src/Grenade/Recurrent/Core/Network.hs+3
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
12{-# LANGUAGE DataKinds #-}
23{-# LANGUAGE GADTs #-}
34{-# LANGUAGE TypeOperators #-}
@@ -32,7 +33,9 @@ import Data.Singletons ( SingI )
3233import Data.Singletons.Prelude ( Head, Last )
3334import Data.Serialize
3435
36+#if MIN_VERSION_base(4,9,0)
3537import Data.Kind (Type)
38+#endif
3639
3740import Grenade.Core
3841import Grenade.Recurrent.Core.Layer
src/Grenade/Recurrent/Layers/BasicRecurrent.hs+3
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
12{-# LANGUAGE DataKinds #-}
23{-# LANGUAGE GADTs #-}
34{-# LANGUAGE RecordWildCards #-}
@@ -18,7 +19,9 @@ import Control.Monad.Random ( MonadRandom, getRandom )
1819
1920import Data.Singletons.TypeLits
2021
22+#if MIN_VERSION_base(4,9,0)
2123import Data.Kind (Type)
24+#endif
2225
2326import Numeric.LinearAlgebra.Static
2427
src/Grenade/Recurrent/Layers/ConcatRecurrent.hs+3
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
12{-# LANGUAGE DataKinds #-}
23{-# LANGUAGE GADTs #-}
34{-# LANGUAGE TypeOperators #-}
@@ -27,7 +28,9 @@ import Data.Serialize
2728import Data.Singletons
2829import GHC.TypeLits
2930
31+#if MIN_VERSION_base(4,9,0)
3032import Data.Kind (Type)
33+#endif
3134
3235import Grenade.Core
3336import Grenade.Recurrent.Core
src/Grenade/Recurrent/Layers/LSTM.hs+3
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
12{-# LANGUAGE BangPatterns #-}
23{-# LANGUAGE DataKinds #-}
34{-# LANGUAGE GADTs #-}
@@ -23,7 +24,9 @@ import Data.Proxy
2324import Data.Serialize
2425import Data.Singletons.TypeLits
2526
27+#if MIN_VERSION_base(4,9,0)
2628import Data.Kind (Type)
29+#endif
2730
2831import qualified Numeric.LinearAlgebra as LA
2932import Numeric.LinearAlgebra.Static