mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-23 01:52:50 -06:00
Fixes for GHC 8.4.1 compatibility
* In GHC 8.4.1, the operator <> has become a method of the Semigroup class
and is exported from the Prelude. This is unfortunate, since <> is also
exported from the standard library module Text.PrettyPrint, so in any
module that defines a pretty printer, there is likely to be an ambiguity.
This affects ~18 modules in GF. Solution:
import Prelude hiding (<>)
This works also in older versions of GHC, since GHC does't complain if
you hide something that doesn't exists.
* In GHC 8.4.1, Semigroup has become a superclass of Monoid. This means
that anywhere you define an instance of the Monoid class you also have to
define an instance in the Semigroup class.
This affects Data.Binary.Builder in GF. Solution: conditionally define
a Semigroup instance if compiling with base>=4.11 (ghc>=8.4.1)
This commit is contained in:
@@ -3,7 +3,7 @@ module GF.Command.Commands (
|
|||||||
PGFEnv,HasPGFEnv(..),pgf,mos,pgfEnv,pgfCommands,
|
PGFEnv,HasPGFEnv(..),pgf,mos,pgfEnv,pgfCommands,
|
||||||
options,flags,
|
options,flags,
|
||||||
) where
|
) where
|
||||||
import Prelude hiding (putStrLn)
|
import Prelude hiding (putStrLn,(<>)) -- GHC 8.4.1 clash with Text.PrettyPrint
|
||||||
|
|
||||||
import PGF
|
import PGF
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ module GF.Command.Commands2 (
|
|||||||
PGFEnv,HasPGFEnv(..),pgf,concs,pgfEnv,emptyPGFEnv,pgfCommands,
|
PGFEnv,HasPGFEnv(..),pgf,concs,pgfEnv,emptyPGFEnv,pgfCommands,
|
||||||
options, flags,
|
options, flags,
|
||||||
) where
|
) where
|
||||||
import Prelude hiding (putStrLn)
|
import Prelude hiding (putStrLn,(<>)) -- GHC 8.4.1 clash with Text.PrettyPrint
|
||||||
|
|
||||||
import PGF2
|
import PGF2
|
||||||
import qualified PGF as H
|
import qualified PGF as H
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
module GF.Compile.CheckGrammar(checkModule) where
|
module GF.Compile.CheckGrammar(checkModule) where
|
||||||
|
import Prelude hiding ((<>)) -- GHC 8.4.1 clash with Text.PrettyPrint
|
||||||
|
|
||||||
import GF.Infra.Ident
|
import GF.Infra.Ident
|
||||||
import GF.Infra.Option
|
import GF.Infra.Option
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ module GF.Compile.Compute.ConcreteNew
|
|||||||
normalForm,
|
normalForm,
|
||||||
Value(..), Bind(..), Env, value2term, eval, vapply
|
Value(..), Bind(..), Env, value2term, eval, vapply
|
||||||
) where
|
) where
|
||||||
|
import Prelude hiding ((<>)) -- GHC 8.4.1 clash with Text.PrettyPrint
|
||||||
|
|
||||||
import GF.Grammar hiding (Env, VGen, VApp, VRecType)
|
import GF.Grammar hiding (Env, VGen, VApp, VRecType)
|
||||||
import GF.Grammar.Lookup(lookupResDefLoc,allParamValues)
|
import GF.Grammar.Lookup(lookupResDefLoc,allParamValues)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
{-# LANGUAGE PatternGuards #-}
|
{-# LANGUAGE PatternGuards #-}
|
||||||
module GF.Compile.TypeCheck.RConcrete( checkLType, inferLType, computeLType, ppType ) where
|
module GF.Compile.TypeCheck.RConcrete( checkLType, inferLType, computeLType, ppType ) where
|
||||||
|
import Prelude hiding ((<>)) -- GHC 8.4.1 clash with Text.PrettyPrint
|
||||||
|
|
||||||
import GF.Infra.CheckM
|
import GF.Infra.CheckM
|
||||||
import GF.Data.Operations
|
import GF.Data.Operations
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
-- | Parallel grammar compilation
|
-- | Parallel grammar compilation
|
||||||
module GF.CompileInParallel(parallelBatchCompile) where
|
module GF.CompileInParallel(parallelBatchCompile) where
|
||||||
import Prelude hiding (catch)
|
import Prelude hiding (catch,(<>)) -- GHC 8.4.1 clash with Text.PrettyPrint
|
||||||
import Control.Monad(join,ap,when,unless)
|
import Control.Monad(join,ap,when,unless)
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
import GF.Infra.Concurrency
|
import GF.Infra.Concurrency
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ module GF.Grammar.Printer
|
|||||||
, ppMeta
|
, ppMeta
|
||||||
, getAbs
|
, getAbs
|
||||||
) where
|
) where
|
||||||
|
import Prelude hiding ((<>)) -- GHC 8.4.1 clash with Text.PrettyPrint
|
||||||
|
|
||||||
import GF.Infra.Ident
|
import GF.Infra.Ident
|
||||||
import GF.Infra.Option
|
import GF.Infra.Option
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
-- | Abstract syntax and a pretty printer for a subset of Haskell
|
-- | Abstract syntax and a pretty printer for a subset of Haskell
|
||||||
{-# LANGUAGE DeriveFunctor #-}
|
{-# LANGUAGE DeriveFunctor #-}
|
||||||
module GF.Haskell where
|
module GF.Haskell where
|
||||||
|
import Prelude hiding ((<>)) -- GHC 8.4.1 clash with Text.PrettyPrint
|
||||||
import GF.Infra.Ident(Ident,identS)
|
import GF.Infra.Ident(Ident,identS)
|
||||||
import GF.Text.Pretty
|
import GF.Text.Pretty
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ module GF.Infra.CheckM
|
|||||||
checkIn, checkInModule, checkMap, checkMapRecover,
|
checkIn, checkInModule, checkMap, checkMapRecover,
|
||||||
parallelCheck, accumulateError, commitCheck,
|
parallelCheck, accumulateError, commitCheck,
|
||||||
) where
|
) where
|
||||||
|
import Prelude hiding ((<>)) -- GHC 8.4.1 clash with Text.PrettyPrint
|
||||||
|
|
||||||
import GF.Data.Operations
|
import GF.Data.Operations
|
||||||
--import GF.Infra.Ident
|
--import GF.Infra.Ident
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
-- | Source locations
|
-- | Source locations
|
||||||
module GF.Infra.Location where
|
module GF.Infra.Location where
|
||||||
|
import Prelude hiding ((<>)) -- GHC 8.4.1 clash with Text.PrettyPrint
|
||||||
import GF.Text.Pretty
|
import GF.Text.Pretty
|
||||||
|
|
||||||
-- ** Source locations
|
-- ** Source locations
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
module GF.Speech.GSL (gslPrinter) where
|
module GF.Speech.GSL (gslPrinter) where
|
||||||
|
import Prelude hiding ((<>)) -- GHC 8.4.1 clash with Text.PrettyPrint
|
||||||
|
|
||||||
--import GF.Data.Utilities
|
--import GF.Data.Utilities
|
||||||
import GF.Grammar.CFG
|
import GF.Grammar.CFG
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
module GF.Speech.JSGF (jsgfPrinter) where
|
module GF.Speech.JSGF (jsgfPrinter) where
|
||||||
|
import Prelude hiding ((<>)) -- GHC 8.4.1 clash with Text.PrettyPrint
|
||||||
|
|
||||||
--import GF.Data.Utilities
|
--import GF.Data.Utilities
|
||||||
import GF.Infra.Option
|
import GF.Infra.Option
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
module GF.Speech.SRGS_ABNF (srgsAbnfPrinter, srgsAbnfNonRecursivePrinter) where
|
module GF.Speech.SRGS_ABNF (srgsAbnfPrinter, srgsAbnfNonRecursivePrinter) where
|
||||||
|
import Prelude hiding ((<>)) -- GHC 8.4.1 clash with Text.PrettyPrint
|
||||||
|
|
||||||
--import GF.Data.Utilities
|
--import GF.Data.Utilities
|
||||||
import GF.Infra.Option
|
import GF.Infra.Option
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ module PGF2 (-- * PGF
|
|||||||
LiteralCallback,literalCallbacks
|
LiteralCallback,literalCallbacks
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Prelude hiding (fromEnum)
|
import Prelude hiding (fromEnum,(<>)) -- GHC 8.4.1 clash with Text.PrettyPrint
|
||||||
import Control.Exception(Exception,throwIO)
|
import Control.Exception(Exception,throwIO)
|
||||||
import Control.Monad(forM_)
|
import Control.Monad(forM_)
|
||||||
import System.IO.Unsafe(unsafePerformIO,unsafeInterleaveIO)
|
import System.IO.Unsafe(unsafePerformIO,unsafeInterleaveIO)
|
||||||
|
|||||||
@@ -100,6 +100,11 @@ newtype Builder = Builder {
|
|||||||
runBuilder :: (Buffer -> [S.ByteString]) -> Buffer -> [S.ByteString]
|
runBuilder :: (Buffer -> [S.ByteString]) -> Buffer -> [S.ByteString]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if MIN_VERSION_base(4,11,0)
|
||||||
|
instance Semigroup Builder where
|
||||||
|
(<>) = append
|
||||||
|
#endif
|
||||||
|
|
||||||
instance Monoid Builder where
|
instance Monoid Builder where
|
||||||
mempty = empty
|
mempty = empty
|
||||||
{-# INLINE mempty #-}
|
{-# INLINE mempty #-}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ module PGF.ByteCode(Literal(..),
|
|||||||
CodeLabel, Instr(..), IVal(..), TailInfo(..),
|
CodeLabel, Instr(..), IVal(..), TailInfo(..),
|
||||||
ppLit, ppCode, ppInstr
|
ppLit, ppCode, ppInstr
|
||||||
) where
|
) where
|
||||||
|
import Prelude hiding ((<>)) -- GHC 8.4.1 clash with Text.PrettyPrint
|
||||||
import PGF.CId
|
import PGF.CId
|
||||||
import Text.PrettyPrint
|
import Text.PrettyPrint
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
module PGF.Macros where
|
module PGF.Macros where
|
||||||
|
import Prelude hiding ((<>)) -- GHC 8.4.1 clash with Text.PrettyPrint
|
||||||
|
|
||||||
import PGF.CId
|
import PGF.CId
|
||||||
import PGF.Data
|
import PGF.Data
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
{-# LANGUAGE FlexibleContexts #-}
|
{-# LANGUAGE FlexibleContexts #-}
|
||||||
module PGF.Printer (ppPGF,ppCat,ppFId,ppFunId,ppSeqId,ppSeq,ppFun) where
|
module PGF.Printer (ppPGF,ppCat,ppFId,ppFunId,ppSeqId,ppSeq,ppFun) where
|
||||||
|
import Prelude hiding ((<>)) -- GHC 8.4.1 clash with Text.PrettyPrint
|
||||||
|
|
||||||
import PGF.CId
|
import PGF.CId
|
||||||
import PGF.Data
|
import PGF.Data
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ module PGF.VisualizeTree
|
|||||||
, gizaAlignment
|
, gizaAlignment
|
||||||
, conlls2latexDoc
|
, conlls2latexDoc
|
||||||
) where
|
) where
|
||||||
|
import Prelude hiding ((<>)) -- GHC 8.4.1 clash with Text.PrettyPrint
|
||||||
|
|
||||||
import PGF.CId (wildCId,showCId,ppCId,mkCId) --CId,pCId,
|
import PGF.CId (wildCId,showCId,ppCId,mkCId) --CId,pCId,
|
||||||
import PGF.Data
|
import PGF.Data
|
||||||
|
|||||||
Reference in New Issue
Block a user