git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #1610 from phadej/base-compat
09f4c2dPhil Freeman
CONTRIBUTING.md+1−1
@@ -30,7 +30,7 @@ updated.
30You can automate this (if you have bash):
30You can automate this (if you have bash):
31
31
32- get a copy of [cabal-dependency-licenses][]
32- get a copy of [cabal-dependency-licenses][]
33−- run at the command line: `./license/generate > LICENSE`
33+- run at the command line: `runhaskell license-generator/generate.hs > LICENSE`
34
34
35[cabal-dependency-licenses]: https://github.com/jaspervdj/cabal-dependency-licenses
35[cabal-dependency-licenses]: https://github.com/jaspervdj/cabal-dependency-licenses
36
36
LICENSE+125
@@ -31,6 +31,7 @@ PureScript uses the following Haskell library packages. Their license files foll
31 array
31 array
32 attoparsec
32 attoparsec
33 base
33 base
34+ base-compat
34 binary
35 binary
35 blaze-builder
36 blaze-builder
36 bower-json
37 bower-json
@@ -50,6 +51,7 @@ PureScript uses the following Haskell library packages. Their license files foll
50 monad-control
51 monad-control
51 mtl
52 mtl
52 nats
53 nats
54+ old-locale
53 optparse-applicative
55 optparse-applicative
54 parallel
56 parallel
55 parsec
57 parsec
@@ -64,6 +66,7 @@ PureScript uses the following Haskell library packages. Their license files foll
64 split
66 split
65 stm
67 stm
66 syb
68 syb
69+ tagged
67 template-haskell
70 template-haskell
68 terminfo
71 terminfo
69 text
72 text
@@ -454,6 +457,28 @@ base LICENSE file:
454
457
455 -----------------------------------------------------------------------------
458 -----------------------------------------------------------------------------
456
459
460+base-compat LICENSE file:
461+
462+ Copyright (c) 2012-2015 Simon Hengel <sol@typeful.net> and Ryan Scott <ryan.gl.scott@ku.edu>
463+
464+ Permission is hereby granted, free of charge, to any person obtaining a copy
465+ of this software and associated documentation files (the "Software"), to deal
466+ in the Software without restriction, including without limitation the rights
467+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
468+ copies of the Software, and to permit persons to whom the Software is
469+ furnished to do so, subject to the following conditions:
470+
471+ The above copyright notice and this permission notice shall be included in
472+ all copies or substantial portions of the Software.
473+
474+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
475+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
476+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
477+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
478+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
479+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
480+ THE SOFTWARE.
481+
457binary LICENSE file:
482binary LICENSE file:
458
483
459 Copyright (c) Lennart Kolmodin
484 Copyright (c) Lennart Kolmodin
@@ -1136,6 +1161,72 @@ nats LICENSE file:
1136 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1161 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1137 POSSIBILITY OF SUCH DAMAGE.
1162 POSSIBILITY OF SUCH DAMAGE.
1138
1163
1164+old-locale LICENSE file:
1165+
1166+ This library (libraries/base) is derived from code from two
1167+ sources:
1168+
1169+ * Code from the GHC project which is largely (c) The University of
1170+ Glasgow, and distributable under a BSD-style license (see below),
1171+
1172+ * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
1173+ and freely redistributable (but see the full license for
1174+ restrictions).
1175+
1176+ The full text of these licenses is reproduced below. Both of the
1177+ licenses are BSD-style or compatible.
1178+
1179+ -----------------------------------------------------------------------------
1180+
1181+ The Glasgow Haskell Compiler License
1182+
1183+ Copyright 2004, The University Court of the University of Glasgow.
1184+ All rights reserved.
1185+
1186+ Redistribution and use in source and binary forms, with or without
1187+ modification, are permitted provided that the following conditions are met:
1188+
1189+ - Redistributions of source code must retain the above copyright notice,
1190+ this list of conditions and the following disclaimer.
1191+
1192+ - Redistributions in binary form must reproduce the above copyright notice,
1193+ this list of conditions and the following disclaimer in the documentation
1194+ and/or other materials provided with the distribution.
1195+
1196+ - Neither name of the University nor the names of its contributors may be
1197+ used to endorse or promote products derived from this software without
1198+ specific prior written permission.
1199+
1200+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
1201+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
1202+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
1203+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
1204+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
1205+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1206+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1207+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1208+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1209+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1210+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
1211+ DAMAGE.
1212+
1213+ -----------------------------------------------------------------------------
1214+
1215+ Code derived from the document "Report on the Programming Language
1216+ Haskell 98", is distributed under the following license:
1217+
1218+ Copyright (c) 2002 Simon Peyton Jones
1219+
1220+ The authors intend this Report to belong to the entire Haskell
1221+ community, and so we grant permission to copy and distribute it for
1222+ any purpose, provided that it is reproduced in its entirety,
1223+ including this Notice. Modified versions of this Report may also be
1224+ copied and distributed for any purpose, provided that the modified
1225+ version is clearly presented as such, and that it does not claim to
1226+ be a definition of the Haskell 98 Language.
1227+
1228+ -----------------------------------------------------------------------------
1229+
1139optparse-applicative LICENSE file:
1230optparse-applicative LICENSE file:
1140
1231
1141 Copyright (c) 2012, Paolo Capriotti
1232 Copyright (c) 2012, Paolo Capriotti
@@ -1648,6 +1739,39 @@ syb LICENSE file:
1648
1739
1649 -----------------------------------------------------------------------------
1740 -----------------------------------------------------------------------------
1650
1741
1742+tagged LICENSE file:
1743+
1744+ Copyright (c) 2009-2015 Edward Kmett
1745+ All rights reserved.
1746+
1747+ Redistribution and use in source and binary forms, with or without
1748+ modification, are permitted provided that the following conditions are
1749+ met:
1750+
1751+ * Redistributions of source code must retain the above copyright
1752+ notice, this list of conditions and the following disclaimer.
1753+
1754+ * Redistributions in binary form must reproduce the above
1755+ copyright notice, this list of conditions and the following
1756+ disclaimer in the documentation and/or other materials provided
1757+ with the distribution.
1758+
1759+ * Neither the name of Edward Kmett nor the names of other
1760+ contributors may be used to endorse or promote products derived
1761+ from this software without specific prior written permission.
1762+
1763+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1764+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1765+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1766+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1767+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1768+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1769+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1770+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1771+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1772+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1773+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1774+
1651template-haskell LICENSE file:
1775template-haskell LICENSE file:
1652
1776
1653
1777
@@ -2008,3 +2132,4 @@ void LICENSE file:
2008 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
2132 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
2009 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2133 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2010 POSSIBILITY OF SUCH DAMAGE.
2134 POSSIBILITY OF SUCH DAMAGE.
2135+
license-generator/generatedeleted−47
@@ -1,47 +0,0 @@
1−#!/bin/bash
2−# Generates the LICENSE file and prints it to standard output.
3−# Example use:
4−#
5−# ./license/generate > LICENSE
6−#
7−
8−set -e # exit on error
9−set -u # exit on undefined variable
10−set -o pipefail # propagate nonzero exit codes through pipelines
11−
12−export LC_CTYPE=C
13−export LANG=C
14−
15−if ! which cabal-dependency-licenses >/dev/null; then
16− echo "$0: the program 'cabal-dependency-licenses' is required." >&2
17− echo "$0: see Hackage: https://hackage.haskell.org/package/cabal-dependency-licenses" >&2
18− exit 1
19−fi
20−
21−echo_header() {
22− cat license-generator/header.txt
23−}
24−
25−echo_deps_names() {
26− cabal-dependency-licenses \
27− | grep '^- ' | sed 's/^..//' | gsort -h
28−}
29−
30−echo_deps_licenses() {
31− while read dep; do
32− echo "fetching LICENSE for: ${dep}" >&2
33− echo "${dep} LICENSE file:"
34− echo ""
35− curl --silent "https://hackage.haskell.org/package/${dep}/src/LICENSE" \
36− | sed 's/^/ /g' # indent by 2 characters
37− echo ""
38− done
39−}
40−
41−echo_deps_names > license-generator/tmp/deps.txt
42−
43−echo_header
44−echo ""
45−sed <license-generator/tmp/deps.txt 's/^/ /'
46−echo ""
47−echo_deps_licenses <license-generator/tmp/deps.txt
license-generator/generate.hsnew file+40
@@ -0,0 +1,40 @@
1+module Main (main) where
2+
3+import Control.Monad (forM_)
4+import Data.Char (isSpace)
5+import Data.List
6+import System.Process
7+import System.IO (hPutStrLn, stderr)
8+
9+echoHeader :: IO ()
10+echoHeader =
11+ readFile "license-generator/header.txt" >>= putStr
12+
13+depsNames :: IO [String]
14+depsNames = do
15+ i <- readProcess "cabal-dependency-licenses" [] ""
16+ return $ sort $ map (drop 2) $ filter startsWithDash $ lines i
17+ where
18+ startsWithDash ('-' : _) = True
19+ startsWithDash _ = False
20+
21+depsLicense :: String -> IO ()
22+depsLicense dep = do
23+ let licenseFile = if dep == "Glob" then "LICENSE.txt" else "LICENSE"
24+ hPutStrLn stderr dep
25+ license <- readProcess "curl" ["--silent", "https://hackage.haskell.org/package/" ++ dep ++ "/src/" ++ licenseFile] ""
26+ putStrLn $ dep ++ " LICENSE file:"
27+ putStrLn ""
28+ putStrLn $ f license
29+ where
30+ f = unlines . map trimEnd . map (" " ++) . lines
31+ trimEnd = reverse . dropWhile isSpace . reverse
32+
33+main :: IO ()
34+main = do
35+ deps <-depsNames
36+ echoHeader
37+ putStrLn ""
38+ forM_ deps $ \d -> putStr " " >> putStrLn d
39+ putStrLn ""
40+ forM_ deps depsLicense
license-generator/tmp/.gitkeepdeleted

No changes to the content.

psci/Completion.hs+3−8
@@ -1,19 +1,14 @@
1−{-# LANGUAGE CPP #-}
2−
3module Completion where
1module Completion where
4
2
3+import Prelude ()
4+import Prelude.Compat
5+
5import Data.Maybe (mapMaybe)
6import Data.Maybe (mapMaybe)
6import Data.List (nub, nubBy, sortBy, isPrefixOf, stripPrefix)
7import Data.List (nub, nubBy, sortBy, isPrefixOf, stripPrefix)
7import Data.Char (isUpper)
8import Data.Char (isUpper)
8import Data.Function (on)
9import Data.Function (on)
9−#if __GLASGOW_HASKELL__ < 710
10−import Data.Traversable (traverse)
11−#endif
12
10
13import Control.Arrow (second)
11import Control.Arrow (second)
14−#if __GLASGOW_HASKELL__ < 710
15−import Control.Applicative ((<$>), (<*>))
16−#endif
17import Control.Monad.Trans.Reader (asks, runReaderT, ReaderT)
12import Control.Monad.Trans.Reader (asks, runReaderT, ReaderT)
18import Control.Monad.Trans.State.Strict
13import Control.Monad.Trans.State.Strict
19
14
psci/PSCi.hs+7−8
@@ -17,15 +17,14 @@
17{-# LANGUAGE GeneralizedNewtypeDeriving #-}
17{-# LANGUAGE GeneralizedNewtypeDeriving #-}
18{-# LANGUAGE RecordWildCards #-}
18{-# LANGUAGE RecordWildCards #-}
19{-# LANGUAGE TupleSections #-}
19{-# LANGUAGE TupleSections #-}
20−{-# LANGUAGE CPP #-}
21
20
22module PSCi where
21module PSCi where
23
22
23+import Prelude ()
24+import Prelude.Compat
25+
24import Data.Foldable (traverse_)
26import Data.Foldable (traverse_)
25import Data.List (intercalate, nub, sort)
27import Data.List (intercalate, nub, sort)
26−#if __GLASGOW_HASKELL__ < 710
27−import Data.Traversable (traverse)
28−#endif
29import Data.Tuple (swap)
28import Data.Tuple (swap)
30import Data.Version (showVersion)
29import Data.Version (showVersion)
31import qualified Data.Map as M
30import qualified Data.Map as M
@@ -507,7 +506,7 @@ loadUserConfig = onFirstFileMatching readCommands pathGetters
507 if exists
506 if exists
508 then do
507 then do
509 ls <- lines <$> readFile configFile
508 ls <- lines <$> readFile configFile
510− case mapM parseCommand ls of
509+ case traverse parseCommand ls of
511 Left err -> print err >> exitFailure
510 Left err -> print err >> exitFailure
512 Right cs -> return $ Just cs
511 Right cs -> return $ Just cs
513 else
512 else
@@ -524,8 +523,8 @@ consoleIsDefined = any ((== P.ModuleName (map P.ProperName [ "Control", "Monad",
524loop :: PSCiOptions -> IO ()
523loop :: PSCiOptions -> IO ()
525loop PSCiOptions{..} = do
524loop PSCiOptions{..} = do
526 config <- loadUserConfig
525 config <- loadUserConfig
527− inputFiles <- concat <$> mapM glob psciInputFile
526+ inputFiles <- concat <$> traverse glob psciInputFile
528− foreignFiles <- concat <$> mapM glob psciForeignInputFiles
527+ foreignFiles <- concat <$> traverse glob psciForeignInputFiles
529 modulesOrFirstError <- loadAllModules inputFiles
528 modulesOrFirstError <- loadAllModules inputFiles
530 case modulesOrFirstError of
529 case modulesOrFirstError of
531 Left errs -> putStrLn (P.prettyPrintMultipleErrors False errs) >> exitFailure
530 Left errs -> putStrLn (P.prettyPrintMultipleErrors False errs) >> exitFailure
@@ -540,7 +539,7 @@ loop PSCiOptions{..} = do
540 Right foreigns ->
539 Right foreigns ->
541 flip evalStateT (PSCiState inputFiles [] modules foreigns [] psciInputNodeFlags) . runInputT (setComplete completion settings) $ do
540 flip evalStateT (PSCiState inputFiles [] modules foreigns [] psciInputNodeFlags) . runInputT (setComplete completion settings) $ do
542 outputStrLn prologueMessage
541 outputStrLn prologueMessage
543− traverse_ (mapM_ (runPSCI . handleCommand)) config
542+ traverse_ (traverse_ (runPSCI . handleCommand)) config
544 modules' <- lift $ gets psciLoadedModules
543 modules' <- lift $ gets psciLoadedModules
545 unless (consoleIsDefined (map snd modules')) . outputStrLn $ unlines
544 unless (consoleIsDefined (map snd modules')) . outputStrLn $ unlines
546 [ "PSCi requires the purescript-console module to be installed."
545 [ "PSCi requires the purescript-console module to be installed."
psci/Parser.hs+2−7
@@ -13,21 +13,16 @@
13--
13--
14-----------------------------------------------------------------------------
14-----------------------------------------------------------------------------
15
15
16−{-# LANGUAGE CPP #-}
17−
18module Parser
16module Parser
19 ( parseCommand
17 ( parseCommand
20 ) where
18 ) where
21
19
22−import Prelude hiding (lex)
20+import Prelude ()
21+import Prelude.Compat hiding (lex)
23
22
24import Data.Char (isSpace)
23import Data.Char (isSpace)
25import Data.List (intercalate)
24import Data.List (intercalate)
26
25
27−#if __GLASGOW_HASKELL__ < 710
28−import Control.Applicative hiding (many)
29−#endif
30−
31import Text.Parsec hiding ((<|>))
26import Text.Parsec hiding ((<|>))
32
27
33import qualified Language.PureScript as P
28import qualified Language.PureScript as P
psci/tests/Main.hs+3−4
@@ -1,14 +1,13 @@
1{-# LANGUAGE RecordWildCards #-}
1{-# LANGUAGE RecordWildCards #-}
2{-# LANGUAGE TupleSections #-}
2{-# LANGUAGE TupleSections #-}
3−{-# LANGUAGE CPP #-}
4
3
5module Main where
4module Main where
6
5
6+import Prelude ()
7+import Prelude.Compat
8+
7import Control.Monad.Trans.State.Strict (runStateT)
9import Control.Monad.Trans.State.Strict (runStateT)
8import Control.Monad (when, forM)
10import Control.Monad (when, forM)
9−#if __GLASGOW_HASKELL__ < 710
10−import Control.Applicative
11−#endif
12import Control.Monad.Writer.Strict (runWriterT)
11import Control.Monad.Writer.Strict (runWriterT)
13import Control.Monad.Trans.Except (runExceptT)
12import Control.Monad.Trans.Except (runExceptT)
14
13
purescript.cabal+4−3
@@ -40,6 +40,7 @@ source-repository head
40
40
41library
41library
42 build-depends: base >=4.6 && <5,
42 build-depends: base >=4.6 && <5,
43+ base-compat >=0.6.0,
43 lifted-base >= 0.2.3 && < 0.2.4,
44 lifted-base >= 0.2.3 && < 0.2.4,
44 monad-control >= 1.0.0.0 && < 1.1,
45 monad-control >= 1.0.0.0 && < 1.1,
45 transformers-base >= 0.4.0 && < 0.5,
46 transformers-base >= 0.4.0 && < 0.5,
@@ -197,7 +198,7 @@ executable psci
197 build-depends: base >=4 && <5, containers -any, directory -any, filepath -any,
198 build-depends: base >=4 && <5, containers -any, directory -any, filepath -any,
198 mtl -any, optparse-applicative >= 0.10.0, parsec -any,
199 mtl -any, optparse-applicative >= 0.10.0, parsec -any,
199 haskeline >= 0.7.0.0, purescript -any, transformers -any,
200 haskeline >= 0.7.0.0, purescript -any, transformers -any,
200− transformers-compat -any, process -any, time -any, Glob -any
201+ transformers-compat -any, process -any, time -any, Glob -any, base-compat >=0.6.0
201
202
202 main-is: Main.hs
203 main-is: Main.hs
203 buildable: True
204 buildable: True
@@ -260,7 +261,7 @@ test-suite tests
260 build-depends: base >=4 && <5, containers -any, directory -any,
261 build-depends: base >=4 && <5, containers -any, directory -any,
261 filepath -any, mtl -any, parsec -any, purescript -any,
262 filepath -any, mtl -any, parsec -any, purescript -any,
262 transformers -any, process -any, transformers-compat -any, time -any,
263 transformers -any, process -any, transformers-compat -any, time -any,
263− Glob -any
264+ Glob -any, base-compat >=0.6.0
264 type: exitcode-stdio-1.0
265 type: exitcode-stdio-1.0
265 main-is: Main.hs
266 main-is: Main.hs
266 other-modules: TestsSetup
267 other-modules: TestsSetup
@@ -272,7 +273,7 @@ test-suite psci-tests
272 mtl -any, optparse-applicative >= 0.10.0, parsec -any,
273 mtl -any, optparse-applicative >= 0.10.0, parsec -any,
273 haskeline >= 0.7.0.0, purescript -any, transformers -any,
274 haskeline >= 0.7.0.0, purescript -any, transformers -any,
274 transformers-compat -any, process -any, HUnit -any, time -any,
275 transformers-compat -any, process -any, HUnit -any, time -any,
275− Glob -any
276+ Glob -any, base-compat >=0.6.0
276 type: exitcode-stdio-1.0
277 type: exitcode-stdio-1.0
277 main-is: Main.hs
278 main-is: Main.hs
278 other-modules: TestsSetup
279 other-modules: TestsSetup
src/Control/Monad/Logger.hs+3−5
@@ -12,19 +12,17 @@
12--
12--
13-----------------------------------------------------------------------------
13-----------------------------------------------------------------------------
14
14
15−{-# LANGUAGE CPP #-}
16{-# LANGUAGE FlexibleInstances #-}
15{-# LANGUAGE FlexibleInstances #-}
17{-# LANGUAGE MultiParamTypeClasses #-}
16{-# LANGUAGE MultiParamTypeClasses #-}
18{-# LANGUAGE TypeFamilies #-}
17{-# LANGUAGE TypeFamilies #-}
19
18
20module Control.Monad.Logger where
19module Control.Monad.Logger where
21
20
21+import Prelude ()
22+import Prelude.Compat
23+
22import Data.IORef
24import Data.IORef
23
25
24−#if __GLASGOW_HASKELL__ < 710
25−import Data.Monoid
26−import Control.Applicative
27−#endif
28import Control.Monad (ap)
26import Control.Monad (ap)
29import Control.Monad.IO.Class
27import Control.Monad.IO.Class
30import Control.Monad.Writer.Class
28import Control.Monad.Writer.Class
src/Control/Monad/Supply.hs+3−4
@@ -14,15 +14,14 @@
14-----------------------------------------------------------------------------
14-----------------------------------------------------------------------------
15
15
16{-# LANGUAGE GeneralizedNewtypeDeriving #-}
16{-# LANGUAGE GeneralizedNewtypeDeriving #-}
17−{-# LANGUAGE CPP #-}
18
17
19module Control.Monad.Supply where
18module Control.Monad.Supply where
20
19
20+import Prelude ()
21+import Prelude.Compat
22+
21import Data.Functor.Identity
23import Data.Functor.Identity
22
24
23−#if __GLASGOW_HASKELL__ < 710
24−import Control.Applicative
25−#endif
26import Control.Monad.State
25import Control.Monad.State
27import Control.Monad.Error.Class (MonadError(..))
26import Control.Monad.Error.Class (MonadError(..))
28import Control.Monad.Reader
27import Control.Monad.Reader
src/Language/PureScript/AST/Declarations.hs+3−5
@@ -15,10 +15,12 @@
15{-# LANGUAGE DeriveDataTypeable #-}
15{-# LANGUAGE DeriveDataTypeable #-}
16{-# LANGUAGE ScopedTypeVariables #-}
16{-# LANGUAGE ScopedTypeVariables #-}
17{-# LANGUAGE TemplateHaskell #-}
17{-# LANGUAGE TemplateHaskell #-}
18−{-# LANGUAGE CPP #-}
19
18
20module Language.PureScript.AST.Declarations where
19module Language.PureScript.AST.Declarations where
21
20
21+import Prelude ()
22+import Prelude.Compat
23+
22import Data.Aeson.TH
24import Data.Aeson.TH
23
25
24import qualified Data.Data as D
26import qualified Data.Data as D
@@ -26,10 +28,6 @@ import qualified Data.Map as M
26
28
27import Control.Monad.Identity
29import Control.Monad.Identity
28
30
29−#if __GLASGOW_HASKELL__ < 710
30−import Control.Applicative
31−#endif
32−
33import Language.PureScript.AST.Binders
31import Language.PureScript.AST.Binders
34import Language.PureScript.AST.Operators
32import Language.PureScript.AST.Operators
35import Language.PureScript.AST.SourcePos
33import Language.PureScript.AST.SourcePos
src/Language/PureScript/AST/SourcePos.hs+3−5
@@ -12,7 +12,6 @@
12--
12--
13-----------------------------------------------------------------------------
13-----------------------------------------------------------------------------
14
14
15−{-# LANGUAGE CPP #-}
16{-# LANGUAGE DeriveDataTypeable #-}
15{-# LANGUAGE DeriveDataTypeable #-}
17{-# LANGUAGE ScopedTypeVariables #-}
16{-# LANGUAGE ScopedTypeVariables #-}
18{-# LANGUAGE RecordWildCards #-}
17{-# LANGUAGE RecordWildCards #-}
@@ -20,14 +19,13 @@
20
19
21module Language.PureScript.AST.SourcePos where
20module Language.PureScript.AST.SourcePos where
22
21
22+import Prelude ()
23+import Prelude.Compat
24+
23import qualified Data.Data as D
25import qualified Data.Data as D
24import Data.Aeson ((.=), (.:))
26import Data.Aeson ((.=), (.:))
25import qualified Data.Aeson as A
27import qualified Data.Aeson as A
26
28
27−#if __GLASGOW_HASKELL__ < 710
28−import Control.Applicative
29−#endif
30−
31-- |
29-- |
32-- Source position information
30-- Source position information
33--
31--
src/Language/PureScript/AST/Traversals.hs+58−67
@@ -12,21 +12,12 @@
12--
12--
13-----------------------------------------------------------------------------
13-----------------------------------------------------------------------------
14
14
15−{-# LANGUAGE CPP #-}
16−
17module Language.PureScript.AST.Traversals where
15module Language.PureScript.AST.Traversals where
18
16
19−#if __GLASGOW_HASKELL__ < 710
17+import Prelude ()
20−import Data.Monoid (Monoid(..), mconcat)
18+import Prelude.Compat
21−#endif
22−import Data.Maybe (mapMaybe)
23−#if __GLASGOW_HASKELL__ < 710
24−import Data.Traversable (traverse)
25−#endif
26
19
27−#if __GLASGOW_HASKELL__ < 710
20+import Data.Maybe (mapMaybe)
28−import Control.Applicative
29−#endif
30import Control.Monad
21import Control.Monad
31import Control.Arrow ((***), (+++), second)
22import Control.Arrow ((***), (+++), second)
32
23
@@ -101,10 +92,10 @@ everywhereOnValuesTopDownM :: (Functor m, Applicative m, Monad m) =>
101 (Declaration -> m Declaration, Expr -> m Expr, Binder -> m Binder)
92 (Declaration -> m Declaration, Expr -> m Expr, Binder -> m Binder)
102everywhereOnValuesTopDownM f g h = (f' <=< f, g' <=< g, h' <=< h)
93everywhereOnValuesTopDownM f g h = (f' <=< f, g' <=< g, h' <=< h)
103 where
94 where
104− f' (DataBindingGroupDeclaration ds) = DataBindingGroupDeclaration <$> mapM (f' <=< f) ds
95+ f' (DataBindingGroupDeclaration ds) = DataBindingGroupDeclaration <$> traverse (f' <=< f) ds
105− f' (ValueDeclaration name nameKind bs val) = ValueDeclaration name nameKind <$> mapM (h' <=< h) bs <*> eitherM (mapM (pairM (g' <=< g) (g' <=< g))) (g' <=< g) val
96+ f' (ValueDeclaration name nameKind bs val) = ValueDeclaration name nameKind <$> traverse (h' <=< h) bs <*> eitherM (traverse (pairM (g' <=< g) (g' <=< g))) (g' <=< g) val
106− f' (BindingGroupDeclaration ds) = BindingGroupDeclaration <$> mapM (\(name, nameKind, val) -> (,,) name nameKind <$> (g val >>= g')) ds
97+ f' (BindingGroupDeclaration ds) = BindingGroupDeclaration <$> traverse (\(name, nameKind, val) -> (,,) name nameKind <$> (g val >>= g')) ds
107− f' (TypeClassDeclaration name args implies ds) = TypeClassDeclaration name args implies <$> mapM (f' <=< f) ds
98+ f' (TypeClassDeclaration name args implies ds) = TypeClassDeclaration name args implies <$> traverse (f' <=< f) ds
108 f' (TypeInstanceDeclaration name cs className args ds) = TypeInstanceDeclaration name cs className args <$> traverseTypeInstanceBody (traverse (f' <=< f)) ds
99 f' (TypeInstanceDeclaration name cs className args ds) = TypeInstanceDeclaration name cs className args <$> traverseTypeInstanceBody (traverse (f' <=< f)) ds
109 f' (PositionedDeclaration pos com d) = PositionedDeclaration pos com <$> (f d >>= f')
100 f' (PositionedDeclaration pos com d) = PositionedDeclaration pos com <$> (f d >>= f')
110 f' other = f other
101 f' other = f other
@@ -114,37 +105,37 @@ everywhereOnValuesTopDownM f g h = (f' <=< f, g' <=< g, h' <=< h)
114 g' (Parens v) = Parens <$> (g v >>= g')
105 g' (Parens v) = Parens <$> (g v >>= g')
115 g' (OperatorSection op (Left v)) = OperatorSection <$> (g op >>= g') <*> (Left <$> (g v >>= g'))
106 g' (OperatorSection op (Left v)) = OperatorSection <$> (g op >>= g') <*> (Left <$> (g v >>= g'))
116 g' (OperatorSection op (Right v)) = OperatorSection <$> (g op >>= g') <*> (Right <$> (g v >>= g'))
107 g' (OperatorSection op (Right v)) = OperatorSection <$> (g op >>= g') <*> (Right <$> (g v >>= g'))
117− g' (ArrayLiteral vs) = ArrayLiteral <$> mapM (g' <=< g) vs
108+ g' (ArrayLiteral vs) = ArrayLiteral <$> traverse (g' <=< g) vs
118− g' (ObjectLiteral vs) = ObjectLiteral <$> mapM (sndM (g' <=< g)) vs
109+ g' (ObjectLiteral vs) = ObjectLiteral <$> traverse (sndM (g' <=< g)) vs
119− g' (ObjectConstructor vs) = ObjectConstructor <$> mapM (sndM $ maybeM (g' <=< g)) vs
110+ g' (ObjectConstructor vs) = ObjectConstructor <$> traverse (sndM $ maybeM (g' <=< g)) vs
120 g' (TypeClassDictionaryConstructorApp name v) = TypeClassDictionaryConstructorApp name <$> (g v >>= g')
111 g' (TypeClassDictionaryConstructorApp name v) = TypeClassDictionaryConstructorApp name <$> (g v >>= g')
121 g' (Accessor prop v) = Accessor prop <$> (g v >>= g')
112 g' (Accessor prop v) = Accessor prop <$> (g v >>= g')
122− g' (ObjectUpdate obj vs) = ObjectUpdate <$> (g obj >>= g') <*> mapM (sndM (g' <=< g)) vs
113+ g' (ObjectUpdate obj vs) = ObjectUpdate <$> (g obj >>= g') <*> traverse (sndM (g' <=< g)) vs
123− g' (ObjectUpdater obj vs) = ObjectUpdater <$> (maybeM g obj >>= maybeM g') <*> mapM (sndM $ maybeM (g' <=< g)) vs
114+ g' (ObjectUpdater obj vs) = ObjectUpdater <$> (maybeM g obj >>= maybeM g') <*> traverse (sndM $ maybeM (g' <=< g)) vs
124 g' (Abs name v) = Abs name <$> (g v >>= g')
115 g' (Abs name v) = Abs name <$> (g v >>= g')
125 g' (App v1 v2) = App <$> (g v1 >>= g') <*> (g v2 >>= g')
116 g' (App v1 v2) = App <$> (g v1 >>= g') <*> (g v2 >>= g')
126 g' (IfThenElse v1 v2 v3) = IfThenElse <$> (g v1 >>= g') <*> (g v2 >>= g') <*> (g v3 >>= g')
117 g' (IfThenElse v1 v2 v3) = IfThenElse <$> (g v1 >>= g') <*> (g v2 >>= g') <*> (g v3 >>= g')
127− g' (Case vs alts) = Case <$> mapM (g' <=< g) vs <*> mapM handleCaseAlternative alts
118+ g' (Case vs alts) = Case <$> traverse (g' <=< g) vs <*> traverse handleCaseAlternative alts
128 g' (TypedValue check v ty) = TypedValue check <$> (g v >>= g') <*> pure ty
119 g' (TypedValue check v ty) = TypedValue check <$> (g v >>= g') <*> pure ty
129− g' (Let ds v) = Let <$> mapM (f' <=< f) ds <*> (g v >>= g')
120+ g' (Let ds v) = Let <$> traverse (f' <=< f) ds <*> (g v >>= g')
130− g' (Do es) = Do <$> mapM handleDoNotationElement es
121+ g' (Do es) = Do <$> traverse handleDoNotationElement es
131 g' (PositionedValue pos com v) = PositionedValue pos com <$> (g v >>= g')
122 g' (PositionedValue pos com v) = PositionedValue pos com <$> (g v >>= g')
132 g' other = g other
123 g' other = g other
133
124
134− h' (ConstructorBinder ctor bs) = ConstructorBinder ctor <$> mapM (h' <=< h) bs
125+ h' (ConstructorBinder ctor bs) = ConstructorBinder ctor <$> traverse (h' <=< h) bs
135− h' (ObjectBinder bs) = ObjectBinder <$> mapM (sndM (h' <=< h)) bs
126+ h' (ObjectBinder bs) = ObjectBinder <$> traverse (sndM (h' <=< h)) bs
136− h' (ArrayBinder bs) = ArrayBinder <$> mapM (h' <=< h) bs
127+ h' (ArrayBinder bs) = ArrayBinder <$> traverse (h' <=< h) bs
137 h' (NamedBinder name b) = NamedBinder name <$> (h b >>= h')
128 h' (NamedBinder name b) = NamedBinder name <$> (h b >>= h')
138 h' (PositionedBinder pos com b) = PositionedBinder pos com <$> (h b >>= h')
129 h' (PositionedBinder pos com b) = PositionedBinder pos com <$> (h b >>= h')
139 h' (TypedBinder t b) = TypedBinder t <$> (h b >>= h')
130 h' (TypedBinder t b) = TypedBinder t <$> (h b >>= h')
140 h' other = h other
131 h' other = h other
141
132
142− handleCaseAlternative (CaseAlternative bs val) = CaseAlternative <$> mapM (h' <=< h) bs
133+ handleCaseAlternative (CaseAlternative bs val) = CaseAlternative <$> traverse (h' <=< h) bs
143− <*> eitherM (mapM (pairM (g' <=< g) (g' <=< g))) (g' <=< g) val
134+ <*> eitherM (traverse (pairM (g' <=< g) (g' <=< g))) (g' <=< g) val
144
135
145 handleDoNotationElement (DoNotationValue v) = DoNotationValue <$> (g' <=< g) v
136 handleDoNotationElement (DoNotationValue v) = DoNotationValue <$> (g' <=< g) v
146 handleDoNotationElement (DoNotationBind b v) = DoNotationBind <$> (h' <=< h) b <*> (g' <=< g) v
137 handleDoNotationElement (DoNotationBind b v) = DoNotationBind <$> (h' <=< h) b <*> (g' <=< g) v
147− handleDoNotationElement (DoNotationLet ds) = DoNotationLet <$> mapM (f' <=< f) ds
138+ handleDoNotationElement (DoNotationLet ds) = DoNotationLet <$> traverse (f' <=< f) ds
148 handleDoNotationElement (PositionedDoNotationElement pos com e) = PositionedDoNotationElement pos com <$> handleDoNotationElement e
139 handleDoNotationElement (PositionedDoNotationElement pos com e) = PositionedDoNotationElement pos com <$> handleDoNotationElement e
149
140
150everywhereOnValuesM :: (Functor m, Applicative m, Monad m) =>
141everywhereOnValuesM :: (Functor m, Applicative m, Monad m) =>
@@ -154,11 +145,11 @@ everywhereOnValuesM :: (Functor m, Applicative m, Monad m) =>
154 (Declaration -> m Declaration, Expr -> m Expr, Binder -> m Binder)
145 (Declaration -> m Declaration, Expr -> m Expr, Binder -> m Binder)
155everywhereOnValuesM f g h = (f', g', h')
146everywhereOnValuesM f g h = (f', g', h')
156 where
147 where
157− f' (DataBindingGroupDeclaration ds) = (DataBindingGroupDeclaration <$> mapM f' ds) >>= f
148+ f' (DataBindingGroupDeclaration ds) = (DataBindingGroupDeclaration <$> traverse f' ds) >>= f
158− f' (ValueDeclaration name nameKind bs val) = (ValueDeclaration name nameKind <$> mapM h' bs <*> eitherM (mapM (pairM g' g')) g' val) >>= f
149+ f' (ValueDeclaration name nameKind bs val) = (ValueDeclaration name nameKind <$> traverse h' bs <*> eitherM (traverse (pairM g' g')) g' val) >>= f
159− f' (BindingGroupDeclaration ds) = (BindingGroupDeclaration <$> mapM (\(name, nameKind, val) -> (,,) name nameKind <$> g' val) ds) >>= f
150+ f' (BindingGroupDeclaration ds) = (BindingGroupDeclaration <$> traverse (\(name, nameKind, val) -> (,,) name nameKind <$> g' val) ds) >>= f
160− f' (TypeClassDeclaration name args implies ds) = (TypeClassDeclaration name args implies <$> mapM f' ds) >>= f
151+ f' (TypeClassDeclaration name args implies ds) = (TypeClassDeclaration name args implies <$> traverse f' ds) >>= f
161− f' (TypeInstanceDeclaration name cs className args ds) = (TypeInstanceDeclaration name cs className args <$> traverseTypeInstanceBody (mapM f') ds) >>= f
152+ f' (TypeInstanceDeclaration name cs className args ds) = (TypeInstanceDeclaration name cs className args <$> traverseTypeInstanceBody (traverse f') ds) >>= f
162 f' (PositionedDeclaration pos com d) = (PositionedDeclaration pos com <$> f' d) >>= f
153 f' (PositionedDeclaration pos com d) = (PositionedDeclaration pos com <$> f' d) >>= f
163 f' other = f other
154 f' other = f other
164
155
@@ -167,37 +158,37 @@ everywhereOnValuesM f g h = (f', g', h')
167 g' (Parens v) = (Parens <$> g' v) >>= g
158 g' (Parens v) = (Parens <$> g' v) >>= g
168 g' (OperatorSection op (Left v)) = (OperatorSection <$> g' op <*> (Left <$> g' v)) >>= g
159 g' (OperatorSection op (Left v)) = (OperatorSection <$> g' op <*> (Left <$> g' v)) >>= g
169 g' (OperatorSection op (Right v)) = (OperatorSection <$> g' op <*> (Right <$> g' v)) >>= g
160 g' (OperatorSection op (Right v)) = (OperatorSection <$> g' op <*> (Right <$> g' v)) >>= g
170− g' (ArrayLiteral vs) = (ArrayLiteral <$> mapM g' vs) >>= g
161+ g' (ArrayLiteral vs) = (ArrayLiteral <$> traverse g' vs) >>= g
171− g' (ObjectLiteral vs) = (ObjectLiteral <$> mapM (sndM g') vs) >>= g
162+ g' (ObjectLiteral vs) = (ObjectLiteral <$> traverse (sndM g') vs) >>= g
172− g' (ObjectConstructor vs) = (ObjectConstructor <$> mapM (sndM $ maybeM g') vs) >>= g
163+ g' (ObjectConstructor vs) = (ObjectConstructor <$> traverse (sndM $ maybeM g') vs) >>= g
173 g' (TypeClassDictionaryConstructorApp name v) = (TypeClassDictionaryConstructorApp name <$> g' v) >>= g
164 g' (TypeClassDictionaryConstructorApp name v) = (TypeClassDictionaryConstructorApp name <$> g' v) >>= g
174 g' (Accessor prop v) = (Accessor prop <$> g' v) >>= g
165 g' (Accessor prop v) = (Accessor prop <$> g' v) >>= g
175− g' (ObjectUpdate obj vs) = (ObjectUpdate <$> g' obj <*> mapM (sndM g') vs) >>= g
166+ g' (ObjectUpdate obj vs) = (ObjectUpdate <$> g' obj <*> traverse (sndM g') vs) >>= g
176− g' (ObjectUpdater obj vs) = (ObjectUpdater <$> maybeM g' obj <*> mapM (sndM $ maybeM g') vs) >>= g
167+ g' (ObjectUpdater obj vs) = (ObjectUpdater <$> maybeM g' obj <*> traverse (sndM $ maybeM g') vs) >>= g
177 g' (Abs name v) = (Abs name <$> g' v) >>= g
168 g' (Abs name v) = (Abs name <$> g' v) >>= g
178 g' (App v1 v2) = (App <$> g' v1 <*> g' v2) >>= g
169 g' (App v1 v2) = (App <$> g' v1 <*> g' v2) >>= g
179 g' (IfThenElse v1 v2 v3) = (IfThenElse <$> g' v1 <*> g' v2 <*> g' v3) >>= g
170 g' (IfThenElse v1 v2 v3) = (IfThenElse <$> g' v1 <*> g' v2 <*> g' v3) >>= g
180− g' (Case vs alts) = (Case <$> mapM g' vs <*> mapM handleCaseAlternative alts) >>= g
171+ g' (Case vs alts) = (Case <$> traverse g' vs <*> traverse handleCaseAlternative alts) >>= g
181 g' (TypedValue check v ty) = (TypedValue check <$> g' v <*> pure ty) >>= g
172 g' (TypedValue check v ty) = (TypedValue check <$> g' v <*> pure ty) >>= g
182− g' (Let ds v) = (Let <$> mapM f' ds <*> g' v) >>= g
173+ g' (Let ds v) = (Let <$> traverse f' ds <*> g' v) >>= g
183− g' (Do es) = (Do <$> mapM handleDoNotationElement es) >>= g
174+ g' (Do es) = (Do <$> traverse handleDoNotationElement es) >>= g
184 g' (PositionedValue pos com v) = (PositionedValue pos com <$> g' v) >>= g
175 g' (PositionedValue pos com v) = (PositionedValue pos com <$> g' v) >>= g
185 g' other = g other
176 g' other = g other
186
177
187− h' (ConstructorBinder ctor bs) = (ConstructorBinder ctor <$> mapM h' bs) >>= h
178+ h' (ConstructorBinder ctor bs) = (ConstructorBinder ctor <$> traverse h' bs) >>= h
188− h' (ObjectBinder bs) = (ObjectBinder <$> mapM (sndM h') bs) >>= h
179+ h' (ObjectBinder bs) = (ObjectBinder <$> traverse (sndM h') bs) >>= h
189− h' (ArrayBinder bs) = (ArrayBinder <$> mapM h' bs) >>= h
180+ h' (ArrayBinder bs) = (ArrayBinder <$> traverse h' bs) >>= h
190 h' (NamedBinder name b) = (NamedBinder name <$> h' b) >>= h
181 h' (NamedBinder name b) = (NamedBinder name <$> h' b) >>= h
191 h' (PositionedBinder pos com b) = (PositionedBinder pos com <$> h' b) >>= h
182 h' (PositionedBinder pos com b) = (PositionedBinder pos com <$> h' b) >>= h
192 h' (TypedBinder t b) = (TypedBinder t <$> h' b) >>= h
183 h' (TypedBinder t b) = (TypedBinder t <$> h' b) >>= h
193 h' other = h other
184 h' other = h other
194
185
195− handleCaseAlternative (CaseAlternative bs val) = CaseAlternative <$> mapM h' bs
186+ handleCaseAlternative (CaseAlternative bs val) = CaseAlternative <$> traverse h' bs
196− <*> eitherM (mapM (pairM g' g')) g' val
187+ <*> eitherM (traverse (pairM g' g')) g' val
197
188
198 handleDoNotationElement (DoNotationValue v) = DoNotationValue <$> g' v
189 handleDoNotationElement (DoNotationValue v) = DoNotationValue <$> g' v
199 handleDoNotationElement (DoNotationBind b v) = DoNotationBind <$> h' b <*> g' v
190 handleDoNotationElement (DoNotationBind b v) = DoNotationBind <$> h' b <*> g' v
200− handleDoNotationElement (DoNotationLet ds) = DoNotationLet <$> mapM f' ds
191+ handleDoNotationElement (DoNotationLet ds) = DoNotationLet <$> traverse f' ds
201 handleDoNotationElement (PositionedDoNotationElement pos com e) = PositionedDoNotationElement pos com <$> handleDoNotationElement e
192 handleDoNotationElement (PositionedDoNotationElement pos com e) = PositionedDoNotationElement pos com <$> handleDoNotationElement e
202
193
203everythingOnValues :: (r -> r -> r) ->
194everythingOnValues :: (r -> r -> r) ->
@@ -345,11 +336,11 @@ everywhereWithContextOnValuesM s0 f g h i j = (f'' s0, g'' s0, h'' s0, i'' s0, j
345 where
336 where
346 f'' s = uncurry f' <=< f s
337 f'' s = uncurry f' <=< f s
347
338
348− f' s (DataBindingGroupDeclaration ds) = DataBindingGroupDeclaration <$> mapM (f'' s) ds
339+ f' s (DataBindingGroupDeclaration ds) = DataBindingGroupDeclaration <$> traverse (f'' s) ds
349− f' s (ValueDeclaration name nameKind bs val) = ValueDeclaration name nameKind <$> mapM (h'' s) bs <*> eitherM (mapM (pairM (g'' s) (g'' s))) (g'' s) val
340+ f' s (ValueDeclaration name nameKind bs val) = ValueDeclaration name nameKind <$> traverse (h'' s) bs <*> eitherM (traverse (pairM (g'' s) (g'' s))) (g'' s) val
350− f' s (BindingGroupDeclaration ds) = BindingGroupDeclaration <$> mapM (thirdM (g'' s)) ds
341+ f' s (BindingGroupDeclaration ds) = BindingGroupDeclaration <$> traverse (thirdM (g'' s)) ds
351− f' s (TypeClassDeclaration name args implies ds) = TypeClassDeclaration name args implies <$> mapM (f'' s) ds
342+ f' s (TypeClassDeclaration name args implies ds) = TypeClassDeclaration name args implies <$> traverse (f'' s) ds
352− f' s (TypeInstanceDeclaration name cs className args ds) = TypeInstanceDeclaration name cs className args <$> traverseTypeInstanceBody (mapM (f'' s)) ds
343+ f' s (TypeInstanceDeclaration name cs className args ds) = TypeInstanceDeclaration name cs className args <$> traverseTypeInstanceBody (traverse (f'' s)) ds
353 f' s (PositionedDeclaration pos com d1) = PositionedDeclaration pos com <$> f'' s d1
344 f' s (PositionedDeclaration pos com d1) = PositionedDeclaration pos com <$> f'' s d1
354 f' _ other = return other
345 f' _ other = return other
355
346
@@ -360,28 +351,28 @@ everywhereWithContextOnValuesM s0 f g h i j = (f'' s0, g'' s0, h'' s0, i'' s0, j
360 g' s (Parens v) = Parens <$> g'' s v
351 g' s (Parens v) = Parens <$> g'' s v
361 g' s (OperatorSection op (Left v)) = OperatorSection <$> g'' s op <*> (Left <$> g'' s v)
352 g' s (OperatorSection op (Left v)) = OperatorSection <$> g'' s op <*> (Left <$> g'' s v)
362 g' s (OperatorSection op (Right v)) = OperatorSection <$> g'' s op <*> (Right <$> g'' s v)
353 g' s (OperatorSection op (Right v)) = OperatorSection <$> g'' s op <*> (Right <$> g'' s v)
363− g' s (ArrayLiteral vs) = ArrayLiteral <$> mapM (g'' s) vs
354+ g' s (ArrayLiteral vs) = ArrayLiteral <$> traverse (g'' s) vs
364− g' s (ObjectLiteral vs) = ObjectLiteral <$> mapM (sndM (g'' s)) vs
355+ g' s (ObjectLiteral vs) = ObjectLiteral <$> traverse (sndM (g'' s)) vs
365− g' s (ObjectConstructor vs) = ObjectConstructor <$> mapM (sndM $ maybeM (g'' s)) vs
356+ g' s (ObjectConstructor vs) = ObjectConstructor <$> traverse (sndM $ maybeM (g'' s)) vs
366 g' s (TypeClassDictionaryConstructorApp name v) = TypeClassDictionaryConstructorApp name <$> g'' s v
357 g' s (TypeClassDictionaryConstructorApp name v) = TypeClassDictionaryConstructorApp name <$> g'' s v
367 g' s (Accessor prop v) = Accessor prop <$> g'' s v
358 g' s (Accessor prop v) = Accessor prop <$> g'' s v
368− g' s (ObjectUpdate obj vs) = ObjectUpdate <$> g'' s obj <*> mapM (sndM (g'' s)) vs
359+ g' s (ObjectUpdate obj vs) = ObjectUpdate <$> g'' s obj <*> traverse (sndM (g'' s)) vs
369− g' s (ObjectUpdater obj vs) = ObjectUpdater <$> maybeM (g'' s) obj <*> mapM (sndM $ maybeM (g'' s)) vs
360+ g' s (ObjectUpdater obj vs) = ObjectUpdater <$> maybeM (g'' s) obj <*> traverse (sndM $ maybeM (g'' s)) vs
370 g' s (Abs name v) = Abs name <$> g'' s v
361 g' s (Abs name v) = Abs name <$> g'' s v
371 g' s (App v1 v2) = App <$> g'' s v1 <*> g'' s v2
362 g' s (App v1 v2) = App <$> g'' s v1 <*> g'' s v2
372 g' s (IfThenElse v1 v2 v3) = IfThenElse <$> g'' s v1 <*> g'' s v2 <*> g'' s v3
363 g' s (IfThenElse v1 v2 v3) = IfThenElse <$> g'' s v1 <*> g'' s v2 <*> g'' s v3
373− g' s (Case vs alts) = Case <$> mapM (g'' s) vs <*> mapM (i'' s) alts
364+ g' s (Case vs alts) = Case <$> traverse (g'' s) vs <*> traverse (i'' s) alts
374 g' s (TypedValue check v ty) = TypedValue check <$> g'' s v <*> pure ty
365 g' s (TypedValue check v ty) = TypedValue check <$> g'' s v <*> pure ty
375− g' s (Let ds v) = Let <$> mapM (f'' s) ds <*> g'' s v
366+ g' s (Let ds v) = Let <$> traverse (f'' s) ds <*> g'' s v
376− g' s (Do es) = Do <$> mapM (j'' s) es
367+ g' s (Do es) = Do <$> traverse (j'' s) es
377 g' s (PositionedValue pos com v) = PositionedValue pos com <$> g'' s v
368 g' s (PositionedValue pos com v) = PositionedValue pos com <$> g'' s v
378 g' _ other = return other
369 g' _ other = return other
379
370
380 h'' s = uncurry h' <=< h s
371 h'' s = uncurry h' <=< h s
381
372
382− h' s (ConstructorBinder ctor bs) = ConstructorBinder ctor <$> mapM (h'' s) bs
373+ h' s (ConstructorBinder ctor bs) = ConstructorBinder ctor <$> traverse (h'' s) bs
383− h' s (ObjectBinder bs) = ObjectBinder <$> mapM (sndM (h'' s)) bs
374+ h' s (ObjectBinder bs) = ObjectBinder <$> traverse (sndM (h'' s)) bs
384− h' s (ArrayBinder bs) = ArrayBinder <$> mapM (h'' s) bs
375+ h' s (ArrayBinder bs) = ArrayBinder <$> traverse (h'' s) bs
385 h' s (NamedBinder name b) = NamedBinder name <$> h'' s b
376 h' s (NamedBinder name b) = NamedBinder name <$> h'' s b
386 h' s (PositionedBinder pos com b) = PositionedBinder pos com <$> h'' s b
377 h' s (PositionedBinder pos com b) = PositionedBinder pos com <$> h'' s b
387 h' s (TypedBinder t b) = TypedBinder t <$> h'' s b
378 h' s (TypedBinder t b) = TypedBinder t <$> h'' s b
@@ -389,13 +380,13 @@ everywhereWithContextOnValuesM s0 f g h i j = (f'' s0, g'' s0, h'' s0, i'' s0, j
389
380
390 i'' s = uncurry i' <=< i s
381 i'' s = uncurry i' <=< i s
391
382
392− i' s (CaseAlternative bs val) = CaseAlternative <$> mapM (h'' s) bs <*> eitherM (mapM (pairM (g'' s) (g'' s))) (g'' s) val
383+ i' s (CaseAlternative bs val) = CaseAlternative <$> traverse (h'' s) bs <*> eitherM (traverse (pairM (g'' s) (g'' s))) (g'' s) val
393
384
394 j'' s = uncurry j' <=< j s
385 j'' s = uncurry j' <=< j s
395
386
396 j' s (DoNotationValue v) = DoNotationValue <$> g'' s v
387 j' s (DoNotationValue v) = DoNotationValue <$> g'' s v
397 j' s (DoNotationBind b v) = DoNotationBind <$> h'' s b <*> g'' s v
388 j' s (DoNotationBind b v) = DoNotationBind <$> h'' s b <*> g'' s v
398− j' s (DoNotationLet ds) = DoNotationLet <$> mapM (f'' s) ds
389+ j' s (DoNotationLet ds) = DoNotationLet <$> traverse (f'' s) ds
399 j' s (PositionedDoNotationElement pos com e1) = PositionedDoNotationElement pos com <$> j'' s e1
390 j' s (PositionedDoNotationElement pos com e1) = PositionedDoNotationElement pos com <$> j'' s e1
400
391
401accumTypes :: (Monoid r) => (Type -> r) -> (Declaration -> r, Expr -> r, Binder -> r, CaseAlternative -> r, DoNotationElement -> r)
392accumTypes :: (Monoid r) => (Type -> r) -> (Declaration -> r, Expr -> r, Binder -> r, CaseAlternative -> r, DoNotationElement -> r)
src/Language/PureScript/Bundle.hs+6−7
@@ -20,7 +20,6 @@
20{-# LANGUAGE ScopedTypeVariables #-}
20{-# LANGUAGE ScopedTypeVariables #-}
21{-# LANGUAGE TupleSections #-}
21{-# LANGUAGE TupleSections #-}
22{-# LANGUAGE RecordWildCards #-}
22{-# LANGUAGE RecordWildCards #-}
23−{-# LANGUAGE CPP #-}
24
23
25module Language.PureScript.Bundle (
24module Language.PureScript.Bundle (
26 bundle
25 bundle
@@ -31,6 +30,9 @@ module Language.PureScript.Bundle (
31 , printErrorMessage
30 , printErrorMessage
32) where
31) where
33
32
33+import Prelude ()
34+import Prelude.Compat
35+
34import Data.List (nub)
36import Data.List (nub)
35import Data.Maybe (mapMaybe, catMaybes)
37import Data.Maybe (mapMaybe, catMaybes)
36import Data.Generics (everything, everywhere, mkQ, mkT)
38import Data.Generics (everything, everywhere, mkQ, mkT)
@@ -39,9 +41,6 @@ import Data.Version (showVersion)
39
41
40import qualified Data.Set as S
42import qualified Data.Set as S
41
43
42−#if __GLASGOW_HASKELL__ < 710
43−import Control.Applicative
44−#endif
45import Control.Monad
44import Control.Monad
46import Control.Monad.Error.Class
45import Control.Monad.Error.Class
47import Language.JavaScript.Parser
46import Language.JavaScript.Parser
@@ -212,7 +211,7 @@ withDeps (Module modulePath es) = Module modulePath (map expandDeps es)
212-- Other constructor.
211-- Other constructor.
213toModule :: forall m. (Applicative m, MonadError ErrorMessage m) => S.Set String -> ModuleIdentifier -> JSNode -> m Module
212toModule :: forall m. (Applicative m, MonadError ErrorMessage m) => S.Set String -> ModuleIdentifier -> JSNode -> m Module
214toModule mids mid top
213toModule mids mid top
215− | JSSourceElementsTop ns <- node top = Module mid <$> mapM toModuleElement ns
214+ | JSSourceElementsTop ns <- node top = Module mid <$> traverse toModuleElement ns
216 | otherwise = err InvalidTopLevel
215 | otherwise = err InvalidTopLevel
217 where
216 where
218 err = throwError . ErrorInModule mid
217 err = throwError . ErrorInModule mid
@@ -262,7 +261,7 @@ toModule mids mid top
262 , JSOperator eq <- node op
261 , JSOperator eq <- node op
263 , JSLiteral "=" <- node eq
262 , JSLiteral "=" <- node eq
264 , JSObjectLiteral _ props _ <- node obj
263 , JSObjectLiteral _ props _ <- node obj
265− = ExportsList <$> mapM toExport (filter (not . isSeparator) (map node props))
264+ = ExportsList <$> traverse toExport (filter (not . isSeparator) (map node props))
266 where
265 where
267 toExport :: Node -> m (ExportType, String, JSNode, [Key])
266 toExport :: Node -> m (ExportType, String, JSNode, [Key])
268 toExport (JSPropertyNameandValue name _ [val] ) =
267 toExport (JSPropertyNameandValue name _ [val] ) =
@@ -544,7 +543,7 @@ bundle inputStrs entryPoints mainModule namespace = do
544
543
545 let mids = S.fromList (map (moduleName . fst) input)
544 let mids = S.fromList (map (moduleName . fst) input)
546
545
547− modules <- mapM (fmap withDeps . uncurry (toModule mids)) input
546+ modules <- traverse (fmap withDeps . uncurry (toModule mids)) input
548
547
549 let compiled = compile modules entryPoints
548 let compiled = compile modules entryPoints
550 sorted = sortModules (filter (not . isModuleEmpty) compiled)
549 sorted = sortModules (filter (not . isModuleEmpty) compiled)
src/Language/PureScript/CodeGen/JS.hs+3−4
@@ -17,7 +17,6 @@
17{-# LANGUAGE ViewPatterns #-}
17{-# LANGUAGE ViewPatterns #-}
18{-# LANGUAGE FlexibleContexts #-}
18{-# LANGUAGE FlexibleContexts #-}
19{-# LANGUAGE ScopedTypeVariables #-}
19{-# LANGUAGE ScopedTypeVariables #-}
20−{-# LANGUAGE CPP #-}
21
20
22module Language.PureScript.CodeGen.JS
21module Language.PureScript.CodeGen.JS
23 ( module AST
22 ( module AST
@@ -26,13 +25,13 @@ module Language.PureScript.CodeGen.JS
26 , mainCall
25 , mainCall
27 ) where
26 ) where
28
27
28+import Prelude ()
29+import Prelude.Compat
30+
29import Data.List ((\\), delete, intersect)
31import Data.List ((\\), delete, intersect)
30import Data.Maybe (isNothing)
32import Data.Maybe (isNothing)
31import qualified Data.Traversable as T (traverse)
33import qualified Data.Traversable as T (traverse)
32
34
33−#if __GLASGOW_HASKELL__ < 710
34−import Control.Applicative
35−#endif
36import Control.Arrow ((&&&))
35import Control.Arrow ((&&&))
37import Control.Monad (replicateM, forM)
36import Control.Monad (replicateM, forM)
38import Control.Monad.Reader (MonadReader, asks)
37import Control.Monad.Reader (MonadReader, asks)
src/Language/PureScript/CodeGen/JS/AST.hs+3−7
@@ -14,18 +14,14 @@
14-----------------------------------------------------------------------------
14-----------------------------------------------------------------------------
15
15
16{-# LANGUAGE DeriveDataTypeable #-}
16{-# LANGUAGE DeriveDataTypeable #-}
17−{-# LANGUAGE CPP #-}
18
17
19module Language.PureScript.CodeGen.JS.AST where
18module Language.PureScript.CodeGen.JS.AST where
20
19
21−#if __GLASGOW_HASKELL__ < 710
20+import Prelude ()
22−import Control.Applicative (Applicative, (<$>), (<*>))
21+import Prelude.Compat
23−#endif
22+
24import Control.Monad.Identity
23import Control.Monad.Identity
25import Data.Data
24import Data.Data
26−#if __GLASGOW_HASKELL__ < 710
27−import Data.Traversable (traverse)
28−#endif
29
25
30import Language.PureScript.Comments
26import Language.PureScript.Comments
31import Language.PureScript.Traversals
27import Language.PureScript.Traversals
src/Language/PureScript/CodeGen/JS/Optimizer.hs+3−4
@@ -32,15 +32,14 @@
32-----------------------------------------------------------------------------
32-----------------------------------------------------------------------------
33
33
34{-# LANGUAGE FlexibleContexts #-}
34{-# LANGUAGE FlexibleContexts #-}
35−{-# LANGUAGE CPP #-}
36
35
37module Language.PureScript.CodeGen.JS.Optimizer (
36module Language.PureScript.CodeGen.JS.Optimizer (
38 optimize
37 optimize
39) where
38) where
40
39
41−#if __GLASGOW_HASKELL__ < 710
40+import Prelude ()
42−import Control.Applicative (Applicative)
41+import Prelude.Compat
43−#endif
42+
44import Control.Monad.Reader (MonadReader, ask, asks)
43import Control.Monad.Reader (MonadReader, ask, asks)
45import Control.Monad.Supply.Class (MonadSupply)
44import Control.Monad.Supply.Class (MonadSupply)
46
45
src/Language/PureScript/CodeGen/JS/Optimizer/Inliner.hs+3−5
@@ -13,8 +13,6 @@
13--
13--
14-----------------------------------------------------------------------------
14-----------------------------------------------------------------------------
15
15
16−{-# LANGUAGE CPP #-}
17−
18module Language.PureScript.CodeGen.JS.Optimizer.Inliner (
16module Language.PureScript.CodeGen.JS.Optimizer.Inliner (
19 inlineVariables,
17 inlineVariables,
20 inlineValues,
18 inlineValues,
@@ -26,9 +24,9 @@ module Language.PureScript.CodeGen.JS.Optimizer.Inliner (
26 evaluateIifes
24 evaluateIifes
27) where
25) where
28
26
29−#if __GLASGOW_HASKELL__ < 710
27+import Prelude ()
30−import Control.Applicative (Applicative)
28+import Prelude.Compat
31−#endif
29+
32import Control.Monad.Supply.Class (MonadSupply, freshName)
30import Control.Monad.Supply.Class (MonadSupply, freshName)
33import Data.Maybe (fromMaybe)
31import Data.Maybe (fromMaybe)
34
32
src/Language/PureScript/Docs/ParseAndDesugar.hs+6−7
@@ -1,17 +1,16 @@
1{-# LANGUAGE TupleSections #-}
1{-# LANGUAGE TupleSections #-}
2−{-# LANGUAGE CPP #-}
3
2
4module Language.PureScript.Docs.ParseAndDesugar
3module Language.PureScript.Docs.ParseAndDesugar
5 ( parseAndDesugar
4 ( parseAndDesugar
6 , ParseDesugarError(..)
5 , ParseDesugarError(..)
7 ) where
6 ) where
8
7
8+import Prelude ()
9+import Prelude.Compat
10+
9import qualified Data.Map as M
11import qualified Data.Map as M
10import Control.Arrow (first)
12import Control.Arrow (first)
11import Control.Monad
13import Control.Monad
12−#if __GLASGOW_HASKELL__ < 710
13−import Control.Applicative
14−#endif
15
14
16import Control.Monad.Trans.Except
15import Control.Monad.Trans.Except
17import Control.Monad.Writer.Strict (runWriterT)
16import Control.Monad.Writer.Strict (runWriterT)
@@ -53,8 +52,8 @@ parseAndDesugar ::
53 -> ([Bookmark] -> [P.Module] -> IO a)
52 -> ([Bookmark] -> [P.Module] -> IO a)
54 -> IO (Either ParseDesugarError a)
53 -> IO (Either ParseDesugarError a)
55parseAndDesugar inputFiles depsFiles callback = do
54parseAndDesugar inputFiles depsFiles callback = do
56− inputFiles' <- mapM (parseAs Local) inputFiles
55+ inputFiles' <- traverse (parseAs Local) inputFiles
57− depsFiles' <- mapM (\(pkgName, f) -> parseAs (FromDep pkgName) f) depsFiles
56+ depsFiles' <- traverse (\(pkgName, f) -> parseAs (FromDep pkgName) f) depsFiles
58
57
59 runExceptT $ do
58 runExceptT $ do
60 ms <- parseFiles (inputFiles' ++ depsFiles')
59 ms <- parseFiles (inputFiles' ++ depsFiles')
@@ -122,7 +121,7 @@ desugar :: [P.Module] -> Either P.MultipleErrors [P.Module]
122desugar = P.evalSupplyT 0 . desugar'
121desugar = P.evalSupplyT 0 . desugar'
123 where
122 where
124 desugar' :: [P.Module] -> P.SupplyT (Either P.MultipleErrors) [P.Module]
123 desugar' :: [P.Module] -> P.SupplyT (Either P.MultipleErrors) [P.Module]
125− desugar' = mapM P.desugarDoModule >=> P.desugarCasesModule >=> ignoreWarnings . P.desugarImports []
124+ desugar' = traverse P.desugarDoModule >=> P.desugarCasesModule >=> ignoreWarnings . P.desugarImports []
126 ignoreWarnings m = liftM fst (runWriterT m)
125 ignoreWarnings m = liftM fst (runWriterT m)
127
126
128parseFile :: FilePath -> IO (FilePath, String)
127parseFile :: FilePath -> IO (FilePath, String)
src/Language/PureScript/Docs/RenderedCode/Render.hs+3−6
@@ -1,5 +1,3 @@
1−{-# LANGUAGE CPP #-}
2−
3-- | Functions for producing RenderedCode values from PureScript Type values.
1-- | Functions for producing RenderedCode values from PureScript Type values.
4
2
5module Language.PureScript.Docs.RenderedCode.Render (
3module Language.PureScript.Docs.RenderedCode.Render (
@@ -11,12 +9,11 @@ module Language.PureScript.Docs.RenderedCode.Render (
11 defaultRenderTypeOptions,
9 defaultRenderTypeOptions,
12 renderTypeWithOptions
10 renderTypeWithOptions
13) where
11) where
12+
13+import Prelude ()
14+import Prelude.Compat
14
15
15−#if __GLASGOW_HASKELL__ < 710
16−import Data.Monoid ((<>), mconcat, mempty)
17−#else
18import Data.Monoid ((<>))
16import Data.Monoid ((<>))
19−#endif
20import Data.Maybe (fromMaybe)
17import Data.Maybe (fromMaybe)
21
18
22import Control.Arrow ((<+>))
19import Control.Arrow ((<+>))
src/Language/PureScript/Docs/RenderedCode/Types.hs+3−6
@@ -1,6 +1,5 @@
1{-# LANGUAGE GeneralizedNewtypeDeriving #-}
1{-# LANGUAGE GeneralizedNewtypeDeriving #-}
2{-# LANGUAGE OverloadedStrings #-}
2{-# LANGUAGE OverloadedStrings #-}
3−{-# LANGUAGE CPP #-}
4
3
5-- | Data types and functions for representing a simplified form of PureScript
4-- | Data types and functions for representing a simplified form of PureScript
6-- code, intended for use in e.g. HTML documentation.
5-- code, intended for use in e.g. HTML documentation.
@@ -31,11 +30,9 @@ module Language.PureScript.Docs.RenderedCode.Types
31 , keywordWhere
30 , keywordWhere
32 ) where
31 ) where
33
32
34−#if __GLASGOW_HASKELL__ < 710
33+import Prelude ()
35−import Control.Applicative ((<$>), (<*>), (*>), pure)
34+import Prelude.Compat
36−import Data.Foldable
35+
37−import Data.Monoid
38−#endif
39import qualified Data.Aeson as A
36import qualified Data.Aeson as A
40import Data.Aeson.BetterErrors
37import Data.Aeson.BetterErrors
41import Control.Monad.Error.Class (MonadError(..))
38import Control.Monad.Error.Class (MonadError(..))
src/Language/PureScript/Docs/Types.hs+3−4
@@ -2,7 +2,6 @@
2{-# LANGUAGE OverloadedStrings #-}
2{-# LANGUAGE OverloadedStrings #-}
3{-# LANGUAGE TupleSections #-}
3{-# LANGUAGE TupleSections #-}
4{-# LANGUAGE RankNTypes #-}
4{-# LANGUAGE RankNTypes #-}
5−{-# LANGUAGE CPP #-}
6
5
7module Language.PureScript.Docs.Types
6module Language.PureScript.Docs.Types
8 ( module Language.PureScript.Docs.Types
7 ( module Language.PureScript.Docs.Types
@@ -10,10 +9,10 @@ module Language.PureScript.Docs.Types
10 )
9 )
11 where
10 where
12
11
12+import Prelude ()
13+import Prelude.Compat
14+
13import Control.Arrow (first, (***))
15import Control.Arrow (first, (***))
14−#if __GLASGOW_HASKELL__ < 710
15−import Control.Applicative ((<$>), (<$), (<*>), pure)
16−#endif
17import Control.Monad (when)
16import Control.Monad (when)
18import Data.Maybe (mapMaybe)
17import Data.Maybe (mapMaybe)
19import Data.Version
18import Data.Version
src/Language/PureScript/Errors.hs+3−9
@@ -15,19 +15,16 @@
15{-# LANGUAGE GeneralizedNewtypeDeriving #-}
15{-# LANGUAGE GeneralizedNewtypeDeriving #-}
16{-# LANGUAGE FlexibleContexts #-}
16{-# LANGUAGE FlexibleContexts #-}
17{-# LANGUAGE MultiParamTypeClasses #-}
17{-# LANGUAGE MultiParamTypeClasses #-}
18−{-# LANGUAGE CPP #-}
19
18
20module Language.PureScript.Errors where
19module Language.PureScript.Errors where
21
20
21+import Prelude ()
22+import Prelude.Compat
23+
22import Data.Either (lefts, rights)
24import Data.Either (lefts, rights)
23import Data.List (intercalate, transpose, nub, nubBy)
25import Data.List (intercalate, transpose, nub, nubBy)
24import Data.Function (on)
26import Data.Function (on)
25−#if __GLASGOW_HASKELL__ < 710
26−import Data.Foldable (fold, foldMap)
27−import Data.Traversable (traverse)
28−#else
29import Data.Foldable (fold)
27import Data.Foldable (fold)
30−#endif
31
28
32import qualified Data.Map as M
29import qualified Data.Map as M
33
30
@@ -35,9 +32,6 @@ import Control.Monad
35import Control.Monad.Unify
32import Control.Monad.Unify
36import Control.Monad.Writer
33import Control.Monad.Writer
37import Control.Monad.Error.Class (MonadError(..))
34import Control.Monad.Error.Class (MonadError(..))
38−#if __GLASGOW_HASKELL__ < 710
39−import Control.Applicative ((<$>), (<*>), Applicative, pure)
40−#endif
41import Control.Monad.Trans.State.Lazy
35import Control.Monad.Trans.State.Lazy
42import Control.Arrow(first)
36import Control.Arrow(first)
43
37
src/Language/PureScript/Externs.hs+3−4
@@ -13,7 +13,6 @@
13--
13--
14-----------------------------------------------------------------------------
14-----------------------------------------------------------------------------
15
15
16−{-# LANGUAGE CPP #-}
17{-# LANGUAGE RecordWildCards #-}
16{-# LANGUAGE RecordWildCards #-}
18{-# LANGUAGE PatternGuards #-}
17{-# LANGUAGE PatternGuards #-}
19{-# LANGUAGE TemplateHaskell #-}
18{-# LANGUAGE TemplateHaskell #-}
@@ -27,13 +26,13 @@ module Language.PureScript.Externs
27 , applyExternsFileToEnvironment
26 , applyExternsFileToEnvironment
28 ) where
27 ) where
29
28
29+import Prelude ()
30+import Prelude.Compat
31+
30import Data.List (find, foldl')
32import Data.List (find, foldl')
31import Data.Maybe (mapMaybe, maybeToList, fromMaybe)
33import Data.Maybe (mapMaybe, maybeToList, fromMaybe)
32import Data.Foldable (fold)
34import Data.Foldable (fold)
33import Data.Version (showVersion)
35import Data.Version (showVersion)
34−#if __GLASGOW_HASKELL__ < 710
35−import Data.Monoid
36−#endif
37import Data.Aeson.TH
36import Data.Aeson.TH
38
37
39import qualified Data.Map as M
38import qualified Data.Map as M
src/Language/PureScript/Kinds.hs+3−4
@@ -14,16 +14,15 @@
14
14
15{-# LANGUAGE DeriveDataTypeable #-}
15{-# LANGUAGE DeriveDataTypeable #-}
16{-# LANGUAGE TemplateHaskell #-}
16{-# LANGUAGE TemplateHaskell #-}
17−{-# LANGUAGE CPP #-}
18
17
19module Language.PureScript.Kinds where
18module Language.PureScript.Kinds where
20
19
20+import Prelude ()
21+import Prelude.Compat
22+
21import Data.Data
23import Data.Data
22import qualified Data.Aeson.TH as A
24import qualified Data.Aeson.TH as A
23
25
24−#if __GLASGOW_HASKELL__ < 710
25−import Control.Applicative
26−#endif
27import Control.Monad.Unify (Unknown)
26import Control.Monad.Unify (Unknown)
28
27
29-- |
28-- |
src/Language/PureScript/Linter.hs+3−4
@@ -15,19 +15,18 @@
15{-# LANGUAGE GeneralizedNewtypeDeriving #-}
15{-# LANGUAGE GeneralizedNewtypeDeriving #-}
16{-# LANGUAGE FlexibleContexts #-}
16{-# LANGUAGE FlexibleContexts #-}
17{-# LANGUAGE ScopedTypeVariables #-}
17{-# LANGUAGE ScopedTypeVariables #-}
18−{-# LANGUAGE CPP #-}
19
18
20module Language.PureScript.Linter (lint, module L) where
19module Language.PureScript.Linter (lint, module L) where
21
20
21+import Prelude ()
22+import Prelude.Compat
23+
22import Data.List (mapAccumL, nub, (\\))
24import Data.List (mapAccumL, nub, (\\))
23import Data.Maybe (mapMaybe)
25import Data.Maybe (mapMaybe)
24import Data.Monoid
26import Data.Monoid
25
27
26import qualified Data.Set as S
28import qualified Data.Set as S
27
29
28−#if __GLASGOW_HASKELL__ < 710
29−import Control.Applicative
30−#endif
31import Control.Monad.Writer.Class
30import Control.Monad.Writer.Class
32
31
33import Language.PureScript.Crash
32import Language.PureScript.Crash
src/Language/PureScript/Linter/Exhaustive.hs+3−4
@@ -18,20 +18,19 @@
18
18
19{-# LANGUAGE FlexibleContexts #-}
19{-# LANGUAGE FlexibleContexts #-}
20{-# LANGUAGE ScopedTypeVariables #-}
20{-# LANGUAGE ScopedTypeVariables #-}
21−{-# LANGUAGE CPP #-}
22
21
23module Language.PureScript.Linter.Exhaustive
22module Language.PureScript.Linter.Exhaustive
24 ( checkExhaustive
23 ( checkExhaustive
25 , checkExhaustiveModule
24 , checkExhaustiveModule
26 ) where
25 ) where
27
26
27+import Prelude ()
28+import Prelude.Compat
29+
28import qualified Data.Map as M
30import qualified Data.Map as M
29import Data.Maybe (fromMaybe)
31import Data.Maybe (fromMaybe)
30import Data.List (foldl', sortBy, nub)
32import Data.List (foldl', sortBy, nub)
31import Data.Function (on)
33import Data.Function (on)
32−#if __GLASGOW_HASKELL__ < 710
33−import Data.Traversable (sequenceA)
34−#endif
35
34
36import Control.Monad (unless)
35import Control.Monad (unless)
37import Control.Applicative
36import Control.Applicative
src/Language/PureScript/Linter/Imports.hs+3−4
@@ -1,18 +1,17 @@
1{-# LANGUAGE ScopedTypeVariables #-}
1{-# LANGUAGE ScopedTypeVariables #-}
2{-# LANGUAGE FlexibleContexts #-}
2{-# LANGUAGE FlexibleContexts #-}
3−{-# LANGUAGE CPP #-}
4
3
5module Language.PureScript.Linter.Imports (findUnusedImports, Name(..), UsedImports()) where
4module Language.PureScript.Linter.Imports (findUnusedImports, Name(..), UsedImports()) where
6
5
6+import Prelude ()
7+import Prelude.Compat
8+
7import qualified Data.Map as M
9import qualified Data.Map as M
8import Data.Maybe (mapMaybe)
10import Data.Maybe (mapMaybe)
9import Data.List ((\\), find)
11import Data.List ((\\), find)
10import Control.Monad.Error.Class (MonadError(..))
12import Control.Monad.Error.Class (MonadError(..))
11import Control.Monad.Writer.Class
13import Control.Monad.Writer.Class
12import Control.Monad(unless,when)
14import Control.Monad(unless,when)
13−#if __GLASGOW_HASKELL__ < 710
14−import Control.Applicative
15−#endif
16import Data.Foldable (forM_)
15import Data.Foldable (forM_)
17
16
18import Language.PureScript.AST.Declarations
17import Language.PureScript.AST.Declarations
src/Language/PureScript/Make.hs+9−12
@@ -21,7 +21,6 @@
21{-# LANGUAGE ScopedTypeVariables #-}
21{-# LANGUAGE ScopedTypeVariables #-}
22{-# LANGUAGE MultiParamTypeClasses #-}
22{-# LANGUAGE MultiParamTypeClasses #-}
23{-# LANGUAGE TypeFamilies #-}
23{-# LANGUAGE TypeFamilies #-}
24−{-# LANGUAGE CPP #-}
25
24
26module Language.PureScript.Make
25module Language.PureScript.Make
27 (
26 (
@@ -38,14 +37,16 @@ module Language.PureScript.Make
38 , buildMakeActions
37 , buildMakeActions
39 ) where
38 ) where
40
39
41−#if __GLASGOW_HASKELL__ < 710
40+import Prelude ()
42−import Control.Applicative
41+import Prelude.Compat
43−#endif
42+
44−import Control.Monad
43+import Control.Monad hiding (sequence)
45import Control.Monad.Error.Class (MonadError(..))
44import Control.Monad.Error.Class (MonadError(..))
46import Control.Monad.Writer.Class (MonadWriter(..))
45import Control.Monad.Writer.Class (MonadWriter(..))
46+import Control.Monad.Trans.Class (MonadTrans(..))
47import Control.Monad.Trans.Except
47import Control.Monad.Trans.Except
48−import Control.Monad.Reader
48+import Control.Monad.IO.Class
49+import Control.Monad.Reader (MonadReader(..), ReaderT(..))
49import Control.Monad.Logger
50import Control.Monad.Logger
50import Control.Monad.Supply
51import Control.Monad.Supply
51import Control.Monad.Base (MonadBase(..))
52import Control.Monad.Base (MonadBase(..))
@@ -58,10 +59,6 @@ import Data.Maybe (fromMaybe, catMaybes)
58import Data.Time.Clock
59import Data.Time.Clock
59import Data.String (fromString)
60import Data.String (fromString)
60import Data.Foldable (for_)
61import Data.Foldable (for_)
61−#if __GLASGOW_HASKELL__ < 710
62−import Data.Monoid (mempty, mconcat)
63−import Data.Traversable (traverse)
64−#endif
65import Data.Traversable (for)
62import Data.Traversable (for)
66import Data.Version (showVersion)
63import Data.Version (showVersion)
67import Data.Aeson (encode, decode)
64import Data.Aeson (encode, decode)
@@ -207,12 +204,12 @@ make MakeActions{..} ms = do
207 -- We need to wait for dependencies to be built, before checking if the current
204 -- We need to wait for dependencies to be built, before checking if the current
208 -- module should be rebuilt, so the first thing to do is to wait on the
205 -- module should be rebuilt, so the first thing to do is to wait on the
209 -- MVars for the module's dependencies.
206 -- MVars for the module's dependencies.
210− mexterns <- fmap unzip . sequence <$> mapM (readMVar . fst . fromMaybe (internalError "make: no barrier") . flip lookup barriers) deps
207+ mexterns <- fmap unzip . sequence <$> traverse (readMVar . fst . fromMaybe (internalError "make: no barrier") . flip lookup barriers) deps
211
208
212 case mexterns of
209 case mexterns of
213 Just (_, externs) -> do
210 Just (_, externs) -> do
214 outputTimestamp <- getOutputTimestamp moduleName
211 outputTimestamp <- getOutputTimestamp moduleName
215− dependencyTimestamp <- maximumMaybe <$> mapM (fmap shouldExist . getOutputTimestamp) deps
212+ dependencyTimestamp <- maximumMaybe <$> traverse (fmap shouldExist . getOutputTimestamp) deps
216 inputTimestamp <- getInputTimestamp moduleName
213 inputTimestamp <- getInputTimestamp moduleName
217
214
218 let shouldRebuild = case (inputTimestamp, dependencyTimestamp, outputTimestamp) of
215 let shouldRebuild = case (inputTimestamp, dependencyTimestamp, outputTimestamp) of
src/Language/PureScript/Parser/JS.hs+3−5
@@ -13,16 +13,15 @@
13-----------------------------------------------------------------------------
13-----------------------------------------------------------------------------
14
14
15{-# LANGUAGE FlexibleContexts #-}
15{-# LANGUAGE FlexibleContexts #-}
16−{-# LANGUAGE CPP #-}
17
16
18module Language.PureScript.Parser.JS
17module Language.PureScript.Parser.JS
19 ( ForeignJS()
18 ( ForeignJS()
20 , parseForeignModulesFromFiles
19 , parseForeignModulesFromFiles
21 ) where
20 ) where
22
21
23−#if __GLASGOW_HASKELL__ < 710
22+import Prelude ()
24−import Control.Applicative ((*>), (<*))
23+import Prelude.Compat hiding (lex)
25−#endif
24+
26import Control.Monad (forM_, when, msum)
25import Control.Monad (forM_, when, msum)
27import Control.Monad.Error.Class (MonadError(..))
26import Control.Monad.Error.Class (MonadError(..))
28import Control.Monad.Writer.Class (MonadWriter(..))
27import Control.Monad.Writer.Class (MonadWriter(..))
@@ -32,7 +31,6 @@ import Language.PureScript.Errors
32import Language.PureScript.Names
31import Language.PureScript.Names
33import Language.PureScript.Parser.Common
32import Language.PureScript.Parser.Common
34import Language.PureScript.Parser.Lexer
33import Language.PureScript.Parser.Lexer
35−import Prelude hiding (lex)
36import qualified Data.Map as M
34import qualified Data.Map as M
37import qualified Text.Parsec as PS
35import qualified Text.Parsec as PS
38
36
src/Language/PureScript/Parser/Kinds.hs+3−5
@@ -13,18 +13,16 @@
13--
13--
14-----------------------------------------------------------------------------
14-----------------------------------------------------------------------------
15
15
16−{-# LANGUAGE CPP #-}
17−
18module Language.PureScript.Parser.Kinds (
16module Language.PureScript.Parser.Kinds (
19 parseKind
17 parseKind
20) where
18) where
21
19
20+import Prelude ()
21+import Prelude.Compat
22+
22import Language.PureScript.Kinds
23import Language.PureScript.Kinds
23import Language.PureScript.Parser.Common
24import Language.PureScript.Parser.Common
24import Language.PureScript.Parser.Lexer
25import Language.PureScript.Parser.Lexer
25−#if __GLASGOW_HASKELL__ < 710
26−import Control.Applicative
27−#endif
28import qualified Text.Parsec as P
26import qualified Text.Parsec as P
29import qualified Text.Parsec.Expr as P
27import qualified Text.Parsec.Expr as P
30
28
src/Language/PureScript/Pretty/JS.hs+6−8
@@ -13,20 +13,18 @@
13--
13--
14-----------------------------------------------------------------------------
14-----------------------------------------------------------------------------
15
15
16−{-# LANGUAGE CPP #-}
17−
18module Language.PureScript.Pretty.JS (
16module Language.PureScript.Pretty.JS (
19 prettyPrintJS
17 prettyPrintJS
20) where
18) where
21
19
22−import Data.List
20+import Prelude ()
21+import Prelude.Compat
22+
23+import Data.List hiding (concat, concatMap)
23import Data.Maybe (fromMaybe)
24import Data.Maybe (fromMaybe)
24
25
25−#if __GLASGOW_HASKELL__ < 710
26−import Control.Applicative
27−#endif
28import Control.Arrow ((<+>))
26import Control.Arrow ((<+>))
29−import Control.Monad.State
27+import Control.Monad.State hiding (sequence)
30import Control.PatternArrows
28import Control.PatternArrows
31import qualified Control.Arrow as A
29import qualified Control.Arrow as A
32
30
@@ -199,7 +197,7 @@ app :: Pattern PrinterState JS (String, JS)
199app = mkPattern' match
197app = mkPattern' match
200 where
198 where
201 match (JSApp val args) = do
199 match (JSApp val args) = do
202− jss <- mapM prettyPrintJS' args
200+ jss <- traverse prettyPrintJS' args
203 return (intercalate ", " jss, val)
201 return (intercalate ", " jss, val)
204 match _ = mzero
202 match _ = mzero
205
203
src/Language/PureScript/Pretty/Values.hs−2
@@ -13,8 +13,6 @@
13--
13--
14-----------------------------------------------------------------------------
14-----------------------------------------------------------------------------
15
15
16−{-# LANGUAGE CPP #-}
17−
18module Language.PureScript.Pretty.Values (
16module Language.PureScript.Pretty.Values (
19 prettyPrintValue,
17 prettyPrintValue,
20 prettyPrintBinder,
18 prettyPrintBinder,
src/Language/PureScript/Publish.hs+6−8
@@ -2,7 +2,6 @@
2{-# LANGUAGE RecordWildCards #-}
2{-# LANGUAGE RecordWildCards #-}
3{-# LANGUAGE TupleSections #-}
3{-# LANGUAGE TupleSections #-}
4{-# LANGUAGE GeneralizedNewtypeDeriving #-}
4{-# LANGUAGE GeneralizedNewtypeDeriving #-}
5−{-# LANGUAGE CPP #-}
6
5
7module Language.PureScript.Publish
6module Language.PureScript.Publish
8 ( preparePackage
7 ( preparePackage
@@ -19,7 +18,8 @@ module Language.PureScript.Publish
19 , getResolvedDependencies
18 , getResolvedDependencies
20 ) where
19 ) where
21
20
22−import Prelude hiding (userError)
21+import Prelude ()
22+import Prelude.Compat hiding (userError)
23
23
24import Data.Maybe
24import Data.Maybe
25import Data.Char (isSpace)
25import Data.Char (isSpace)
@@ -28,15 +28,13 @@ import Data.List.Split (splitOn)
28import Data.List.NonEmpty (NonEmpty(..))
28import Data.List.NonEmpty (NonEmpty(..))
29import Data.Version
29import Data.Version
30import Data.Function (on)
30import Data.Function (on)
31+import Data.Foldable (traverse_)
31import Safe (headMay)
32import Safe (headMay)
32import Data.Aeson.BetterErrors
33import Data.Aeson.BetterErrors
33import qualified Data.Text as T
34import qualified Data.Text as T
34import qualified Data.Text.Lazy as TL
35import qualified Data.Text.Lazy as TL
35import qualified Data.Text.Lazy.Encoding as TL
36import qualified Data.Text.Lazy.Encoding as TL
36
37
37−#if __GLASGOW_HASKELL__ < 710
38−import Control.Applicative
39−#endif
40import Control.Category ((>>>))
38import Control.Category ((>>>))
41import Control.Arrow ((***))
39import Control.Arrow ((***))
42import Control.Exception (catch, try)
40import Control.Exception (catch, try)
@@ -304,7 +302,7 @@ asDependencyStatus = do
304
302
305warnUndeclared :: [PackageName] -> [PackageName] -> PrepareM ()
303warnUndeclared :: [PackageName] -> [PackageName] -> PrepareM ()
306warnUndeclared declared actual =
304warnUndeclared declared actual =
307− mapM_ (warn . UndeclaredDependency) (actual \\ declared)
305+ traverse_ (warn . UndeclaredDependency) (actual \\ declared)
308
306
309handleDeps ::
307handleDeps ::
310 [(PackageName, DependencyStatus)] -> PrepareM [(PackageName, Version)]
308 [(PackageName, DependencyStatus)] -> PrepareM [(PackageName, Version)]
@@ -314,8 +312,8 @@ handleDeps deps = do
314 (x:xs) ->
312 (x:xs) ->
315 userError (MissingDependencies (x :| xs))
313 userError (MissingDependencies (x :| xs))
316 [] -> do
314 [] -> do
317− mapM_ (warn . NoResolvedVersion) noVersion
315+ traverse_ (warn . NoResolvedVersion) noVersion
318− withVersions <- catMaybes <$> mapM tryExtractVersion' installed
316+ withVersions <- catMaybes <$> traverse tryExtractVersion' installed
319 filterM (liftIO . isPureScript . bowerDir . fst) withVersions
317 filterM (liftIO . isPureScript . bowerDir . fst) withVersions
320
318
321 where
319 where
src/Language/PureScript/Publish/ErrorsWarnings.hs+3−7
@@ -1,6 +1,5 @@
1{-# LANGUAGE OverloadedStrings #-}
1{-# LANGUAGE OverloadedStrings #-}
2{-# LANGUAGE RecordWildCards #-}
2{-# LANGUAGE RecordWildCards #-}
3−{-# LANGUAGE CPP #-}
4
3
5module Language.PureScript.Publish.ErrorsWarnings
4module Language.PureScript.Publish.ErrorsWarnings
6 ( PackageError(..)
5 ( PackageError(..)
@@ -16,16 +15,13 @@ module Language.PureScript.Publish.ErrorsWarnings
16 , renderWarnings
15 , renderWarnings
17 ) where
16 ) where
18
17
19−#if __GLASGOW_HASKELL__ < 710
18+import Prelude ()
20−import Control.Applicative ((<$>))
19+import Prelude.Compat
21−#endif
20+
22import Data.Aeson.BetterErrors
21import Data.Aeson.BetterErrors
23import Data.Version
22import Data.Version
24import Data.Maybe
23import Data.Maybe
25import Data.Monoid
24import Data.Monoid
26−#if __GLASGOW_HASKELL__ < 710
27−import Data.Foldable (foldMap)
28−#endif
29import Data.List (intersperse, intercalate)
25import Data.List (intersperse, intercalate)
30import Data.List.NonEmpty (NonEmpty(..))
26import Data.List.NonEmpty (NonEmpty(..))
31import qualified Data.List.NonEmpty as NonEmpty
27import qualified Data.List.NonEmpty as NonEmpty
src/Language/PureScript/Renamer.hs+13−14
@@ -16,13 +16,12 @@
16
16
17{-# LANGUAGE FlexibleContexts #-}
17{-# LANGUAGE FlexibleContexts #-}
18{-# LANGUAGE ScopedTypeVariables #-}
18{-# LANGUAGE ScopedTypeVariables #-}
19−{-# LANGUAGE CPP #-}
20
19
21module Language.PureScript.Renamer (renameInModules) where
20module Language.PureScript.Renamer (renameInModules) where
22
21
23−#if __GLASGOW_HASKELL__ < 710
22+import Prelude ()
24−import Control.Applicative
23+import Prelude.Compat
25−#endif
24+
26import Control.Monad.State
25import Control.Monad.State
27
26
28import Data.List (find)
27import Data.List (find)
@@ -135,8 +134,8 @@ renameInDecl isTopLevel (NonRec name val) = do
135 name' <- if isTopLevel then return name else updateScope name
134 name' <- if isTopLevel then return name else updateScope name
136 NonRec name' <$> renameInValue val
135 NonRec name' <$> renameInValue val
137renameInDecl isTopLevel (Rec ds) = do
136renameInDecl isTopLevel (Rec ds) = do
138− ds' <- mapM updateNames ds
137+ ds' <- traverse updateNames ds
139− Rec <$> mapM updateValues ds'
138+ Rec <$> traverse updateValues ds'
140 where
139 where
141 updateNames :: (Ident, Expr Ann) -> Rename (Ident, Expr Ann)
140 updateNames :: (Ident, Expr Ann) -> Rename (Ident, Expr Ann)
142 updateNames (name, val) = do
141 updateNames (name, val) = do
@@ -155,7 +154,7 @@ renameInValue c@(Constructor{}) = return c
155renameInValue (Accessor ann prop v) =
154renameInValue (Accessor ann prop v) =
156 Accessor ann prop <$> renameInValue v
155 Accessor ann prop <$> renameInValue v
157renameInValue (ObjectUpdate ann obj vs) =
156renameInValue (ObjectUpdate ann obj vs) =
158− ObjectUpdate ann <$> renameInValue obj <*> mapM (\(name, v) -> (,) name <$> renameInValue v) vs
157+ ObjectUpdate ann <$> renameInValue obj <*> traverse (\(name, v) -> (,) name <$> renameInValue v) vs
159renameInValue e@(Abs (_, _, _, Just IsTypeClassConstructor) _ _) = return e
158renameInValue e@(Abs (_, _, _, Just IsTypeClassConstructor) _ _) = return e
160renameInValue (Abs ann name v) =
159renameInValue (Abs ann name v) =
161 newScope $ Abs ann <$> updateScope name <*> renameInValue v
160 newScope $ Abs ann <$> updateScope name <*> renameInValue v
@@ -165,16 +164,16 @@ renameInValue (Var ann (Qualified Nothing name)) =
165 Var ann . Qualified Nothing <$> lookupIdent name
164 Var ann . Qualified Nothing <$> lookupIdent name
166renameInValue v@(Var{}) = return v
165renameInValue v@(Var{}) = return v
167renameInValue (Case ann vs alts) =
166renameInValue (Case ann vs alts) =
168− newScope $ Case ann <$> mapM renameInValue vs <*> mapM renameInCaseAlternative alts
167+ newScope $ Case ann <$> traverse renameInValue vs <*> traverse renameInCaseAlternative alts
169renameInValue (Let ann ds v) =
168renameInValue (Let ann ds v) =
170− newScope $ Let ann <$> mapM (renameInDecl False) ds <*> renameInValue v
169+ newScope $ Let ann <$> traverse (renameInDecl False) ds <*> renameInValue v
171
170
172-- |
171-- |
173-- Renames within literals.
172-- Renames within literals.
174--
173--
175renameInLiteral :: (a -> Rename a) -> Literal a -> Rename (Literal a)
174renameInLiteral :: (a -> Rename a) -> Literal a -> Rename (Literal a)
176−renameInLiteral rename (ArrayLiteral bs) = ArrayLiteral <$> mapM rename bs
175+renameInLiteral rename (ArrayLiteral bs) = ArrayLiteral <$> traverse rename bs
177−renameInLiteral rename (ObjectLiteral bs) = ObjectLiteral <$> mapM (sndM rename) bs
176+renameInLiteral rename (ObjectLiteral bs) = ObjectLiteral <$> traverse (sndM rename) bs
178renameInLiteral _ l = return l
177renameInLiteral _ l = return l
179
178
180-- |
179-- |
@@ -182,8 +181,8 @@ renameInLiteral _ l = return l
182--
181--
183renameInCaseAlternative :: CaseAlternative Ann -> Rename (CaseAlternative Ann)
182renameInCaseAlternative :: CaseAlternative Ann -> Rename (CaseAlternative Ann)
184renameInCaseAlternative (CaseAlternative bs v) = newScope $
183renameInCaseAlternative (CaseAlternative bs v) = newScope $
185− CaseAlternative <$> mapM renameInBinder bs
184+ CaseAlternative <$> traverse renameInBinder bs
186− <*> eitherM (mapM (pairM renameInValue renameInValue)) renameInValue v
185+ <*> eitherM (traverse (pairM renameInValue renameInValue)) renameInValue v
187
186
188-- |
187-- |
189-- Renames within binders.
188-- Renames within binders.
@@ -195,6 +194,6 @@ renameInBinder (LiteralBinder ann b) =
195renameInBinder (VarBinder ann name) =
194renameInBinder (VarBinder ann name) =
196 VarBinder ann <$> updateScope name
195 VarBinder ann <$> updateScope name
197renameInBinder (ConstructorBinder ann tctor dctor bs) =
196renameInBinder (ConstructorBinder ann tctor dctor bs) =
198− ConstructorBinder ann tctor dctor <$> mapM renameInBinder bs
197+ ConstructorBinder ann tctor dctor <$> traverse renameInBinder bs
199renameInBinder (NamedBinder ann name b) =
198renameInBinder (NamedBinder ann name b) =
200 NamedBinder ann <$> updateScope name <*> renameInBinder b
199 NamedBinder ann <$> updateScope name <*> renameInBinder b
src/Language/PureScript/Sugar.hs+7−8
@@ -14,15 +14,14 @@
14-----------------------------------------------------------------------------
14-----------------------------------------------------------------------------
15
15
16{-# LANGUAGE FlexibleContexts #-}
16{-# LANGUAGE FlexibleContexts #-}
17−{-# LANGUAGE CPP #-}
18
17
19module Language.PureScript.Sugar (desugar, module S) where
18module Language.PureScript.Sugar (desugar, module S) where
20
19
20+import Prelude ()
21+import Prelude.Compat
22+
21import Control.Monad
23import Control.Monad
22import Control.Category ((>>>))
24import Control.Category ((>>>))
23−#if __GLASGOW_HASKELL__ < 710
24−import Control.Applicative
25−#endif
26import Control.Monad.Error.Class (MonadError())
25import Control.Monad.Error.Class (MonadError())
27import Control.Monad.Writer.Class (MonadWriter())
26import Control.Monad.Writer.Class (MonadWriter())
28import Control.Monad.Supply.Class
27import Control.Monad.Supply.Class
@@ -67,13 +66,13 @@ import Language.PureScript.Sugar.TypeDeclarations as S
67desugar :: (Applicative m, MonadSupply m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => [ExternsFile] -> [Module] -> m [Module]
66desugar :: (Applicative m, MonadSupply m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => [ExternsFile] -> [Module] -> m [Module]
68desugar externs =
67desugar externs =
69 map removeSignedLiterals
68 map removeSignedLiterals
70− >>> mapM desugarObjectConstructors
69+ >>> traverse desugarObjectConstructors
71− >=> mapM desugarOperatorSections
70+ >=> traverse desugarOperatorSections
72− >=> mapM desugarDoModule
71+ >=> traverse desugarDoModule
73 >=> desugarCasesModule
72 >=> desugarCasesModule
74 >=> desugarTypeDeclarationsModule
73 >=> desugarTypeDeclarationsModule
75 >=> desugarImports externs
74 >=> desugarImports externs
76 >=> rebracket externs
75 >=> rebracket externs
77− >=> mapM deriveInstances
76+ >=> traverse deriveInstances
78 >=> desugarTypeClasses externs
77 >=> desugarTypeClasses externs
79 >=> createBindingGroupsModule
78 >=> createBindingGroupsModule
src/Language/PureScript/Sugar/BindingGroups.hs+3−5
@@ -15,7 +15,6 @@
15-----------------------------------------------------------------------------
15-----------------------------------------------------------------------------
16
16
17{-# LANGUAGE FlexibleContexts #-}
17{-# LANGUAGE FlexibleContexts #-}
18−{-# LANGUAGE CPP #-}
19{-# LANGUAGE ScopedTypeVariables #-}
18{-# LANGUAGE ScopedTypeVariables #-}
20
19
21module Language.PureScript.Sugar.BindingGroups (
20module Language.PureScript.Sugar.BindingGroups (
@@ -25,13 +24,12 @@ module Language.PureScript.Sugar.BindingGroups (
25 collapseBindingGroupsModule
24 collapseBindingGroupsModule
26) where
25) where
27
26
27+import Prelude ()
28+import Prelude.Compat
29+
28import Data.Graph
30import Data.Graph
29import Data.List (nub, intersect)
31import Data.List (nub, intersect)
30import Data.Maybe (isJust, mapMaybe)
32import Data.Maybe (isJust, mapMaybe)
31−#if __GLASGOW_HASKELL__ < 710
32−import Data.Foldable (foldMap)
33−import Control.Applicative
34−#endif
35import Control.Monad ((<=<))
33import Control.Monad ((<=<))
36import Control.Monad.Error.Class (MonadError(..))
34import Control.Monad.Error.Class (MonadError(..))
37
35
src/Language/PureScript/Sugar/CaseDeclarations.hs+3−4
@@ -16,20 +16,19 @@
16
16
17{-# LANGUAGE FlexibleContexts #-}
17{-# LANGUAGE FlexibleContexts #-}
18{-# LANGUAGE ScopedTypeVariables #-}
18{-# LANGUAGE ScopedTypeVariables #-}
19−{-# LANGUAGE CPP #-}
20
19
21module Language.PureScript.Sugar.CaseDeclarations (
20module Language.PureScript.Sugar.CaseDeclarations (
22 desugarCases,
21 desugarCases,
23 desugarCasesModule
22 desugarCasesModule
24) where
23) where
25
24
25+import Prelude ()
26+import Prelude.Compat
27+
26import Language.PureScript.Crash
28import Language.PureScript.Crash
27import Data.Maybe (catMaybes)
29import Data.Maybe (catMaybes)
28import Data.List (nub, groupBy)
30import Data.List (nub, groupBy)
29
31
30−#if __GLASGOW_HASKELL__ < 710
31−import Control.Applicative
32−#endif
33import Control.Monad ((<=<), forM, replicateM, join, unless)
32import Control.Monad ((<=<), forM, replicateM, join, unless)
34import Control.Monad.Error.Class (MonadError(..))
33import Control.Monad.Error.Class (MonadError(..))
35import Control.Monad.Supply.Class
34import Control.Monad.Supply.Class
src/Language/PureScript/Sugar/DoNotation.hs+3−4
@@ -16,12 +16,14 @@
16
16
17{-# LANGUAGE FlexibleContexts #-}
17{-# LANGUAGE FlexibleContexts #-}
18{-# LANGUAGE ScopedTypeVariables #-}
18{-# LANGUAGE ScopedTypeVariables #-}
19−{-# LANGUAGE CPP #-}
20
19
21module Language.PureScript.Sugar.DoNotation (
20module Language.PureScript.Sugar.DoNotation (
22 desugarDoModule
21 desugarDoModule
23) where
22) where
24
23
24+import Prelude ()
25+import Prelude.Compat
26+
25import Language.PureScript.Crash
27import Language.PureScript.Crash
26import Language.PureScript.Names
28import Language.PureScript.Names
27import Language.PureScript.AST
29import Language.PureScript.AST
@@ -29,9 +31,6 @@ import Language.PureScript.Errors
29
31
30import qualified Language.PureScript.Constants as C
32import qualified Language.PureScript.Constants as C
31
33
32−#if __GLASGOW_HASKELL__ < 710
33−import Control.Applicative
34−#endif
35import Control.Monad.Error.Class (MonadError(..))
34import Control.Monad.Error.Class (MonadError(..))
36import Control.Monad.Supply.Class
35import Control.Monad.Supply.Class
37
36
src/Language/PureScript/Sugar/Names.hs+7−9
@@ -11,20 +11,18 @@
11--
11--
12-----------------------------------------------------------------------------
12-----------------------------------------------------------------------------
13
13
14−{-# LANGUAGE CPP #-}
15{-# LANGUAGE FlexibleContexts #-}
14{-# LANGUAGE FlexibleContexts #-}
16{-# LANGUAGE RecordWildCards #-}
15{-# LANGUAGE RecordWildCards #-}
17{-# LANGUAGE ScopedTypeVariables #-}
16{-# LANGUAGE ScopedTypeVariables #-}
18
17
19module Language.PureScript.Sugar.Names (desugarImports) where
18module Language.PureScript.Sugar.Names (desugarImports) where
20
19
20+import Prelude ()
21+import Prelude.Compat
22+
21import Data.List (find, nub)
23import Data.List (find, nub)
22import Data.Maybe (fromMaybe, mapMaybe)
24import Data.Maybe (fromMaybe, mapMaybe)
23
25
24−#if __GLASGOW_HASKELL__ < 710
25−import Data.Monoid (mempty)
26−import Control.Applicative (Applicative(..), (<$>), (<*>))
27−#endif
28import Control.Monad
26import Control.Monad
29import Control.Monad.Error.Class (MonadError(..))
27import Control.Monad.Error.Class (MonadError(..))
30import Control.Monad.Writer (MonadWriter(..), censor)
28import Control.Monad.Writer (MonadWriter(..), censor)
@@ -52,7 +50,7 @@ desugarImports :: forall m. (Applicative m, MonadError MultipleErrors m, MonadWr
52desugarImports externs modules = do
50desugarImports externs modules = do
53 env <- silence $ foldM externsEnv primEnv externs
51 env <- silence $ foldM externsEnv primEnv externs
54 env' <- foldM updateEnv env modules
52 env' <- foldM updateEnv env modules
55− mapM (renameInModule' env') modules
53+ traverse (renameInModule' env') modules
56 where
54 where
57 silence :: m a -> m a
55 silence :: m a -> m a
58 silence = censor (const mempty)
56 silence = censor (const mempty)
@@ -161,13 +159,13 @@ renameInModule env imports (Module ss coms mn decls exps) =
161 updateDecl (_, bound) d@(PositionedDeclaration pos _ _) =
159 updateDecl (_, bound) d@(PositionedDeclaration pos _ _) =
162 return ((Just pos, bound), d)
160 return ((Just pos, bound), d)
163 updateDecl (pos, bound) (DataDeclaration dtype name args dctors) =
161 updateDecl (pos, bound) (DataDeclaration dtype name args dctors) =
164− (,) (pos, bound) <$> (DataDeclaration dtype name args <$> mapM (sndM (mapM (updateTypesEverywhere pos))) dctors)
162+ (,) (pos, bound) <$> (DataDeclaration dtype name args <$> traverse (sndM (traverse (updateTypesEverywhere pos))) dctors)
165 updateDecl (pos, bound) (TypeSynonymDeclaration name ps ty) =
163 updateDecl (pos, bound) (TypeSynonymDeclaration name ps ty) =
166 (,) (pos, bound) <$> (TypeSynonymDeclaration name ps <$> updateTypesEverywhere pos ty)
164 (,) (pos, bound) <$> (TypeSynonymDeclaration name ps <$> updateTypesEverywhere pos ty)
167 updateDecl (pos, bound) (TypeClassDeclaration className args implies ds) =
165 updateDecl (pos, bound) (TypeClassDeclaration className args implies ds) =
168 (,) (pos, bound) <$> (TypeClassDeclaration className args <$> updateConstraints pos implies <*> pure ds)
166 (,) (pos, bound) <$> (TypeClassDeclaration className args <$> updateConstraints pos implies <*> pure ds)
169 updateDecl (pos, bound) (TypeInstanceDeclaration name cs cn ts ds) =
167 updateDecl (pos, bound) (TypeInstanceDeclaration name cs cn ts ds) =
170− (,) (pos, bound) <$> (TypeInstanceDeclaration name <$> updateConstraints pos cs <*> updateClassName cn pos <*> mapM (updateTypesEverywhere pos) ts <*> pure ds)
168+ (,) (pos, bound) <$> (TypeInstanceDeclaration name <$> updateConstraints pos cs <*> updateClassName cn pos <*> traverse (updateTypesEverywhere pos) ts <*> pure ds)
171 updateDecl (pos, bound) (TypeDeclaration name ty) =
169 updateDecl (pos, bound) (TypeDeclaration name ty) =
172 (,) (pos, bound) <$> (TypeDeclaration name <$> updateTypesEverywhere pos ty)
170 (,) (pos, bound) <$> (TypeDeclaration name <$> updateTypesEverywhere pos ty)
173 updateDecl (pos, bound) (ExternDeclaration name ty) =
171 updateDecl (pos, bound) (ExternDeclaration name ty) =
@@ -225,7 +223,7 @@ renameInModule env imports (Module ss coms mn decls exps) =
225 updateType t = return t
223 updateType t = return t
226
224
227 updateConstraints :: Maybe SourceSpan -> [Constraint] -> m [Constraint]
225 updateConstraints :: Maybe SourceSpan -> [Constraint] -> m [Constraint]
228− updateConstraints pos = mapM (\(name, ts) -> (,) <$> updateClassName name pos <*> mapM (updateTypesEverywhere pos) ts)
226+ updateConstraints pos = traverse (\(name, ts) -> (,) <$> updateClassName name pos <*> traverse (updateTypesEverywhere pos) ts)
229
227
230 updateTypeName :: Qualified ProperName -> Maybe SourceSpan -> m (Qualified ProperName)
228 updateTypeName :: Qualified ProperName -> Maybe SourceSpan -> m (Qualified ProperName)
231 updateTypeName = update UnknownType (importedTypes imports) (resolveType . exportedTypes) IsProperName
229 updateTypeName = update UnknownType (importedTypes imports) (resolveType . exportedTypes) IsProperName
src/Language/PureScript/Sugar/Names/Exports.hs+5−5
@@ -11,7 +11,6 @@
11--
11--
12-----------------------------------------------------------------------------
12-----------------------------------------------------------------------------
13
13
14−{-# LANGUAGE CPP #-}
15{-# LANGUAGE FlexibleContexts #-}
14{-# LANGUAGE FlexibleContexts #-}
16{-# LANGUAGE RankNTypes #-}
15{-# LANGUAGE RankNTypes #-}
17{-# LANGUAGE ScopedTypeVariables #-}
16{-# LANGUAGE ScopedTypeVariables #-}
@@ -22,12 +21,13 @@ module Language.PureScript.Sugar.Names.Exports
22 , resolveExports
21 , resolveExports
23 ) where
22 ) where
24
23
24+import Prelude ()
25+import Prelude.Compat
26+
25import Data.List (find, intersect)
27import Data.List (find, intersect)
26import Data.Maybe (fromMaybe, mapMaybe)
28import Data.Maybe (fromMaybe, mapMaybe)
29+import Data.Foldable (traverse_)
27
30
28−#if __GLASGOW_HASKELL__ < 710
29−import Control.Applicative (Applicative(..), (<$>))
30−#endif
31import Control.Monad
31import Control.Monad
32import Control.Monad.Error.Class (MonadError(..))
32import Control.Monad.Error.Class (MonadError(..))
33
33
@@ -197,7 +197,7 @@ filterModule mn exps refs = do
197 Nothing -> throwError . errorMessage . UnknownExportType $ name
197 Nothing -> throwError . errorMessage . UnknownExportType $ name
198 Just ((_, dcons), _) -> do
198 Just ((_, dcons), _) -> do
199 let expDcons' = fromMaybe dcons expDcons
199 let expDcons' = fromMaybe dcons expDcons
200− mapM_ (checkDcon name dcons) expDcons'
200+ traverse_ (checkDcon name dcons) expDcons'
201 return $ ((name, expDcons'), mn) : result
201 return $ ((name, expDcons'), mn) : result
202 filterTypes _ result _ = return result
202 filterTypes _ result _ = return result
203
203
src/Language/PureScript/Sugar/Names/Imports.hs+8−8
@@ -11,7 +11,6 @@
11--
11--
12-----------------------------------------------------------------------------
12-----------------------------------------------------------------------------
13
13
14−{-# LANGUAGE CPP #-}
15{-# LANGUAGE FlexibleContexts #-}
14{-# LANGUAGE FlexibleContexts #-}
16{-# LANGUAGE ScopedTypeVariables #-}
15{-# LANGUAGE ScopedTypeVariables #-}
17{-# LANGUAGE TupleSections #-}
16{-# LANGUAGE TupleSections #-}
@@ -22,13 +21,14 @@ module Language.PureScript.Sugar.Names.Imports
22 , findImports
21 , findImports
23 ) where
22 ) where
24
23
24+import Prelude ()
25+import Prelude.Compat
26+
25import Data.List (find)
27import Data.List (find)
26import Data.Maybe (fromMaybe, isNothing)
28import Data.Maybe (fromMaybe, isNothing)
29+import Data.Foldable (traverse_)
27
30
28import Control.Arrow (first)
31import Control.Arrow (first)
29−#if __GLASGOW_HASKELL__ < 710
30−import Control.Applicative (Applicative(..), (<$>))
31−#endif
32import Control.Monad
32import Control.Monad
33import Control.Monad.Error.Class (MonadError(..))
33import Control.Monad.Error.Class (MonadError(..))
34import Control.Monad.Writer (MonadWriter(..), censor)
34import Control.Monad.Writer (MonadWriter(..), censor)
@@ -57,7 +57,7 @@ findImports = foldM (go Nothing) M.empty
57
57
58 -- Ensure that classes don't appear in an `import X hiding (...)`
58 -- Ensure that classes don't appear in an `import X hiding (...)`
59 checkImportRefType :: ImportDeclarationType -> m ()
59 checkImportRefType :: ImportDeclarationType -> m ()
60− checkImportRefType (Hiding refs) = mapM_ checkImportRef refs
60+ checkImportRefType (Hiding refs) = traverse_ checkImportRef refs
61 checkImportRefType _ = return ()
61 checkImportRefType _ = return ()
62 checkImportRef :: DeclarationRef -> m ()
62 checkImportRef :: DeclarationRef -> m ()
63 checkImportRef (ModuleRef name) = throwError . errorMessage $ ImportHidingModule name
63 checkImportRef (ModuleRef name) = throwError . errorMessage $ ImportHidingModule name
@@ -105,7 +105,7 @@ resolveImport currentModule importModule exps imps impQual =
105
105
106 -- Check that a 'DeclarationRef' refers to an importable symbol
106 -- Check that a 'DeclarationRef' refers to an importable symbol
107 checkRefs :: [DeclarationRef] -> m ()
107 checkRefs :: [DeclarationRef] -> m ()
108− checkRefs = mapM_ check
108+ checkRefs = traverse_ check
109 where
109 where
110 check (PositionedDeclarationRef pos _ r) =
110 check (PositionedDeclarationRef pos _ r) =
111 rethrowWithPosition pos $ check r
111 rethrowWithPosition pos $ check r
@@ -114,7 +114,7 @@ resolveImport currentModule importModule exps imps impQual =
114 check (TypeRef name dctors) = do
114 check (TypeRef name dctors) = do
115 checkImportExists UnknownImportType ((fst . fst) `map` exportedTypes exps) name
115 checkImportExists UnknownImportType ((fst . fst) `map` exportedTypes exps) name
116 let allDctors = fst `map` allExportedDataConstructors name
116 let allDctors = fst `map` allExportedDataConstructors name
117− maybe (return ()) (mapM_ $ checkDctorExists name allDctors) dctors
117+ maybe (return ()) (traverse_ $ checkDctorExists name allDctors) dctors
118 check (TypeClassRef name) =
118 check (TypeClassRef name) =
119 checkImportExists UnknownImportTypeClass (fst `map` exportedTypeClasses exps) name
119 checkImportExists UnknownImportTypeClass (fst `map` exportedTypeClasses exps) name
120 --check (ModuleRef name) =
120 --check (ModuleRef name) =
@@ -168,7 +168,7 @@ resolveImport currentModule importModule exps imps impQual =
168 exportedDctors = allExportedDataConstructors name
168 exportedDctors = allExportedDataConstructors name
169 dctorNames :: [ProperName]
169 dctorNames :: [ProperName]
170 dctorNames = fst `map` exportedDctors
170 dctorNames = fst `map` exportedDctors
171− maybe (return ()) (mapM_ $ checkDctorExists name dctorNames) dctors
171+ maybe (return ()) (traverse_ $ checkDctorExists name dctorNames) dctors
172 when (null dctorNames && isNothing dctors) . tell . errorMessage $ MisleadingEmptyTypeImport importModule name
172 when (null dctorNames && isNothing dctors) . tell . errorMessage $ MisleadingEmptyTypeImport importModule name
173 dctors' <- foldM (\m -> updateImports m runProperName exportedDctors) (importedDataConstructors imp) (fromMaybe dctorNames dctors)
173 dctors' <- foldM (\m -> updateImports m runProperName exportedDctors) (importedDataConstructors imp) (fromMaybe dctorNames dctors)
174 return $ imp { importedTypes = types', importedDataConstructors = dctors' }
174 return $ imp { importedTypes = types', importedDataConstructors = dctors' }
src/Language/PureScript/Sugar/ObjectWildcards.hs+3−4
@@ -14,15 +14,14 @@
14
14
15{-# LANGUAGE FlexibleContexts #-}
15{-# LANGUAGE FlexibleContexts #-}
16{-# LANGUAGE ScopedTypeVariables #-}
16{-# LANGUAGE ScopedTypeVariables #-}
17−{-# LANGUAGE CPP #-}
18
17
19module Language.PureScript.Sugar.ObjectWildcards (
18module Language.PureScript.Sugar.ObjectWildcards (
20 desugarObjectConstructors
19 desugarObjectConstructors
21) where
20) where
22
21
23−#if __GLASGOW_HASKELL__ < 710
22+import Prelude ()
24−import Control.Applicative
23+import Prelude.Compat
25−#endif
24+
26import Control.Arrow (second)
25import Control.Arrow (second)
27import Control.Monad.Error.Class (MonadError(..))
26import Control.Monad.Error.Class (MonadError(..))
28import Control.Monad.Supply.Class
27import Control.Monad.Supply.Class
src/Language/PureScript/Sugar/Operators.hs+5−6
@@ -21,7 +21,6 @@
21{-# LANGUAGE FlexibleContexts #-}
21{-# LANGUAGE FlexibleContexts #-}
22{-# LANGUAGE ScopedTypeVariables #-}
22{-# LANGUAGE ScopedTypeVariables #-}
23{-# LANGUAGE RecordWildCards #-}
23{-# LANGUAGE RecordWildCards #-}
24−{-# LANGUAGE CPP #-}
25
24
26module Language.PureScript.Sugar.Operators (
25module Language.PureScript.Sugar.Operators (
27 rebracket,
26 rebracket,
@@ -29,15 +28,15 @@ module Language.PureScript.Sugar.Operators (
29 desugarOperatorSections
28 desugarOperatorSections
30) where
29) where
31
30
31+import Prelude ()
32+import Prelude.Compat
33+
32import Language.PureScript.Crash
34import Language.PureScript.Crash
33import Language.PureScript.AST
35import Language.PureScript.AST
34import Language.PureScript.Errors
36import Language.PureScript.Errors
35import Language.PureScript.Names
37import Language.PureScript.Names
36import Language.PureScript.Externs
38import Language.PureScript.Externs
37
39
38−#if __GLASGOW_HASKELL__ < 710
39−import Control.Applicative
40−#endif
41import Control.Monad.State
40import Control.Monad.State
42import Control.Monad.Error.Class (MonadError(..))
41import Control.Monad.Error.Class (MonadError(..))
43import Control.Monad.Supply.Class
42import Control.Monad.Supply.Class
@@ -60,7 +59,7 @@ rebracket externs ms = do
60 let fixities = concatMap externsFixities externs ++ concatMap collectFixities ms
59 let fixities = concatMap externsFixities externs ++ concatMap collectFixities ms
61 ensureNoDuplicates $ map (\(i, pos, _) -> (i, pos)) fixities
60 ensureNoDuplicates $ map (\(i, pos, _) -> (i, pos)) fixities
62 let opTable = customOperatorTable $ map (\(i, _, f) -> (i, f)) fixities
61 let opTable = customOperatorTable $ map (\(i, _, f) -> (i, f)) fixities
63− mapM (rebracketModule opTable) ms
62+ traverse (rebracketModule opTable) ms
64
63
65removeSignedLiterals :: Module -> Module
64removeSignedLiterals :: Module -> Module
66removeSignedLiterals (Module ss coms mn ds exts) = Module ss coms mn (map f' ds) exts
65removeSignedLiterals (Module ss coms mn ds exts) = Module ss coms mn (map f' ds) exts
@@ -164,7 +163,7 @@ matchOp op = do
164 guard $ ident == op
163 guard $ ident == op
165
164
166desugarOperatorSections :: forall m. (Applicative m, MonadSupply m, MonadError MultipleErrors m) => Module -> m Module
165desugarOperatorSections :: forall m. (Applicative m, MonadSupply m, MonadError MultipleErrors m) => Module -> m Module
167−desugarOperatorSections (Module ss coms mn ds exts) = Module ss coms mn <$> mapM goDecl ds <*> pure exts
166+desugarOperatorSections (Module ss coms mn ds exts) = Module ss coms mn <$> traverse goDecl ds <*> pure exts
168 where
167 where
169
168
170 goDecl :: Declaration -> m Declaration
169 goDecl :: Declaration -> m Declaration
src/Language/PureScript/Sugar/TypeClasses.hs+5−6
@@ -16,7 +16,6 @@
16
16
17{-# LANGUAGE FlexibleContexts #-}
17{-# LANGUAGE FlexibleContexts #-}
18{-# LANGUAGE RecordWildCards #-}
18{-# LANGUAGE RecordWildCards #-}
19−{-# LANGUAGE CPP #-}
20
19
21module Language.PureScript.Sugar.TypeClasses
20module Language.PureScript.Sugar.TypeClasses
22 ( desugarTypeClasses
21 ( desugarTypeClasses
@@ -24,6 +23,9 @@ module Language.PureScript.Sugar.TypeClasses
24 , superClassDictionaryNames
23 , superClassDictionaryNames
25 ) where
24 ) where
26
25
26+import Prelude ()
27+import Prelude.Compat
28+
27import Language.PureScript.Crash
29import Language.PureScript.Crash
28import Language.PureScript.AST hiding (isExported)
30import Language.PureScript.AST hiding (isExported)
29import Language.PureScript.Environment
31import Language.PureScript.Environment
@@ -37,9 +39,6 @@ import Language.PureScript.Types
37
39
38import qualified Language.PureScript.Constants as C
40import qualified Language.PureScript.Constants as C
39
41
40−#if __GLASGOW_HASKELL__ < 710
41−import Control.Applicative
42−#endif
43import Control.Arrow (first, second)
42import Control.Arrow (first, second)
44import Control.Monad.Error.Class (MonadError(..))
43import Control.Monad.Error.Class (MonadError(..))
45import Control.Monad.State
44import Control.Monad.State
@@ -57,7 +56,7 @@ type Desugar = StateT MemberMap
57-- instance dictionary expressions.
56-- instance dictionary expressions.
58--
57--
59desugarTypeClasses :: (Functor m, Applicative m, MonadSupply m, MonadError MultipleErrors m) => [ExternsFile] -> [Module] -> m [Module]
58desugarTypeClasses :: (Functor m, Applicative m, MonadSupply m, MonadError MultipleErrors m) => [ExternsFile] -> [Module] -> m [Module]
60−desugarTypeClasses externs = flip evalStateT initialState . mapM desugarModule
59+desugarTypeClasses externs = flip evalStateT initialState . traverse desugarModule
61 where
60 where
62 initialState :: MemberMap
61 initialState :: MemberMap
63 initialState = M.fromList (externs >>= \ExternsFile{..} -> mapMaybe (fromExternsDecl efModuleName) efDeclarations)
62 initialState = M.fromList (externs >>= \ExternsFile{..} -> mapMaybe (fromExternsDecl efModuleName) efDeclarations)
@@ -262,7 +261,7 @@ typeInstanceDictionaryDeclaration name mn deps className tys decls =
262 let memberTypes = map (second (replaceAllTypeVars (zip (map fst args) tys))) instanceTys
261 let memberTypes = map (second (replaceAllTypeVars (zip (map fst args) tys))) instanceTys
263
262
264 -- Create values for the type instance members
263 -- Create values for the type instance members
265− members <- zip (map typeClassMemberName decls) <$> mapM (memberToValue memberTypes) decls
264+ members <- zip (map typeClassMemberName decls) <$> traverse (memberToValue memberTypes) decls
266
265
267 -- Create the type of the dictionary
266 -- Create the type of the dictionary
268 -- The type is an object type, but depending on type instance dependencies, may be constrained.
267 -- The type is an object type, but depending on type instance dependencies, may be constrained.
src/Language/PureScript/Sugar/TypeClasses/Deriving.hs+4−5
@@ -19,19 +19,18 @@
19{-# LANGUAGE PatternGuards #-}
19{-# LANGUAGE PatternGuards #-}
20{-# LANGUAGE RankNTypes #-}
20{-# LANGUAGE RankNTypes #-}
21{-# LANGUAGE ScopedTypeVariables #-}
21{-# LANGUAGE ScopedTypeVariables #-}
22−{-# LANGUAGE CPP #-}
23
22
24module Language.PureScript.Sugar.TypeClasses.Deriving (
23module Language.PureScript.Sugar.TypeClasses.Deriving (
25 deriveInstances
24 deriveInstances
26) where
25) where
27
26
28−import Data.List
27+import Prelude ()
28+import Prelude.Compat
29+
30+import Data.List (foldl', find, sortBy)
29import Data.Maybe (fromMaybe)
31import Data.Maybe (fromMaybe)
30import Data.Ord (comparing)
32import Data.Ord (comparing)
31
33
32−#if __GLASGOW_HASKELL__ < 710
33−import Control.Applicative
34−#endif
35import Control.Monad (replicateM)
34import Control.Monad (replicateM)
36import Control.Monad.Supply.Class (MonadSupply, freshName)
35import Control.Monad.Supply.Class (MonadSupply, freshName)
37import Control.Monad.Error.Class (MonadError(..))
36import Control.Monad.Error.Class (MonadError(..))
src/Language/PureScript/Sugar/TypeDeclarations.hs+3−4
@@ -16,15 +16,14 @@
16
16
17{-# LANGUAGE FlexibleContexts #-}
17{-# LANGUAGE FlexibleContexts #-}
18{-# LANGUAGE ScopedTypeVariables #-}
18{-# LANGUAGE ScopedTypeVariables #-}
19−{-# LANGUAGE CPP #-}
20
19
21module Language.PureScript.Sugar.TypeDeclarations (
20module Language.PureScript.Sugar.TypeDeclarations (
22 desugarTypeDeclarationsModule
21 desugarTypeDeclarationsModule
23) where
22) where
24
23
25−#if __GLASGOW_HASKELL__ < 710
24+import Prelude ()
26−import Control.Applicative
25+import Prelude.Compat
27−#endif
26+
28import Control.Monad (forM)
27import Control.Monad (forM)
29import Control.Monad.Error.Class (MonadError(..))
28import Control.Monad.Error.Class (MonadError(..))
30
29
src/Language/PureScript/Traversals.hs+2−5
@@ -12,13 +12,10 @@
12--
12--
13-----------------------------------------------------------------------------
13-----------------------------------------------------------------------------
14
14
15−{-# LANGUAGE CPP #-}
16−
17module Language.PureScript.Traversals where
15module Language.PureScript.Traversals where
18
16
19−#if __GLASGOW_HASKELL__ < 710
17+import Prelude ()
20−import Control.Applicative
18+import Prelude.Compat
21−#endif
22
19
23fstM :: (Functor f) => (a -> f c) -> (a, b) -> f (c, b)
20fstM :: (Functor f) => (a -> f c) -> (a, b) -> f (c, b)
24fstM f (a, b) = flip (,) b <$> f a
21fstM f (a, b) = flip (,) b <$> f a
src/Language/PureScript/TypeChecker.hs+8−9
@@ -14,13 +14,15 @@
14-----------------------------------------------------------------------------
14-----------------------------------------------------------------------------
15
15
16{-# LANGUAGE FlexibleInstances #-}
16{-# LANGUAGE FlexibleInstances #-}
17−{-# LANGUAGE CPP #-}
18
17
19module Language.PureScript.TypeChecker (
18module Language.PureScript.TypeChecker (
20 module T,
19 module T,
21 typeCheckModule
20 typeCheckModule
22) where
21) where
23
22
23+import Prelude ()
24+import Prelude.Compat
25+
24import Language.PureScript.TypeChecker.Monad as T
26import Language.PureScript.TypeChecker.Monad as T
25import Language.PureScript.TypeChecker.Kinds as T
27import Language.PureScript.TypeChecker.Kinds as T
26import Language.PureScript.TypeChecker.Types as T
28import Language.PureScript.TypeChecker.Types as T
@@ -28,13 +30,10 @@ import Language.PureScript.TypeChecker.Synonyms as T
28
30
29import Data.Maybe
31import Data.Maybe
30import Data.List (nub, (\\), sort, group)
32import Data.List (nub, (\\), sort, group)
31−import Data.Foldable (for_)
33+import Data.Foldable (for_, traverse_)
32
34
33import qualified Data.Map as M
35import qualified Data.Map as M
34
36
35−#if __GLASGOW_HASKELL__ < 710
36−import Control.Applicative ((<$>), (<*))
37−#endif
38import Control.Monad.State
37import Control.Monad.State
39import Control.Monad.Error.Class (MonadError(..))
38import Control.Monad.Error.Class (MonadError(..))
40
39
@@ -58,7 +57,7 @@ addDataType moduleName dtype name args dctors ctorKind = do
58addDataConstructor :: ModuleName -> DataDeclType -> ProperName -> [String] -> ProperName -> [Type] -> Check ()
57addDataConstructor :: ModuleName -> DataDeclType -> ProperName -> [String] -> ProperName -> [Type] -> Check ()
59addDataConstructor moduleName dtype name args dctor tys = do
58addDataConstructor moduleName dtype name args dctor tys = do
60 env <- getEnv
59 env <- getEnv
61− mapM_ checkTypeSynonyms tys
60+ traverse_ checkTypeSynonyms tys
62 let retTy = foldl TypeApp (TypeConstructor (Qualified (Just moduleName) name)) (map TypeVar args)
61 let retTy = foldl TypeApp (TypeConstructor (Qualified (Just moduleName) name)) (map TypeVar args)
63 let dctorTy = foldr function retTy tys
62 let dctorTy = foldr function retTy tys
64 let polyType = mkForAll args dctorTy
63 let polyType = mkForAll args dctorTy
@@ -134,7 +133,7 @@ checkTypeSynonyms = void . replaceAllTypeSynonyms
134-- * Process module imports
133-- * Process module imports
135--
134--
136typeCheckAll :: ModuleName -> [DeclarationRef] -> [Declaration] -> Check [Declaration]
135typeCheckAll :: ModuleName -> [DeclarationRef] -> [Declaration] -> Check [Declaration]
137−typeCheckAll moduleName _ ds = mapM go ds <* mapM_ checkOrphanFixities ds
136+typeCheckAll moduleName _ ds = traverse go ds <* traverse_ checkOrphanFixities ds
138 where
137 where
139 go :: Declaration -> Check Declaration
138 go :: Declaration -> Check Declaration
140 go (DataDeclaration dtype name args dctors) = do
139 go (DataDeclaration dtype name args dctors) = do
@@ -218,8 +217,8 @@ typeCheckAll moduleName _ ds = mapM go ds <* mapM_ checkOrphanFixities ds
218 addTypeClass moduleName pn args implies tys
217 addTypeClass moduleName pn args implies tys
219 return d
218 return d
220 go (d@(TypeInstanceDeclaration dictName deps className tys body)) = rethrow (addHint (ErrorInInstance className tys)) $ do
219 go (d@(TypeInstanceDeclaration dictName deps className tys body)) = rethrow (addHint (ErrorInInstance className tys)) $ do
221− mapM_ (checkTypeClassInstance moduleName) tys
220+ traverse_ (checkTypeClassInstance moduleName) tys
222− forM_ deps $ mapM_ (checkTypeClassInstance moduleName) . snd
221+ forM_ deps $ traverse_ (checkTypeClassInstance moduleName) . snd
223 checkOrphanInstance dictName className tys
222 checkOrphanInstance dictName className tys
224 _ <- traverseTypeInstanceBody checkInstanceMembers body
223 _ <- traverseTypeInstanceBody checkInstanceMembers body
225 let dict = TypeClassDictionaryInScope (Qualified (Just moduleName) dictName) [] className tys (Just deps)
224 let dict = TypeClassDictionaryInScope (Qualified (Just moduleName) dictName) [] className tys (Just deps)
src/Language/PureScript/TypeChecker/Entailment.hs+5−10
@@ -13,23 +13,18 @@
13--
13--
14-----------------------------------------------------------------------------
14-----------------------------------------------------------------------------
15
15
16−{-# LANGUAGE CPP #-}
17−
18module Language.PureScript.TypeChecker.Entailment (
16module Language.PureScript.TypeChecker.Entailment (
19 entails
17 entails
20) where
18) where
21
19
20+import Prelude ()
21+import Prelude.Compat
22+
22import Data.Function (on)
23import Data.Function (on)
23−import Data.List
24+import Data.List (minimumBy, sortBy, groupBy)
24import Data.Maybe (maybeToList, mapMaybe)
25import Data.Maybe (maybeToList, mapMaybe)
25−#if __GLASGOW_HASKELL__ < 710
26−import Data.Foldable (foldMap)
27−#endif
28import qualified Data.Map as M
26import qualified Data.Map as M
29
27
30−#if __GLASGOW_HASKELL__ < 710
31−import Control.Applicative
32−#endif
33import Control.Arrow (Arrow(..))
28import Control.Arrow (Arrow(..))
34import Control.Monad.State
29import Control.Monad.State
35import Control.Monad.Error.Class (MonadError(..))
30import Control.Monad.Error.Class (MonadError(..))
@@ -112,7 +107,7 @@ entails moduleName context = solve
112 solveSubgoals :: [(String, Type)] -> Maybe [Constraint] -> Check (Maybe [DictionaryValue])
107 solveSubgoals :: [(String, Type)] -> Maybe [Constraint] -> Check (Maybe [DictionaryValue])
113 solveSubgoals _ Nothing = return Nothing
108 solveSubgoals _ Nothing = return Nothing
114 solveSubgoals subst (Just subgoals) = do
109 solveSubgoals subst (Just subgoals) = do
115− dict <- mapM (uncurry (go (work + 1)) . second (map (replaceAllTypeVars subst))) subgoals
110+ dict <- traverse (uncurry (go (work + 1)) . second (map (replaceAllTypeVars subst))) subgoals
116 return $ Just dict
111 return $ Just dict
117
112
118 -- Make a dictionary from subgoal dictionaries by applying the correct function
113 -- Make a dictionary from subgoal dictionaries by applying the correct function
src/Language/PureScript/TypeChecker/Kinds.hs+4−5
@@ -17,7 +17,6 @@
17{-# LANGUAGE MultiParamTypeClasses #-}
17{-# LANGUAGE MultiParamTypeClasses #-}
18{-# LANGUAGE FlexibleInstances #-}
18{-# LANGUAGE FlexibleInstances #-}
19{-# LANGUAGE TupleSections #-}
19{-# LANGUAGE TupleSections #-}
20−{-# LANGUAGE CPP #-}
21
20
22module Language.PureScript.TypeChecker.Kinds (
21module Language.PureScript.TypeChecker.Kinds (
23 kindOf,
22 kindOf,
@@ -26,15 +25,15 @@ module Language.PureScript.TypeChecker.Kinds (
26 kindsOfAll
25 kindsOfAll
27) where
26) where
28
27
28+import Prelude ()
29+import Prelude.Compat
30+
29import Data.Maybe (fromMaybe)
31import Data.Maybe (fromMaybe)
30
32
31import qualified Data.HashMap.Strict as H
33import qualified Data.HashMap.Strict as H
32import qualified Data.Map as M
34import qualified Data.Map as M
33
35
34import Control.Arrow (second)
36import Control.Arrow (second)
35−#if __GLASGOW_HASKELL__ < 710
36−import Control.Applicative
37−#endif
38import Control.Monad
37import Control.Monad
39import Control.Monad.Error.Class (MonadError(..))
38import Control.Monad.Error.Class (MonadError(..))
40import Control.Monad.State
39import Control.Monad.State
@@ -141,7 +140,7 @@ kindsOfAll moduleName syns tys = fmap tidyUp . liftUnify $ do
141--
140--
142solveTypes :: Bool -> [Type] -> [Kind] -> Kind -> UnifyT Kind Check Kind
141solveTypes :: Bool -> [Type] -> [Kind] -> Kind -> UnifyT Kind Check Kind
143solveTypes isData ts kargs tyCon = do
142solveTypes isData ts kargs tyCon = do
144− ks <- mapM (fmap fst . infer) ts
143+ ks <- traverse (fmap fst . infer) ts
145 when isData $ do
144 when isData $ do
146 tyCon =?= foldr FunKind Star kargs
145 tyCon =?= foldr FunKind Star kargs
147 forM_ ks $ \k -> k =?= Star
146 forM_ ks $ \k -> k =?= Star
src/Language/PureScript/TypeChecker/Monad.hs+3−4
@@ -19,17 +19,16 @@
19{-# LANGUAGE MultiParamTypeClasses #-}
19{-# LANGUAGE MultiParamTypeClasses #-}
20{-# LANGUAGE FlexibleContexts #-}
20{-# LANGUAGE FlexibleContexts #-}
21{-# LANGUAGE GADTs #-}
21{-# LANGUAGE GADTs #-}
22−{-# LANGUAGE CPP #-}
23
22
24module Language.PureScript.TypeChecker.Monad where
23module Language.PureScript.TypeChecker.Monad where
25
24
25+import Prelude ()
26+import Prelude.Compat
27+
26import Data.Maybe
28import Data.Maybe
27import Data.Foldable (for_)
29import Data.Foldable (for_)
28import qualified Data.Map as M
30import qualified Data.Map as M
29
31
30−#if __GLASGOW_HASKELL__ < 710
31−import Control.Applicative
32−#endif
33import Control.Monad.State
32import Control.Monad.State
34import Control.Monad.Unify
33import Control.Monad.Unify
35import Control.Monad.Writer.Strict
34import Control.Monad.Writer.Strict
src/Language/PureScript/TypeChecker/Skolems.hs+3−5
@@ -13,8 +13,6 @@
13--
13--
14-----------------------------------------------------------------------------
14-----------------------------------------------------------------------------
15
15
16−{-# LANGUAGE CPP #-}
17−
18module Language.PureScript.TypeChecker.Skolems (
16module Language.PureScript.TypeChecker.Skolems (
19 newSkolemConstant,
17 newSkolemConstant,
20 introduceSkolemScope,
18 introduceSkolemScope,
@@ -24,12 +22,12 @@ module Language.PureScript.TypeChecker.Skolems (
24 skolemEscapeCheck
22 skolemEscapeCheck
25) where
23) where
26
24
25+import Prelude ()
26+import Prelude.Compat
27+
27import Data.List (nub, (\\))
28import Data.List (nub, (\\))
28import Data.Monoid
29import Data.Monoid
29
30
30−#if __GLASGOW_HASKELL__ < 710
31−import Control.Applicative
32−#endif
33import Control.Monad.Error.Class (MonadError(..))
31import Control.Monad.Error.Class (MonadError(..))
34import Control.Monad.Unify
32import Control.Monad.Unify
35
33
src/Language/PureScript/TypeChecker/Synonyms.hs+3−4
@@ -17,18 +17,17 @@
17{-# LANGUAGE MultiParamTypeClasses #-}
17{-# LANGUAGE MultiParamTypeClasses #-}
18{-# LANGUAGE PatternGuards #-}
18{-# LANGUAGE PatternGuards #-}
19{-# LANGUAGE GADTs #-}
19{-# LANGUAGE GADTs #-}
20−{-# LANGUAGE CPP #-}
21
20
22module Language.PureScript.TypeChecker.Synonyms (
21module Language.PureScript.TypeChecker.Synonyms (
23 replaceAllTypeSynonyms
22 replaceAllTypeSynonyms
24) where
23) where
25
24
25+import Prelude ()
26+import Prelude.Compat
27+
26import Data.Maybe (fromMaybe)
28import Data.Maybe (fromMaybe)
27import qualified Data.Map as M
29import qualified Data.Map as M
28
30
29−#if __GLASGOW_HASKELL__ < 710
30−import Control.Applicative
31−#endif
32import Control.Monad.Error.Class (MonadError(..))
31import Control.Monad.Error.Class (MonadError(..))
33import Control.Monad.State
32import Control.Monad.State
34
33
src/Language/PureScript/TypeChecker/Types.hs+8−9
@@ -16,7 +16,6 @@
16{-# LANGUAGE FlexibleContexts #-}
16{-# LANGUAGE FlexibleContexts #-}
17{-# LANGUAGE MultiParamTypeClasses #-}
17{-# LANGUAGE MultiParamTypeClasses #-}
18{-# LANGUAGE OverloadedStrings #-}
18{-# LANGUAGE OverloadedStrings #-}
19−{-# LANGUAGE CPP #-}
20
19
21module Language.PureScript.TypeChecker.Types (
20module Language.PureScript.TypeChecker.Types (
22 typesOf
21 typesOf
@@ -38,14 +37,14 @@ module Language.PureScript.TypeChecker.Types (
38 Check a function of a given type returns a value of another type when applied to its arguments
37 Check a function of a given type returns a value of another type when applied to its arguments
39-}
38-}
40
39
40+import Prelude ()
41+import Prelude.Compat
42+
41import Data.Either (lefts, rights)
43import Data.Either (lefts, rights)
42−import Data.List
44+import Data.List (transpose, nub, (\\), partition, delete)
43import Data.Maybe (fromMaybe)
45import Data.Maybe (fromMaybe)
44import qualified Data.Map as M
46import qualified Data.Map as M
45
47
46−#if __GLASGOW_HASKELL__ < 710
47−import Control.Applicative
48−#endif
49import Control.Monad
48import Control.Monad
50import Control.Monad.State
49import Control.Monad.State
51import Control.Monad.Unify
50import Control.Monad.Unify
@@ -213,20 +212,20 @@ infer' v@(StringLiteral _) = return $ TypedValue True v tyString
213infer' v@(CharLiteral _) = return $ TypedValue True v tyChar
212infer' v@(CharLiteral _) = return $ TypedValue True v tyChar
214infer' v@(BooleanLiteral _) = return $ TypedValue True v tyBoolean
213infer' v@(BooleanLiteral _) = return $ TypedValue True v tyBoolean
215infer' (ArrayLiteral vals) = do
214infer' (ArrayLiteral vals) = do
216− ts <- mapM infer vals
215+ ts <- traverse infer vals
217 els <- fresh
216 els <- fresh
218 forM_ ts $ \(TypedValue _ _ t) -> els =?= t
217 forM_ ts $ \(TypedValue _ _ t) -> els =?= t
219 return $ TypedValue True (ArrayLiteral ts) (TypeApp tyArray els)
218 return $ TypedValue True (ArrayLiteral ts) (TypeApp tyArray els)
220infer' (ObjectLiteral ps) = do
219infer' (ObjectLiteral ps) = do
221 ensureNoDuplicateProperties ps
220 ensureNoDuplicateProperties ps
222− ts <- mapM (infer . snd) ps
221+ ts <- traverse (infer . snd) ps
223 let fields = zipWith (\name (TypedValue _ _ t) -> (name, t)) (map fst ps) ts
222 let fields = zipWith (\name (TypedValue _ _ t) -> (name, t)) (map fst ps) ts
224 ty = TypeApp tyObject $ rowFromList (fields, REmpty)
223 ty = TypeApp tyObject $ rowFromList (fields, REmpty)
225 return $ TypedValue True (ObjectLiteral (zip (map fst ps) ts)) ty
224 return $ TypedValue True (ObjectLiteral (zip (map fst ps) ts)) ty
226infer' (ObjectUpdate o ps) = do
225infer' (ObjectUpdate o ps) = do
227 ensureNoDuplicateProperties ps
226 ensureNoDuplicateProperties ps
228 row <- fresh
227 row <- fresh
229− newVals <- zipWith (\(name, _) t -> (name, t)) ps <$> mapM (infer . snd) ps
228+ newVals <- zipWith (\(name, _) t -> (name, t)) ps <$> traverse (infer . snd) ps
230 let newTys = map (\(name, TypedValue _ _ ty) -> (name, ty)) newVals
229 let newTys = map (\(name, TypedValue _ _ ty) -> (name, ty)) newVals
231 oldTys <- zip (map fst ps) <$> replicateM (length ps) fresh
230 oldTys <- zip (map fst ps) <$> replicateM (length ps) fresh
232 let oldTy = TypeApp tyObject $ rowFromList (oldTys, row)
231 let oldTy = TypeApp tyObject $ rowFromList (oldTys, row)
@@ -365,7 +364,7 @@ inferBinder val (ObjectBinder props) = do
365 return $ m1 `M.union` m2
364 return $ m1 `M.union` m2
366inferBinder val (ArrayBinder binders) = do
365inferBinder val (ArrayBinder binders) = do
367 el <- fresh
366 el <- fresh
368− m1 <- M.unions <$> mapM (inferBinder el) binders
367+ m1 <- M.unions <$> traverse (inferBinder el) binders
369 val =?= TypeApp tyArray el
368 val =?= TypeApp tyArray el
370 return m1
369 return m1
371inferBinder val (NamedBinder name binder) = do
370inferBinder val (NamedBinder name binder) = do
src/Language/PureScript/Types.hs+3−4
@@ -16,10 +16,12 @@
16{-# LANGUAGE DeriveDataTypeable #-}
16{-# LANGUAGE DeriveDataTypeable #-}
17{-# LANGUAGE GeneralizedNewtypeDeriving #-}
17{-# LANGUAGE GeneralizedNewtypeDeriving #-}
18{-# LANGUAGE TemplateHaskell #-}
18{-# LANGUAGE TemplateHaskell #-}
19−{-# LANGUAGE CPP #-}
20
19
21module Language.PureScript.Types where
20module Language.PureScript.Types where
22
21
22+import Prelude ()
23+import Prelude.Compat
24+
23import Data.Data
25import Data.Data
24import Data.List (nub)
26import Data.List (nub)
25import Data.Maybe (fromMaybe)
27import Data.Maybe (fromMaybe)
@@ -28,9 +30,6 @@ import qualified Data.Aeson.TH as A
28
30
29import Control.Monad.Unify
31import Control.Monad.Unify
30import Control.Arrow (second)
32import Control.Arrow (second)
31−#if __GLASGOW_HASKELL__ < 710
32−import Control.Applicative
33−#endif
34import Control.Monad ((<=<))
33import Control.Monad ((<=<))
35
34
36import Language.PureScript.Names
35import Language.PureScript.Names
tests/Main.hs+3−7
@@ -16,7 +16,6 @@
16{-# LANGUAGE TupleSections #-}
16{-# LANGUAGE TupleSections #-}
17{-# LANGUAGE GeneralizedNewtypeDeriving #-}
17{-# LANGUAGE GeneralizedNewtypeDeriving #-}
18{-# LANGUAGE FlexibleInstances #-}
18{-# LANGUAGE FlexibleInstances #-}
19−{-# LANGUAGE CPP #-}
20
19
21-- Failing tests can specify the kind of error that should be thrown with a
20-- Failing tests can specify the kind of error that should be thrown with a
22-- @shouldFailWith declaration. For example:
21-- @shouldFailWith declaration. For example:
@@ -35,6 +34,9 @@
35
34
36module Main (main) where
35module Main (main) where
37
36
37+import Prelude ()
38+import Prelude.Compat
39+
38import qualified Language.PureScript as P
40import qualified Language.PureScript as P
39import qualified Language.PureScript.CodeGen.JS as J
41import qualified Language.PureScript.CodeGen.JS as J
40import qualified Language.PureScript.CoreFn as CF
42import qualified Language.PureScript.CoreFn as CF
@@ -42,18 +44,12 @@ import qualified Language.PureScript.CoreFn as CF
42import Data.Char (isSpace)
44import Data.Char (isSpace)
43import Data.Maybe (mapMaybe, fromMaybe)
45import Data.Maybe (mapMaybe, fromMaybe)
44import Data.List (isSuffixOf, sort, stripPrefix)
46import Data.List (isSuffixOf, sort, stripPrefix)
45−#if __GLASGOW_HASKELL__ < 710
46−import Data.Traversable (traverse)
47−#endif
48import Data.Time.Clock (UTCTime())
47import Data.Time.Clock (UTCTime())
49
48
50import qualified Data.Map as M
49import qualified Data.Map as M
51
50
52import Control.Monad
51import Control.Monad
53import Control.Monad.IO.Class (liftIO)
52import Control.Monad.IO.Class (liftIO)
54−#if __GLASGOW_HASKELL__ < 710
55−import Control.Applicative
56−#endif
57import Control.Arrow ((>>>))
53import Control.Arrow ((>>>))
58
54
59import Control.Monad.Reader
55import Control.Monad.Reader
tests/common/TestsSetup.hs+3−8
@@ -10,18 +10,13 @@
10-- |
10-- |
11--
11--
12-----------------------------------------------------------------------------
12-----------------------------------------------------------------------------
13−
14−{-# LANGUAGE CPP #-}
15−
16module TestsSetup where
13module TestsSetup where
17
14
18−import Data.Maybe (fromMaybe)
15+import Prelude ()
16+import Prelude.Compat
19
17
20−#if __GLASGOW_HASKELL__ < 710
18+import Data.Maybe (fromMaybe)
21−import Control.Applicative
22−#endif
23import Control.Monad
19import Control.Monad
24−
25import Control.Monad.Trans.Maybe
20import Control.Monad.Trans.Maybe
26
21
27import System.Process
22import System.Process