From 820d2d503fde7b29634262fd07db2a4744cf813d Mon Sep 17 00:00:00 2001 From: Thomas Hallgren Date: Wed, 18 Apr 2018 19:18:10 +0200 Subject: 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) --- src/compiler/GF/Compile/CheckGrammar.hs | 1 + src/compiler/GF/Compile/Compute/ConcreteNew.hs | 1 + src/compiler/GF/Compile/TypeCheck/RConcrete.hs | 1 + 3 files changed, 3 insertions(+) (limited to 'src/compiler/GF/Compile') diff --git a/src/compiler/GF/Compile/CheckGrammar.hs b/src/compiler/GF/Compile/CheckGrammar.hs index 5c1743b74..1348d8e41 100644 --- a/src/compiler/GF/Compile/CheckGrammar.hs +++ b/src/compiler/GF/Compile/CheckGrammar.hs @@ -21,6 +21,7 @@ ----------------------------------------------------------------------------- module GF.Compile.CheckGrammar(checkModule) where +import Prelude hiding ((<>)) -- GHC 8.4.1 clash with Text.PrettyPrint import GF.Infra.Ident import GF.Infra.Option diff --git a/src/compiler/GF/Compile/Compute/ConcreteNew.hs b/src/compiler/GF/Compile/Compute/ConcreteNew.hs index a77da88bf..f9edc931c 100644 --- a/src/compiler/GF/Compile/Compute/ConcreteNew.hs +++ b/src/compiler/GF/Compile/Compute/ConcreteNew.hs @@ -5,6 +5,7 @@ module GF.Compile.Compute.ConcreteNew normalForm, Value(..), Bind(..), Env, value2term, eval, vapply ) where +import Prelude hiding ((<>)) -- GHC 8.4.1 clash with Text.PrettyPrint import GF.Grammar hiding (Env, VGen, VApp, VRecType) import GF.Grammar.Lookup(lookupResDefLoc,allParamValues) diff --git a/src/compiler/GF/Compile/TypeCheck/RConcrete.hs b/src/compiler/GF/Compile/TypeCheck/RConcrete.hs index 2fe08b256..88e324ff3 100644 --- a/src/compiler/GF/Compile/TypeCheck/RConcrete.hs +++ b/src/compiler/GF/Compile/TypeCheck/RConcrete.hs @@ -1,5 +1,6 @@ {-# LANGUAGE PatternGuards #-} 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.Data.Operations -- cgit v1.2.3