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
This commit is contained in:
Claude Heiland-Allen 2018-12-14 18:40:41 +00:00 committed by Erik de Castro Lopo
parent 49a4280a91
commit 8d5ef502be
15 changed files with 39 additions and 0 deletions

View File

@ -57,6 +57,7 @@ library
if impl(ghc < 8.0) if impl(ghc < 8.0)
ghc-options: -fno-warn-incomplete-patterns ghc-options: -fno-warn-incomplete-patterns
cpp-options: -DType=*
if impl(ghc >= 8.6) if impl(ghc >= 8.6)
default-extensions: NoStarIsType default-extensions: NoStarIsType

View File

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-} {-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-} {-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeOperators #-} {-# LANGUAGE TypeOperators #-}
@ -41,7 +42,9 @@ import Control.Monad.Random ( MonadRandom )
import Data.List ( foldl' ) import Data.List ( foldl' )
#if MIN_VERSION_base(4,9,0)
import Data.Kind (Type) import Data.Kind (Type)
#endif
import Grenade.Core.Shape import Grenade.Core.Shape
import Grenade.Core.LearningParameters import Grenade.Core.LearningParameters

View File

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-} {-# LANGUAGE DataKinds #-}
{-# LANGUAGE BangPatterns #-} {-# LANGUAGE BangPatterns #-}
{-# LANGUAGE GADTs #-} {-# LANGUAGE GADTs #-}
@ -36,7 +37,9 @@ import Data.Singletons
import Data.Singletons.Prelude import Data.Singletons.Prelude
import Data.Serialize import Data.Serialize
#if MIN_VERSION_base(4,9,0)
import Data.Kind (Type) import Data.Kind (Type)
#endif
import Grenade.Core.Layer import Grenade.Core.Layer
import Grenade.Core.LearningParameters import Grenade.Core.LearningParameters

View File

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-} {-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-} {-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeOperators #-} {-# LANGUAGE TypeOperators #-}
@ -26,7 +27,10 @@ import Data.Serialize
import Data.Singletons import Data.Singletons
import GHC.TypeLits import GHC.TypeLits
#if MIN_VERSION_base(4,9,0)
import Data.Kind (Type) import Data.Kind (Type)
#endif
import Grenade.Core import Grenade.Core

View File

@ -36,7 +36,9 @@ import GHC.TypeLits hiding (natVal)
#else #else
import GHC.TypeLits import GHC.TypeLits
#endif #endif
#if MIN_VERSION_base(4,9,0)
import Data.Kind (Type) import Data.Kind (Type)
#endif
import Numeric.LinearAlgebra hiding ( uniformSample, konst ) import Numeric.LinearAlgebra hiding ( uniformSample, konst )
import qualified Numeric.LinearAlgebra as LA import qualified Numeric.LinearAlgebra as LA

View File

@ -28,7 +28,9 @@ import GHC.TypeLits hiding (natVal)
#else #else
import GHC.TypeLits import GHC.TypeLits
#endif #endif
#if MIN_VERSION_base(4,9,0)
import Data.Kind (Type) import Data.Kind (Type)
#endif
import Grenade.Core import Grenade.Core
import Grenade.Layers.Internal.Pad import Grenade.Layers.Internal.Pad

View File

@ -40,7 +40,9 @@ import GHC.TypeLits hiding (natVal)
#else #else
import GHC.TypeLits import GHC.TypeLits
#endif #endif
#if MIN_VERSION_base(4,9,0)
import Data.Kind (Type) import Data.Kind (Type)
#endif
import Numeric.LinearAlgebra hiding ( uniformSample, konst ) import Numeric.LinearAlgebra hiding ( uniformSample, konst )
import qualified Numeric.LinearAlgebra as LA import qualified Numeric.LinearAlgebra as LA

View File

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-} {-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-} {-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeOperators #-} {-# LANGUAGE TypeOperators #-}
@ -23,7 +24,9 @@ import Data.Serialize
import Data.Singletons import Data.Singletons
#if MIN_VERSION_base(4,9,0)
import Data.Kind (Type) import Data.Kind (Type)
#endif
import Grenade.Core import Grenade.Core

View File

@ -28,7 +28,9 @@ import GHC.TypeLits hiding (natVal)
#else #else
import GHC.TypeLits import GHC.TypeLits
#endif #endif
#if MIN_VERSION_base(4,9,0)
import Data.Kind (Type) import Data.Kind (Type)
#endif
import Grenade.Core import Grenade.Core
import Grenade.Layers.Internal.Pad import Grenade.Layers.Internal.Pad

View File

@ -29,7 +29,9 @@ import GHC.TypeLits hiding (natVal)
#else #else
import GHC.TypeLits import GHC.TypeLits
#endif #endif
#if MIN_VERSION_base(4,9,0)
import Data.Kind (Type) import Data.Kind (Type)
#endif
import Grenade.Core import Grenade.Core
import Grenade.Layers.Internal.Pooling import Grenade.Layers.Internal.Pooling

View File

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-} {-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE MultiParamTypeClasses #-}
@ -8,7 +9,9 @@ module Grenade.Recurrent.Core.Layer (
, RecurrentUpdateLayer (..) , RecurrentUpdateLayer (..)
) where ) where
#if MIN_VERSION_base(4,9,0)
import Data.Kind (Type) import Data.Kind (Type)
#endif
import Grenade.Core import Grenade.Core

View File

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-} {-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-} {-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeOperators #-} {-# LANGUAGE TypeOperators #-}
@ -32,7 +33,9 @@ import Data.Singletons ( SingI )
import Data.Singletons.Prelude ( Head, Last ) import Data.Singletons.Prelude ( Head, Last )
import Data.Serialize import Data.Serialize
#if MIN_VERSION_base(4,9,0)
import Data.Kind (Type) import Data.Kind (Type)
#endif
import Grenade.Core import Grenade.Core
import Grenade.Recurrent.Core.Layer import Grenade.Recurrent.Core.Layer

View File

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-} {-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-} {-# LANGUAGE GADTs #-}
{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE RecordWildCards #-}
@ -18,7 +19,9 @@ import Control.Monad.Random ( MonadRandom, getRandom )
import Data.Singletons.TypeLits import Data.Singletons.TypeLits
#if MIN_VERSION_base(4,9,0)
import Data.Kind (Type) import Data.Kind (Type)
#endif
import Numeric.LinearAlgebra.Static import Numeric.LinearAlgebra.Static

View File

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-} {-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-} {-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeOperators #-} {-# LANGUAGE TypeOperators #-}
@ -27,7 +28,9 @@ import Data.Serialize
import Data.Singletons import Data.Singletons
import GHC.TypeLits import GHC.TypeLits
#if MIN_VERSION_base(4,9,0)
import Data.Kind (Type) import Data.Kind (Type)
#endif
import Grenade.Core import Grenade.Core
import Grenade.Recurrent.Core import Grenade.Recurrent.Core

View File

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE BangPatterns #-} {-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-} {-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-} {-# LANGUAGE GADTs #-}
@ -23,7 +24,9 @@ import Data.Proxy
import Data.Serialize import Data.Serialize
import Data.Singletons.TypeLits import Data.Singletons.TypeLits
#if MIN_VERSION_base(4,9,0)
import Data.Kind (Type) import Data.Kind (Type)
#endif
import qualified Numeric.LinearAlgebra as LA import qualified Numeric.LinearAlgebra as LA
import Numeric.LinearAlgebra.Static import Numeric.LinearAlgebra.Static