git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #1411 from erdeszt/fix-warnings

Fix warnings and enable -Werror

commit59ba87fc87feb4a02b1682aa480d3a09db022e3b authorPhil Freeman <paf31@cantab.net> dateSun 23 Aug 2015, 14:46 (11 years ago) parent031e5c5e7d5d60
51 files changed+211−27
psci/Completion.hs+6 psci/PSCi.hs+3 psci/Parser.hs+4 psci/tests/Main.hs+2−1 purescript.cabal+7−7 src/Control/Monad/Supply.hs+3 src/Language/PureScript/AST/Declarations.hs+5−1 src/Language/PureScript/AST/SourcePos.hs+4−1 src/Language/PureScript/AST/Traversals.hs+8 src/Language/PureScript/Bundle.hs+3 src/Language/PureScript/CodeGen/JS.hs+3 src/Language/PureScript/CodeGen/JS/AST.hs+5 src/Language/PureScript/CodeGen/JS/Optimizer.hs+3 src/Language/PureScript/CodeGen/JS/Optimizer/Inliner.hs+4 src/Language/PureScript/Docs/ParseAndDesugar.hs+3 src/Language/PureScript/Docs/RenderedCode/Render.hs+5 src/Language/PureScript/Docs/RenderedCode/Types.hs+3 src/Language/PureScript/Docs/Types.hs+4−2 src/Language/PureScript/Errors.hs+7−1 src/Language/PureScript/Kinds.hs+3 src/Language/PureScript/Linter.hs+3 src/Language/PureScript/Linter/Exhaustive.hs+3 src/Language/PureScript/Make.hs+5 src/Language/PureScript/Names.hs+3−1 src/Language/PureScript/Parser/JS.hs+3 src/Language/PureScript/Parser/Kinds.hs+4 src/Language/PureScript/Pretty/JS.hs+4 src/Language/PureScript/Pretty/Values.hs+4 src/Language/PureScript/Publish.hs+3 src/Language/PureScript/Publish/ErrorsWarnings.hs+5 src/Language/PureScript/Renamer.hs+5−1 src/Language/PureScript/Sugar.hs+3 src/Language/PureScript/Sugar/BindingGroups.hs+3 src/Language/PureScript/Sugar/CaseDeclarations.hs+5−1 src/Language/PureScript/Sugar/DoNotation.hs+3 src/Language/PureScript/Sugar/Names.hs+3 src/Language/PureScript/Sugar/ObjectWildcards.hs+3 src/Language/PureScript/Sugar/Operators.hs+3 src/Language/PureScript/Sugar/TypeClasses.hs+3 src/Language/PureScript/Sugar/TypeClasses/Deriving.hs+3 src/Language/PureScript/Sugar/TypeDeclarations.hs+3 src/Language/PureScript/Traversals.hs+4 src/Language/PureScript/TypeChecker.hs+3 src/Language/PureScript/TypeChecker/Entailment.hs+3 src/Language/PureScript/TypeChecker/Kinds.hs+9−4 src/Language/PureScript/TypeChecker/Monad.hs+9−2 src/Language/PureScript/TypeChecker/Skolems.hs+4 src/Language/PureScript/TypeChecker/Synonyms.hs+6−1 src/Language/PureScript/TypeChecker/Types.hs+6−1 src/Language/PureScript/TypeChecker/Unify.hs+5−3 src/Language/PureScript/Types.hs+3
psci/Completion.hs+6
@@ -1,13 +1,19 @@
1+{-# LANGUAGE CPP #-}
2+
13module Completion where
24
35import Data.Maybe (mapMaybe)
46import Data.List (nub, nubBy, sortBy, isPrefixOf, stripPrefix)
57import Data.Char (isUpper)
68import Data.Function (on)
9+#if __GLASGOW_HASKELL__ < 710
710import Data.Traversable (traverse)
11+#endif
812
913import Control.Arrow (second)
14+#if __GLASGOW_HASKELL__ < 710
1015import Control.Applicative ((<$>), (<*>))
16+#endif
1117import Control.Monad.Trans.Reader (asks, runReaderT, ReaderT)
1218import Control.Monad.Trans.State.Strict
1319
psci/PSCi.hs+3
@@ -17,12 +17,15 @@
1717{-# LANGUAGE GeneralizedNewtypeDeriving #-}
1818{-# LANGUAGE RecordWildCards #-}
1919{-# LANGUAGE TupleSections #-}
20+{-# LANGUAGE CPP #-}
2021
2122module PSCi where
2223
2324import Data.Foldable (traverse_)
2425import Data.List (intercalate, nub, sort)
26+#if __GLASGOW_HASKELL__ < 710
2527import Data.Traversable (traverse)
28+#endif
2629import Data.Tuple (swap)
2730import Data.Version (showVersion)
2831import qualified Data.Map as M
psci/Parser.hs+4
@@ -13,6 +13,8 @@
1313--
1414-----------------------------------------------------------------------------
1515
16+{-# LANGUAGE CPP #-}
17+
1618module Parser
1719 ( parseCommand
1820 ) where
@@ -22,7 +24,9 @@ import Prelude hiding (lex)
2224import Data.Char (isSpace)
2325import Data.List (intercalate)
2426
27+#if __GLASGOW_HASKELL__ < 710
2528import Control.Applicative hiding (many)
29+#endif
2630
2731import Text.Parsec hiding ((<|>))
2832
psci/tests/Main.hs+2−1
@@ -1,4 +1,5 @@
1−{-# LANGUAGE RecordWildCards, TupleSections #-}
1+{-# LANGUAGE RecordWildCards #-}
2+{-# LANGUAGE TupleSections #-}
23
34module Main where
45
purescript.cabal+7−7
@@ -162,7 +162,7 @@ library
162162 buildable: True
163163 hs-source-dirs: src
164164 other-modules: Paths_purescript
165− ghc-options: -Wall -O2
165+ ghc-options: -Wall -Werror -O2
166166
167167executable psc
168168 build-depends: base >=4 && <5, containers -any, directory -any, filepath -any,
@@ -171,7 +171,7 @@ executable psc
171171 main-is: Main.hs
172172 buildable: True
173173 hs-source-dirs: psc
174− ghc-options: -Wall -O2 -fno-warn-unused-do-bind
174+ ghc-options: -Wall -Werror -O2 -fno-warn-unused-do-bind
175175
176176executable psci
177177 build-depends: base >=4 && <5, containers -any, directory -any, filepath -any,
@@ -188,7 +188,7 @@ executable psci
188188 Completion
189189 PSCi
190190 IO
191− ghc-options: -Wall -O2
191+ ghc-options: -Wall -Werror -O2
192192
193193executable psc-docs
194194 build-depends: base >=4 && <5, purescript -any,
@@ -201,14 +201,14 @@ executable psc-docs
201201 other-modules: Ctags
202202 Etags
203203 Tags
204− ghc-options: -Wall -O2
204+ ghc-options: -Wall -Werror -O2
205205
206206executable psc-publish
207207 build-depends: base >=4 && <5, purescript -any, bytestring -any, aeson -any, optparse-applicative -any
208208 main-is: Main.hs
209209 buildable: True
210210 hs-source-dirs: psc-publish
211− ghc-options: -Wall -O2
211+ ghc-options: -Wall -Werror -O2
212212
213213executable psc-hierarchy
214214 build-depends: base >=4 && <5, purescript -any, optparse-applicative >= 0.10.0,
@@ -218,7 +218,7 @@ executable psc-hierarchy
218218 buildable: True
219219 hs-source-dirs: hierarchy
220220 other-modules:
221− ghc-options: -Wall -O2
221+ ghc-options: -Wall -Werror -O2
222222
223223executable psc-bundle
224224 main-is: Main.hs
@@ -233,7 +233,7 @@ executable psc-bundle
233233 transformers-compat -any,
234234 optparse-applicative >= 0.10.0,
235235 Glob -any
236− ghc-options: -Wall -O2
236+ ghc-options: -Wall -Werror -O2
237237 hs-source-dirs: psc-bundle
238238
239239test-suite tests
src/Control/Monad/Supply.hs+3
@@ -14,12 +14,15 @@
1414-----------------------------------------------------------------------------
1515
1616{-# LANGUAGE GeneralizedNewtypeDeriving #-}
17+{-# LANGUAGE CPP #-}
1718
1819module Control.Monad.Supply where
1920
2021import Data.Functor.Identity
2122
23+#if __GLASGOW_HASKELL__ < 710
2224import Control.Applicative
25+#endif
2326import Control.Monad.State
2427import Control.Monad.Error.Class (MonadError(..))
2528import Control.Monad.Reader
src/Language/PureScript/AST/Declarations.hs+5−1
@@ -12,7 +12,9 @@
1212--
1313-----------------------------------------------------------------------------
1414
15−{-# LANGUAGE DeriveDataTypeable, ScopedTypeVariables #-}
15+{-# LANGUAGE DeriveDataTypeable #-}
16+{-# LANGUAGE ScopedTypeVariables #-}
17+{-# LANGUAGE CPP #-}
1618
1719module Language.PureScript.AST.Declarations where
1820
@@ -21,7 +23,9 @@ import qualified Data.Map as M
2123
2224import Control.Monad.Identity
2325
26+#if __GLASGOW_HASKELL__ < 710
2427import Control.Applicative
28+#endif
2529
2630import Language.PureScript.AST.Binders
2731import Language.PureScript.AST.Operators
src/Language/PureScript/AST/SourcePos.hs+4−1
@@ -12,7 +12,10 @@
1212--
1313-----------------------------------------------------------------------------
1414
15−{-# LANGUAGE DeriveDataTypeable, ScopedTypeVariables, RecordWildCards, OverloadedStrings #-}
15+{-# LANGUAGE DeriveDataTypeable #-}
16+{-# LANGUAGE ScopedTypeVariables #-}
17+{-# LANGUAGE RecordWildCards #-}
18+{-# LANGUAGE OverloadedStrings #-}
1619
1720module Language.PureScript.AST.SourcePos where
1821
src/Language/PureScript/AST/Traversals.hs+8
@@ -12,13 +12,21 @@
1212--
1313-----------------------------------------------------------------------------
1414
15+{-# LANGUAGE CPP #-}
16+
1517module Language.PureScript.AST.Traversals where
1618
19+#if __GLASGOW_HASKELL__ < 710
1720import Data.Monoid (Monoid(..), mconcat)
21+#endif
1822import Data.Maybe (mapMaybe)
23+#if __GLASGOW_HASKELL__ < 710
1924import Data.Traversable (traverse)
25+#endif
2026
27+#if __GLASGOW_HASKELL__ < 710
2128import Control.Applicative
29+#endif
2230import Control.Monad
2331import Control.Arrow ((***), (+++), second)
2432
src/Language/PureScript/Bundle.hs+3
@@ -20,6 +20,7 @@
2020{-# LANGUAGE ScopedTypeVariables #-}
2121{-# LANGUAGE TupleSections #-}
2222{-# LANGUAGE RecordWildCards #-}
23+{-# LANGUAGE CPP #-}
2324
2425module Language.PureScript.Bundle (
2526 bundle
@@ -38,7 +39,9 @@ import Data.Version (showVersion)
3839
3940import qualified Data.Set as S
4041
42+#if __GLASGOW_HASKELL__ < 710
4143import Control.Applicative
44+#endif
4245import Control.Monad
4346import Control.Monad.Error.Class
4447import Language.JavaScript.Parser
src/Language/PureScript/CodeGen/JS.hs+3
@@ -17,6 +17,7 @@
1717{-# LANGUAGE ViewPatterns #-}
1818{-# LANGUAGE FlexibleContexts #-}
1919{-# LANGUAGE ScopedTypeVariables #-}
20+{-# LANGUAGE CPP #-}
2021
2122module Language.PureScript.CodeGen.JS
2223 ( module AST
@@ -28,7 +29,9 @@ module Language.PureScript.CodeGen.JS
2829import Data.List ((\\), delete, intersect)
2930import qualified Data.Traversable as T (traverse)
3031
32+#if __GLASGOW_HASKELL__ < 710
3133import Control.Applicative
34+#endif
3235import Control.Arrow ((&&&))
3336import Control.Monad (replicateM, forM)
3437import Control.Monad.Reader (MonadReader, asks)
src/Language/PureScript/CodeGen/JS/AST.hs+5
@@ -14,13 +14,18 @@
1414-----------------------------------------------------------------------------
1515
1616{-# LANGUAGE DeriveDataTypeable #-}
17+{-# LANGUAGE CPP #-}
1718
1819module Language.PureScript.CodeGen.JS.AST where
1920
21+#if __GLASGOW_HASKELL__ < 710
2022import Control.Applicative (Applicative, (<$>), (<*>))
23+#endif
2124import Control.Monad.Identity
2225import Data.Data
26+#if __GLASGOW_HASKELL__ < 710
2327import Data.Traversable (traverse)
28+#endif
2429
2530import Language.PureScript.Comments
2631import Language.PureScript.Traversals
src/Language/PureScript/CodeGen/JS/Optimizer.hs+3
@@ -32,12 +32,15 @@
3232-----------------------------------------------------------------------------
3333
3434{-# LANGUAGE FlexibleContexts #-}
35+{-# LANGUAGE CPP #-}
3536
3637module Language.PureScript.CodeGen.JS.Optimizer (
3738 optimize
3839) where
3940
41+#if __GLASGOW_HASKELL__ < 710
4042import Control.Applicative (Applicative)
43+#endif
4144import Control.Monad.Reader (MonadReader, ask, asks)
4245import Control.Monad.Supply.Class (MonadSupply)
4346
src/Language/PureScript/CodeGen/JS/Optimizer/Inliner.hs+4
@@ -13,6 +13,8 @@
1313--
1414-----------------------------------------------------------------------------
1515
16+{-# LANGUAGE CPP #-}
17+
1618module Language.PureScript.CodeGen.JS.Optimizer.Inliner (
1719 inlineVariables,
1820 inlineValues,
@@ -24,7 +26,9 @@ module Language.PureScript.CodeGen.JS.Optimizer.Inliner (
2426 evaluateIifes
2527) where
2628
29+#if __GLASGOW_HASKELL__ < 710
2730import Control.Applicative (Applicative)
31+#endif
2832import Control.Monad.Supply.Class (MonadSupply, freshName)
2933import Data.Maybe (fromMaybe)
3034
src/Language/PureScript/Docs/ParseAndDesugar.hs+3
@@ -1,4 +1,5 @@
11{-# LANGUAGE TupleSections #-}
2+{-# LANGUAGE CPP #-}
23
34module Language.PureScript.Docs.ParseAndDesugar
45 ( parseAndDesugar
@@ -8,7 +9,9 @@ module Language.PureScript.Docs.ParseAndDesugar
89import qualified Data.Map as M
910import Control.Arrow (first)
1011import Control.Monad
12+#if __GLASGOW_HASKELL__ < 710
1113import Control.Applicative
14+#endif
1215
1316import Control.Monad.Trans.Except
1417import Control.Monad.Writer.Strict (runWriterT)
src/Language/PureScript/Docs/RenderedCode/Render.hs+5
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
12
23-- | Functions for producing RenderedCode values from PureScript Type values.
34
@@ -11,7 +12,11 @@ module Language.PureScript.Docs.RenderedCode.Render (
1112 renderTypeWithOptions
1213) where
1314
15+#if __GLASGOW_HASKELL__ < 710
1416import Data.Monoid ((<>), mconcat, mempty)
17+#else
18+import Data.Monoid ((<>))
19+#endif
1520import Data.Maybe (fromMaybe)
1621
1722import Control.Arrow ((<+>))
src/Language/PureScript/Docs/RenderedCode/Types.hs+3
@@ -1,5 +1,6 @@
11{-# LANGUAGE GeneralizedNewtypeDeriving #-}
22{-# LANGUAGE OverloadedStrings #-}
3+{-# LANGUAGE CPP #-}
34
45-- | Data types and functions for representing a simplified form of PureScript
56-- code, intended for use in e.g. HTML documentation.
@@ -30,9 +31,11 @@ module Language.PureScript.Docs.RenderedCode.Types
3031 , keywordWhere
3132 ) where
3233
34+#if __GLASGOW_HASKELL__ < 710
3335import Control.Applicative ((<$>), (<*>), (*>), pure)
3436import Data.Foldable
3537import Data.Monoid
38+#endif
3639import qualified Data.Aeson as A
3740import Data.Aeson.BetterErrors
3841import Control.Monad.Error.Class (MonadError(..))
src/Language/PureScript/Docs/Types.hs+4−2
@@ -2,6 +2,7 @@
22{-# LANGUAGE OverloadedStrings #-}
33{-# LANGUAGE TupleSections #-}
44{-# LANGUAGE RankNTypes #-}
5+{-# LANGUAGE CPP #-}
56
67module Language.PureScript.Docs.Types
78 ( module Language.PureScript.Docs.Types
@@ -10,9 +11,10 @@ module Language.PureScript.Docs.Types
1011 where
1112
1213import Control.Arrow (first, (***))
13−import Control.Applicative ((<$>), (<*>), pure)
14+#if __GLASGOW_HASKELL__ < 710
15+import Control.Applicative ((<$>), (<$), (<*>), pure)
16+#endif
1417import Control.Monad (when)
15−import Data.Functor ((<$))
1618import Data.Maybe (mapMaybe)
1719import Data.Version
1820import Data.Aeson ((.=))
src/Language/PureScript/Errors.hs+7−1
@@ -15,14 +15,18 @@
1515{-# LANGUAGE GeneralizedNewtypeDeriving #-}
1616{-# LANGUAGE FlexibleContexts #-}
1717{-# LANGUAGE MultiParamTypeClasses #-}
18+{-# LANGUAGE CPP #-}
1819
1920module Language.PureScript.Errors where
2021
2122import Data.Either (lefts, rights)
2223import Data.List (intercalate, transpose)
2324import Data.Function (on)
24−import Data.Monoid
25+#if __GLASGOW_HASKELL__ < 710
2526import Data.Foldable (fold, foldMap)
27+#else
28+import Data.Foldable (fold)
29+#endif
2630
2731import qualified Data.Map as M
2832
@@ -30,7 +34,9 @@ import Control.Monad
3034import Control.Monad.Unify
3135import Control.Monad.Writer
3236import Control.Monad.Error.Class (MonadError(..))
37+#if __GLASGOW_HASKELL__ < 710
3338import Control.Applicative ((<$>), (<*>), Applicative, pure)
39+#endif
3440import Control.Monad.Trans.State.Lazy
3541import Control.Arrow(first)
3642
src/Language/PureScript/Kinds.hs+3
@@ -14,13 +14,16 @@
1414
1515{-# LANGUAGE DeriveDataTypeable #-}
1616{-# LANGUAGE TemplateHaskell #-}
17+{-# LANGUAGE CPP #-}
1718
1819module Language.PureScript.Kinds where
1920
2021import Data.Data
2122import qualified Data.Aeson.TH as A
2223
24+#if __GLASGOW_HASKELL__ < 710
2325import Control.Applicative
26+#endif
2427import Control.Monad.Unify (Unknown)
2528
2629-- |
src/Language/PureScript/Linter.hs+3
@@ -15,6 +15,7 @@
1515{-# LANGUAGE GeneralizedNewtypeDeriving #-}
1616{-# LANGUAGE FlexibleContexts #-}
1717{-# LANGUAGE ScopedTypeVariables #-}
18+{-# LANGUAGE CPP #-}
1819
1920module Language.PureScript.Linter (lint, module L) where
2021
@@ -24,7 +25,9 @@ import Data.Monoid
2425
2526import qualified Data.Set as S
2627
28+#if __GLASGOW_HASKELL__ < 710
2729import Control.Applicative
30+#endif
2831import Control.Monad.Writer.Class
2932
3033import Language.PureScript.AST
src/Language/PureScript/Linter/Exhaustive.hs+3
@@ -18,6 +18,7 @@
1818
1919{-# LANGUAGE FlexibleContexts #-}
2020{-# LANGUAGE ScopedTypeVariables #-}
21+{-# LANGUAGE CPP #-}
2122
2223module Language.PureScript.Linter.Exhaustive
2324 ( checkExhaustive
@@ -237,8 +238,10 @@ checkExhaustive env mn numArgs cas = makeResult . first nub $ foldl' step ([init
237238 cond = or <$> sequenceA pr
238239 in (concat missed, (liftA2 (&&) cond nec,
239240 if fromMaybe True cond then redundant else caseAlternativeBinders ca : redundant))
241+#if __GLASGOW_HASKELL__ < 710
240242 where
241243 sequenceA = foldr (liftA2 (:)) (pure [])
244+#endif
242245
243246 makeResult :: ([[Binder]], (Maybe Bool, [[Binder]])) -> m ()
244247 makeResult (bss, (_, bss')) =
src/Language/PureScript/Make.hs+5
@@ -19,6 +19,7 @@
1919{-# LANGUAGE RankNTypes #-}
2020{-# LANGUAGE RecordWildCards #-}
2121{-# LANGUAGE ScopedTypeVariables #-}
22+{-# LANGUAGE CPP #-}
2223
2324module Language.PureScript.Make
2425 (
@@ -35,7 +36,9 @@ module Language.PureScript.Make
3536 , buildMakeActions
3637 ) where
3738
39+#if __GLASGOW_HASKELL__ < 710
3840import Control.Applicative
41+#endif
3942import Control.Arrow ((&&&))
4043import Control.Monad
4144import Control.Monad.Error.Class (MonadError(..))
@@ -49,7 +52,9 @@ import Data.List (sortBy, groupBy)
4952import Data.Maybe (fromMaybe)
5053import Data.Time.Clock
5154import Data.Foldable (for_)
55+#if __GLASGOW_HASKELL__ < 710
5256import Data.Traversable (traverse)
57+#endif
5358import Data.Version (showVersion)
5459import qualified Data.Map as M
5560import qualified Data.Set as S
src/Language/PureScript/Names.hs+3−1
@@ -13,7 +13,9 @@
1313--
1414-----------------------------------------------------------------------------
1515
16−{-# LANGUAGE DeriveDataTypeable, DeriveFunctor, GADTs #-}
16+{-# LANGUAGE DeriveDataTypeable #-}
17+{-# LANGUAGE DeriveFunctor #-}
18+{-# LANGUAGE GADTs #-}
1719
1820module Language.PureScript.Names where
1921
src/Language/PureScript/Parser/JS.hs+3
@@ -13,13 +13,16 @@
1313-----------------------------------------------------------------------------
1414
1515{-# LANGUAGE FlexibleContexts #-}
16+{-# LANGUAGE CPP #-}
1617
1718module Language.PureScript.Parser.JS
1819 ( ForeignJS()
1920 , parseForeignModulesFromFiles
2021 ) where
2122
23+#if __GLASGOW_HASKELL__ < 710
2224import Control.Applicative ((*>), (<*))
25+#endif
2326import Control.Monad (forM_, when, msum)
2427import Control.Monad.Error.Class (MonadError(..))
2528import Control.Monad.Writer.Class (MonadWriter(..))
src/Language/PureScript/Parser/Kinds.hs+4
@@ -13,6 +13,8 @@
1313--
1414-----------------------------------------------------------------------------
1515
16+{-# LANGUAGE CPP #-}
17+
1618module Language.PureScript.Parser.Kinds (
1719 parseKind
1820) where
@@ -20,7 +22,9 @@ module Language.PureScript.Parser.Kinds (
2022import Language.PureScript.Kinds
2123import Language.PureScript.Parser.Common
2224import Language.PureScript.Parser.Lexer
25+#if __GLASGOW_HASKELL__ < 710
2326import Control.Applicative
27+#endif
2428import qualified Text.Parsec as P
2529import qualified Text.Parsec.Expr as P
2630
src/Language/PureScript/Pretty/JS.hs+4
@@ -13,6 +13,8 @@
1313--
1414-----------------------------------------------------------------------------
1515
16+{-# LANGUAGE CPP #-}
17+
1618module Language.PureScript.Pretty.JS (
1719 prettyPrintJS
1820) where
@@ -20,7 +22,9 @@ module Language.PureScript.Pretty.JS (
2022import Data.List
2123import Data.Maybe (fromMaybe)
2224
25+#if __GLASGOW_HASKELL__ < 710
2326import Control.Applicative
27+#endif
2428import Control.Arrow ((<+>))
2529import Control.Monad.State
2630import Control.PatternArrows
src/Language/PureScript/Pretty/Values.hs+4
@@ -13,6 +13,8 @@
1313--
1414-----------------------------------------------------------------------------
1515
16+{-# LANGUAGE CPP #-}
17+
1618module Language.PureScript.Pretty.Values (
1719 prettyPrintValue,
1820 prettyPrintBinder,
@@ -25,7 +27,9 @@ import Data.List (intercalate)
2527import Control.Arrow ((<+>), runKleisli, second)
2628import Control.PatternArrows
2729import Control.Monad.State
30+#if __GLASGOW_HASKELL__ < 710
2831import Control.Applicative
32+#endif
2933
3034import Language.PureScript.AST
3135import Language.PureScript.Names
src/Language/PureScript/Publish.hs+3
@@ -2,6 +2,7 @@
22{-# LANGUAGE RecordWildCards #-}
33{-# LANGUAGE TupleSections #-}
44{-# LANGUAGE GeneralizedNewtypeDeriving #-}
5+{-# LANGUAGE CPP #-}
56
67module Language.PureScript.Publish
78 ( preparePackage
@@ -32,7 +33,9 @@ import Safe (headMay)
3233import Data.Aeson.BetterErrors
3334import qualified Data.Text as T
3435
36+#if __GLASGOW_HASKELL__ < 710
3537import Control.Applicative
38+#endif
3639import Control.Category ((>>>))
3740import Control.Arrow ((***))
3841import Control.Exception (catch, try)
src/Language/PureScript/Publish/ErrorsWarnings.hs+5
@@ -1,5 +1,6 @@
11{-# LANGUAGE OverloadedStrings #-}
22{-# LANGUAGE RecordWildCards #-}
3+{-# LANGUAGE CPP #-}
34
45module Language.PureScript.Publish.ErrorsWarnings
56 ( PackageError(..)
@@ -15,12 +16,16 @@ module Language.PureScript.Publish.ErrorsWarnings
1516 , renderWarnings
1617 ) where
1718
19+#if __GLASGOW_HASKELL__ < 710
1820import Control.Applicative ((<$>))
21+#endif
1922import Data.Aeson.BetterErrors
2023import Data.Version
2124import Data.Maybe
2225import Data.Monoid
26+#if __GLASGOW_HASKELL__ < 710
2327import Data.Foldable (foldMap)
28+#endif
2429import Data.List (intersperse, intercalate)
2530import Data.List.NonEmpty (NonEmpty(..))
2631import qualified Data.List.NonEmpty as NonEmpty
src/Language/PureScript/Renamer.hs+5−1
@@ -14,11 +14,15 @@
1414--
1515-----------------------------------------------------------------------------
1616
17−{-# LANGUAGE FlexibleContexts, ScopedTypeVariables #-}
17+{-# LANGUAGE FlexibleContexts #-}
18+{-# LANGUAGE ScopedTypeVariables #-}
19+{-# LANGUAGE CPP #-}
1820
1921module Language.PureScript.Renamer (renameInModules) where
2022
23+#if __GLASGOW_HASKELL__ < 710
2124import Control.Applicative
25+#endif
2226import Control.Monad.State
2327
2428import Data.List (find)
src/Language/PureScript/Sugar.hs+3
@@ -14,12 +14,15 @@
1414-----------------------------------------------------------------------------
1515
1616{-# LANGUAGE FlexibleContexts #-}
17+{-# LANGUAGE CPP #-}
1718
1819module Language.PureScript.Sugar (desugar, module S) where
1920
2021import Control.Monad
2122import Control.Category ((>>>))
23+#if __GLASGOW_HASKELL__ < 710
2224import Control.Applicative
25+#endif
2326import Control.Monad.Error.Class (MonadError())
2427import Control.Monad.Writer.Class (MonadWriter())
2528import Control.Monad.Supply.Class
src/Language/PureScript/Sugar/BindingGroups.hs+3
@@ -15,6 +15,7 @@
1515-----------------------------------------------------------------------------
1616
1717{-# LANGUAGE FlexibleContexts #-}
18+{-# LANGUAGE CPP #-}
1819
1920module Language.PureScript.Sugar.BindingGroups (
2021 createBindingGroups,
@@ -26,7 +27,9 @@ module Language.PureScript.Sugar.BindingGroups (
2627import Data.Graph
2728import Data.List (nub, intersect)
2829import Data.Maybe (isJust, mapMaybe)
30+#if __GLASGOW_HASKELL__ < 710
2931import Control.Applicative
32+#endif
3033import Control.Monad ((<=<))
3134import Control.Monad.Error.Class (MonadError(..))
3235
src/Language/PureScript/Sugar/CaseDeclarations.hs+5−1
@@ -14,7 +14,9 @@
1414--
1515-----------------------------------------------------------------------------
1616
17−{-# LANGUAGE FlexibleContexts, ScopedTypeVariables #-}
17+{-# LANGUAGE FlexibleContexts #-}
18+{-# LANGUAGE ScopedTypeVariables #-}
19+{-# LANGUAGE CPP #-}
1820
1921module Language.PureScript.Sugar.CaseDeclarations (
2022 desugarCases,
@@ -24,7 +26,9 @@ module Language.PureScript.Sugar.CaseDeclarations (
2426import Data.Maybe (catMaybes)
2527import Data.List (nub, groupBy)
2628
29+#if __GLASGOW_HASKELL__ < 710
2730import Control.Applicative
31+#endif
2832import Control.Monad ((<=<), forM, replicateM, join, unless)
2933import Control.Monad.Error.Class (MonadError(..))
3034import Control.Monad.Supply.Class
src/Language/PureScript/Sugar/DoNotation.hs+3
@@ -16,6 +16,7 @@
1616
1717{-# LANGUAGE FlexibleContexts #-}
1818{-# LANGUAGE ScopedTypeVariables #-}
19+{-# LANGUAGE CPP #-}
1920
2021module Language.PureScript.Sugar.DoNotation (
2122 desugarDoModule
@@ -27,7 +28,9 @@ import Language.PureScript.Errors
2728
2829import qualified Language.PureScript.Constants as C
2930
31+#if __GLASGOW_HASKELL__ < 710
3032import Control.Applicative
33+#endif
3134import Control.Monad.Error.Class (MonadError(..))
3235import Control.Monad.Supply.Class
3336
src/Language/PureScript/Sugar/Names.hs+3
@@ -15,6 +15,7 @@
1515{-# LANGUAGE FlexibleContexts #-}
1616{-# LANGUAGE ScopedTypeVariables #-}
1717{-# LANGUAGE PatternGuards #-}
18+{-# LANGUAGE CPP #-}
1819
1920module Language.PureScript.Sugar.Names (
2021 desugarImports
@@ -23,7 +24,9 @@ module Language.PureScript.Sugar.Names (
2324import Data.List (find, nub, (\\))
2425import Data.Maybe (catMaybes, fromMaybe, isJust, isNothing, mapMaybe)
2526
27+#if __GLASGOW_HASKELL__ < 710
2628import Control.Applicative (Applicative(..), (<$>), (<*>))
29+#endif
2730import Control.Monad
2831import Control.Monad.Error.Class (MonadError(..))
2932import Control.Monad.Writer (MonadWriter(..), censor)
src/Language/PureScript/Sugar/ObjectWildcards.hs+3
@@ -14,12 +14,15 @@
1414
1515{-# LANGUAGE FlexibleContexts #-}
1616{-# LANGUAGE ScopedTypeVariables #-}
17+{-# LANGUAGE CPP #-}
1718
1819module Language.PureScript.Sugar.ObjectWildcards (
1920 desugarObjectConstructors
2021) where
2122
23+#if __GLASGOW_HASKELL__ < 710
2224import Control.Applicative
25+#endif
2326import Control.Arrow (second)
2427import Control.Monad.Error.Class (MonadError(..))
2528import Control.Monad.Supply.Class
src/Language/PureScript/Sugar/Operators.hs+3
@@ -20,6 +20,7 @@
2020{-# LANGUAGE Rank2Types #-}
2121{-# LANGUAGE FlexibleContexts #-}
2222{-# LANGUAGE ScopedTypeVariables #-}
23+{-# LANGUAGE CPP #-}
2324
2425module Language.PureScript.Sugar.Operators (
2526 rebracket,
@@ -31,7 +32,9 @@ import Language.PureScript.AST
3132import Language.PureScript.Errors
3233import Language.PureScript.Names
3334
35+#if __GLASGOW_HASKELL__ < 710
3436import Control.Applicative
37+#endif
3538import Control.Monad.State
3639import Control.Monad.Error.Class (MonadError(..))
3740import Control.Monad.Supply.Class
src/Language/PureScript/Sugar/TypeClasses.hs+3
@@ -15,6 +15,7 @@
1515-----------------------------------------------------------------------------
1616
1717{-# LANGUAGE FlexibleContexts #-}
18+{-# LANGUAGE CPP #-}
1819
1920module Language.PureScript.Sugar.TypeClasses
2021 ( desugarTypeClasses
@@ -33,7 +34,9 @@ import Language.PureScript.Types
3334
3435import qualified Language.PureScript.Constants as C
3536
37+#if __GLASGOW_HASKELL__ < 710
3638import Control.Applicative
39+#endif
3740import Control.Arrow (first, second)
3841import Control.Monad.Error.Class (MonadError(..))
3942import Control.Monad.State
src/Language/PureScript/Sugar/TypeClasses/Deriving.hs+3
@@ -19,6 +19,7 @@
1919{-# LANGUAGE PatternGuards #-}
2020{-# LANGUAGE RankNTypes #-}
2121{-# LANGUAGE ScopedTypeVariables #-}
22+{-# LANGUAGE CPP #-}
2223
2324module Language.PureScript.Sugar.TypeClasses.Deriving (
2425 deriveInstances
@@ -28,7 +29,9 @@ import Data.List
2829import Data.Maybe (fromMaybe)
2930import Data.Ord (comparing)
3031
32+#if __GLASGOW_HASKELL__ < 710
3133import Control.Applicative
34+#endif
3235import Control.Monad (replicateM)
3336import Control.Monad.Supply.Class (MonadSupply, freshName)
3437import Control.Monad.Error.Class (MonadError(..))
src/Language/PureScript/Sugar/TypeDeclarations.hs+3
@@ -15,13 +15,16 @@
1515-----------------------------------------------------------------------------
1616
1717{-# LANGUAGE FlexibleContexts #-}
18+{-# LANGUAGE CPP #-}
1819
1920module Language.PureScript.Sugar.TypeDeclarations (
2021 desugarTypeDeclarations,
2122 desugarTypeDeclarationsModule
2223) where
2324
25+#if __GLASGOW_HASKELL__ < 710
2426import Control.Applicative
27+#endif
2528import Control.Monad (forM)
2629import Control.Monad.Error.Class (MonadError(..))
2730
src/Language/PureScript/Traversals.hs+4
@@ -12,9 +12,13 @@
1212--
1313-----------------------------------------------------------------------------
1414
15+{-# LANGUAGE CPP #-}
16+
1517module Language.PureScript.Traversals where
1618
19+#if __GLASGOW_HASKELL__ < 710
1720import Control.Applicative
21+#endif
1822
1923fstM :: (Functor f) => (a -> f c) -> (a, b) -> f (c, b)
2024fstM f (a, b) = flip (,) b <$> f a
src/Language/PureScript/TypeChecker.hs+3
@@ -14,6 +14,7 @@
1414-----------------------------------------------------------------------------
1515
1616{-# LANGUAGE FlexibleInstances #-}
17+{-# LANGUAGE CPP #-}
1718
1819module Language.PureScript.TypeChecker (
1920 module T,
@@ -31,7 +32,9 @@ import Data.Foldable (for_)
3132
3233import qualified Data.Map as M
3334
35+#if __GLASGOW_HASKELL__ < 710
3436import Control.Applicative ((<$>), (<*))
37+#endif
3538import Control.Monad.State
3639import Control.Monad.Error.Class (MonadError(..))
3740
src/Language/PureScript/TypeChecker/Entailment.hs+3
@@ -14,6 +14,7 @@
1414-----------------------------------------------------------------------------
1515
1616{-# LANGUAGE GeneralizedNewtypeDeriving #-}
17+{-# LANGUAGE CPP #-}
1718
1819module Language.PureScript.TypeChecker.Entailment (
1920 entails
@@ -22,7 +23,9 @@ module Language.PureScript.TypeChecker.Entailment (
2223import Data.Function (on)
2324import Data.List
2425import Data.Maybe (maybeToList)
26+#if __GLASGOW_HASKELL__ < 710
2527import Data.Foldable (foldMap)
28+#endif
2629import qualified Data.Map as M
2730
2831import Control.Applicative
src/Language/PureScript/TypeChecker/Kinds.hs+9−4
@@ -14,7 +14,10 @@
1414-----------------------------------------------------------------------------
1515
1616{-# OPTIONS_GHC -fno-warn-orphans #-}
17−{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, TupleSections #-}
17+{-# LANGUAGE MultiParamTypeClasses #-}
18+{-# LANGUAGE FlexibleInstances #-}
19+{-# LANGUAGE TupleSections #-}
20+{-# LANGUAGE CPP #-}
1821
1922module Language.PureScript.TypeChecker.Kinds (
2023 kindOf,
@@ -29,7 +32,9 @@ import qualified Data.HashMap.Strict as H
2932import qualified Data.Map as M
3033
3134import Control.Arrow (second)
35+#if __GLASGOW_HASKELL__ < 710
3236import Control.Applicative
37+#endif
3338import Control.Monad
3439import Control.Monad.Error.Class (MonadError(..))
3540import Control.Monad.State
@@ -72,12 +77,12 @@ instance Unifiable Check Kind where
7277--
7378kindOf :: ModuleName -> Type -> Check Kind
7479kindOf _ ty = fst <$> kindOfWithScopedVars ty
75−
80+
7681-- |
7782-- Infer the kind of a single type, returning the kinds of any scoped type variables
7883--
79−kindOfWithScopedVars :: Type -> Check (Kind, [(String, Kind)])
80−kindOfWithScopedVars ty =
84+kindOfWithScopedVars :: Type -> Check (Kind, [(String, Kind)])
85+kindOfWithScopedVars ty =
8186 rethrow (onErrorMessages (ErrorCheckingKind ty)) $
8287 fmap tidyUp . liftUnify $ infer ty
8388 where
src/Language/PureScript/TypeChecker/Monad.hs+9−2
@@ -13,15 +13,22 @@
1313--
1414-----------------------------------------------------------------------------
1515
16−{-# LANGUAGE GeneralizedNewtypeDeriving, FlexibleInstances, RankNTypes,
17− MultiParamTypeClasses, FlexibleContexts, GADTs #-}
16+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
17+{-# LANGUAGE FlexibleInstances #-}
18+{-# LANGUAGE RankNTypes #-}
19+{-# LANGUAGE MultiParamTypeClasses #-}
20+{-# LANGUAGE FlexibleContexts #-}
21+{-# LANGUAGE GADTs #-}
22+{-# LANGUAGE CPP #-}
1823
1924module Language.PureScript.TypeChecker.Monad where
2025
2126import Data.Maybe
2227import qualified Data.Map as M
2328
29+#if __GLASGOW_HASKELL__ < 710
2430import Control.Applicative
31+#endif
2532import Control.Monad.State
2633import Control.Monad.Unify
2734import Control.Monad.Writer.Strict
src/Language/PureScript/TypeChecker/Skolems.hs+4
@@ -13,6 +13,8 @@
1313--
1414-----------------------------------------------------------------------------
1515
16+{-# LANGUAGE CPP #-}
17+
1618module Language.PureScript.TypeChecker.Skolems (
1719 newSkolemConstant,
1820 introduceSkolemScope,
@@ -25,7 +27,9 @@ module Language.PureScript.TypeChecker.Skolems (
2527import Data.List (nub, (\\))
2628import Data.Monoid
2729
30+#if __GLASGOW_HASKELL__ < 710
2831import Control.Applicative
32+#endif
2933import Control.Monad.Error.Class (MonadError(..))
3034import Control.Monad.Unify
3135
src/Language/PureScript/TypeChecker/Synonyms.hs+6−1
@@ -13,7 +13,10 @@
1313--
1414-----------------------------------------------------------------------------
1515
16−{-# LANGUAGE FlexibleContexts, MultiParamTypeClasses, GADTs #-}
16+{-# LANGUAGE FlexibleContexts #-}
17+{-# LANGUAGE MultiParamTypeClasses #-}
18+{-# LANGUAGE GADTs #-}
19+{-# LANGUAGE CPP #-}
1720
1821module Language.PureScript.TypeChecker.Synonyms (
1922 saturateAllTypeSynonyms,
@@ -27,7 +30,9 @@ module Language.PureScript.TypeChecker.Synonyms (
2730import Data.Maybe (fromMaybe)
2831import qualified Data.Map as M
2932
33+#if __GLASGOW_HASKELL__ < 710
3034import Control.Applicative
35+#endif
3136import Control.Monad.Error.Class (MonadError(..))
3237import Control.Monad.State
3338
src/Language/PureScript/TypeChecker/Types.hs+6−1
@@ -13,7 +13,10 @@
1313--
1414-----------------------------------------------------------------------------
1515
16−{-# LANGUAGE FlexibleContexts, MultiParamTypeClasses, OverloadedStrings #-}
16+{-# LANGUAGE FlexibleContexts #-}
17+{-# LANGUAGE MultiParamTypeClasses #-}
18+{-# LANGUAGE OverloadedStrings #-}
19+{-# LANGUAGE CPP #-}
1720
1821module Language.PureScript.TypeChecker.Types (
1922 typesOf
@@ -40,7 +43,9 @@ import Data.List
4043import Data.Maybe (fromMaybe)
4144import qualified Data.Map as M
4245
46+#if __GLASGOW_HASKELL__ < 710
4347import Control.Applicative
48+#endif
4449import Control.Monad
4550import Control.Monad.State
4651import Control.Monad.Unify
src/Language/PureScript/TypeChecker/Unify.hs+5−3
@@ -14,7 +14,9 @@
1414-----------------------------------------------------------------------------
1515
1616{-# OPTIONS_GHC -fno-warn-orphans #-}
17−{-# LANGUAGE FlexibleInstances, FlexibleContexts, MultiParamTypeClasses #-}
17+{-# LANGUAGE FlexibleInstances #-}
18+{-# LANGUAGE FlexibleContexts #-}
19+{-# LANGUAGE MultiParamTypeClasses #-}
1820
1921module Language.PureScript.TypeChecker.Unify (
2022 unifyTypes,
@@ -157,14 +159,14 @@ unifiesWith _ REmpty REmpty = True
157159unifiesWith e r1@(RCons _ _ _) r2@(RCons _ _ _) =
158160 let (s1, r1') = rowToList r1
159161 (s2, r2') = rowToList r2
160−
162+
161163 int = [ (t1, t2) | (name, t1) <- s1, (name', t2) <- s2, name == name' ]
162164 sd1 = [ (name, t1) | (name, t1) <- s1, name `notElem` map fst s2 ]
163165 sd2 = [ (name, t2) | (name, t2) <- s2, name `notElem` map fst s1 ]
164166 in all (\(t1, t2) -> unifiesWith e t1 t2) int && go sd1 r1' sd2 r2'
165167 where
166168 go :: [(String, Type)] -> Type -> [(String, Type)] -> Type -> Bool
167− go [] REmpty [] REmpty = True
169+ go [] REmpty [] REmpty = True
168170 go [] (TypeVar v1) [] (TypeVar v2) = v1 == v2
169171 go [] (Skolem _ s1 _) [] (Skolem _ s2 _) = s1 == s2
170172 go _ (TUnknown _) _ _ = True
src/Language/PureScript/Types.hs+3
@@ -16,6 +16,7 @@
1616{-# LANGUAGE DeriveDataTypeable #-}
1717{-# LANGUAGE GeneralizedNewtypeDeriving #-}
1818{-# LANGUAGE TemplateHaskell #-}
19+{-# LANGUAGE CPP #-}
1920
2021module Language.PureScript.Types where
2122
@@ -26,7 +27,9 @@ import qualified Data.Aeson.TH as A
2627
2728import Control.Monad.Unify
2829import Control.Arrow (second)
30+#if __GLASGOW_HASKELL__ < 710
2931import Control.Applicative
32+#endif
3033import Control.Monad ((<=<))
3134
3235import Language.PureScript.Names