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)
ghc-options: -fno-warn-incomplete-patterns
cpp-options: -DType=*
if impl(ghc >= 8.6)
default-extensions: NoStarIsType

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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