From f312c4f24271ad933b3f99cd854ecef8d98e7126 Mon Sep 17 00:00:00 2001 From: Eric Mertens Date: Fri, 28 Aug 2015 15:52:59 -0700 Subject: [PATCH] Clear out new base-4.8 warnings --- src/Text/LLVM.hs | 10 +++++++++- src/Text/LLVM/AST.hs | 16 ++++++++++++---- src/Text/LLVM/Labels.hs | 11 ++++++++++- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/Text/LLVM.hs b/src/Text/LLVM.hs index 26c375d..8650e7c 100644 --- a/src/Text/LLVM.hs +++ b/src/Text/LLVM.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE RecursiveDo #-} {-# LANGUAGE TypeOperators #-} @@ -7,6 +8,10 @@ {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE TypeSynonymInstances #-} +#ifndef MIN_VERSION_base +#define MIN_VERSION_base(x,y,z) 1 +#endif + module Text.LLVM ( -- * LLVM Monad LLVM() @@ -103,7 +108,6 @@ module Text.LLVM ( import Text.LLVM.AST -import Control.Applicative ( Applicative ) import Control.Monad.Fix (MonadFix) import Data.Char (ord) import Data.Int (Int8,Int16,Int32,Int64) @@ -114,6 +118,10 @@ import qualified Data.Foldable as F import qualified Data.Sequence as Seq import qualified Data.Map.Strict as Map +#if !(MIN_VERSION_base(4,8,0)) +import Control.Applicative ( Applicative ) +#endif + -- Fresh Names ----------------------------------------------------------------- diff --git a/src/Text/LLVM/AST.hs b/src/Text/LLVM/AST.hs index 7eb202f..f4323fb 100644 --- a/src/Text/LLVM/AST.hs +++ b/src/Text/LLVM/AST.hs @@ -1,23 +1,31 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE ViewPatterns #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE RecordWildCards #-} +#ifndef MIN_VERSION_base +#define MIN_VERSION_base(x,y,z) 1 +#endif + module Text.LLVM.AST where -import Control.Applicative ((<$)) import Control.Monad (MonadPlus(mzero),(<=<),msum,guard,liftM,liftM3) import Data.Char (isAscii,isPrint,ord,toUpper) -import Data.Foldable (Foldable(foldMap)) import Data.Int (Int32) import Data.List (intersperse,genericIndex,genericLength,unfoldr) import Data.Maybe (fromMaybe) -import Data.Monoid (Monoid(..)) import Data.String (IsString(fromString)) -import Data.Traversable (Traversable(sequenceA)) import Numeric (showHex) import Text.PrettyPrint.HughesPJ +#if !(MIN_VERSION_base(4,8,0)) +import Control.Applicative ((<$)) +import Data.Foldable (Foldable(foldMap)) +import Data.Monoid (Monoid(..)) +import Data.Traversable (Traversable(sequenceA)) +#endif + commas :: [Doc] -> Doc commas = hsep . punctuate (char ',') diff --git a/src/Text/LLVM/Labels.hs b/src/Text/LLVM/Labels.hs index 1c7ecbd..86b13c9 100644 --- a/src/Text/LLVM/Labels.hs +++ b/src/Text/LLVM/Labels.hs @@ -1,10 +1,19 @@ +{-# LANGUAGE CPP #-} + +#ifndef MIN_VERSION_base +#define MIN_VERSION_base(x,y,z) 1 +#endif + module Text.LLVM.Labels where import Text.LLVM.AST -import Control.Applicative ((<$>),Applicative(..)) import qualified Data.Traversable as T +#if !(MIN_VERSION_base(4,8,0)) +import Control.Applicative ((<$>),Applicative(..)) +#endif + class Functor f => HasLabel f where -- | Given a function for resolving labels, where the presence of a symbol -- denotes a label in a different function, rename all labels in a function.