git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix building on ghc-7.6 (base 4.6) for #713
7c90e56Dylan Simon
psc-make/Main.hs+1−2
@@ -19,7 +19,6 @@ module Main where
19import Control.Applicative
19import Control.Applicative
20import Control.Monad.Error
20import Control.Monad.Error
21
21
22−import Data.Bool (bool)
23import Data.Version (showVersion)
22import Data.Version (showVersion)
24
23
25import System.Console.CmdTheLine
24import System.Console.CmdTheLine
@@ -41,7 +40,7 @@ data InputOptions = InputOptions
41readInput :: InputOptions -> IO [(Either P.RebuildPolicy FilePath, String)]
40readInput :: InputOptions -> IO [(Either P.RebuildPolicy FilePath, String)]
42readInput InputOptions{..} = do
41readInput InputOptions{..} = do
43 content <- forM ioInputFiles $ \inputFile -> (Right inputFile, ) <$> U.readFile inputFile
42 content <- forM ioInputFiles $ \inputFile -> (Right inputFile, ) <$> U.readFile inputFile
44− return $ bool ((Left P.RebuildNever, P.prelude) :) id ioNoPrelude content
43+ return (if ioNoPrelude then content else (Left P.RebuildNever, P.prelude) : content)
45
44
46newtype Make a = Make { unMake :: ErrorT String IO a } deriving (Functor, Applicative, Monad, MonadIO, MonadError String)
45newtype Make a = Make { unMake :: ErrorT String IO a } deriving (Functor, Applicative, Monad, MonadIO, MonadError String)
47
46
psc/Main.hs+1−2
@@ -19,7 +19,6 @@ module Main where
19import Control.Applicative
19import Control.Applicative
20import Control.Monad.Error
20import Control.Monad.Error
21
21
22−import Data.Bool (bool)
23import Data.Maybe (fromMaybe)
22import Data.Maybe (fromMaybe)
24import Data.Version (showVersion)
23import Data.Version (showVersion)
25
24
@@ -43,7 +42,7 @@ readInput :: InputOptions -> IO [(Maybe FilePath, String)]
43readInput InputOptions{..}
42readInput InputOptions{..}
44 | ioUseStdIn = return . (Nothing ,) <$> getContents
43 | ioUseStdIn = return . (Nothing ,) <$> getContents
45 | otherwise = do content <- forM ioInputFiles $ \inputFile -> (Just inputFile, ) <$> U.readFile inputFile
44 | otherwise = do content <- forM ioInputFiles $ \inputFile -> (Just inputFile, ) <$> U.readFile inputFile
46− return $ bool ((Nothing, P.prelude) :) id ioNoPrelude content
45+ return (if ioNoPrelude then content else (Nothing, P.prelude) : content)
47
46
48compile :: P.Options P.Compile -> Bool -> [FilePath] -> Maybe FilePath -> Maybe FilePath -> Bool -> IO ()
47compile :: P.Options P.Compile -> Bool -> [FilePath] -> Maybe FilePath -> Maybe FilePath -> Bool -> IO ()
49compile opts stdin input output externs usePrefix = do
48compile opts stdin input output externs usePrefix = do
purescript.cabal+1−1
@@ -24,7 +24,7 @@ source-repository head
24 location: https://github.com/purescript/purescript.git
24 location: https://github.com/purescript/purescript.git
25
25
26library
26library
27− build-depends: base >=4 && <5,
27+ build-depends: base >=4.6 && <5,
28 cmdtheline == 0.2.*,
28 cmdtheline == 0.2.*,
29 containers -any,
29 containers -any,
30 unordered-containers -any,
30 unordered-containers -any,
src/Language/PureScript.hs+6−2
@@ -42,7 +42,6 @@ import Data.Time.Clock
42import Data.Function (on)
42import Data.Function (on)
43import Data.Maybe (fromMaybe)
43import Data.Maybe (fromMaybe)
44import Data.FileEmbed (embedFile)
44import Data.FileEmbed (embedFile)
45−import Data.Traversable (traverse)
46
45
47import Control.Monad.Error
46import Control.Monad.Error
48import Control.Arrow ((&&&))
47import Control.Arrow ((&&&))
@@ -142,6 +141,11 @@ data RebuildPolicy
142 -- | Always rebuild this module
141 -- | Always rebuild this module
143 | RebuildAlways deriving (Show, Eq, Ord)
142 | RebuildAlways deriving (Show, Eq, Ord)
144
143
144+-- Traverse (Either e) instance (base 4.7)
145+traverseEither :: Applicative f => (a -> f b) -> Either e a -> f (Either e b)
146+traverseEither _ (Left x) = pure (Left x)
147+traverseEither f (Right y) = Right <$> f y
148+
145-- |
149-- |
146-- Compiles in "make" mode, compiling each module separately to a js files and an externs file
150-- Compiles in "make" mode, compiling each module separately to a js files and an externs file
147--
151--
@@ -163,7 +167,7 @@ make outputDir opts ms prefix = do
163
167
164 jsTimestamp <- getTimestamp jsFile
168 jsTimestamp <- getTimestamp jsFile
165 externsTimestamp <- getTimestamp externsFile
169 externsTimestamp <- getTimestamp externsFile
166− inputTimestamp <- traverse getTimestamp inputFile
170+ inputTimestamp <- traverseEither getTimestamp inputFile
167
171
168 return $ case (inputTimestamp, jsTimestamp, externsTimestamp) of
172 return $ case (inputTimestamp, jsTimestamp, externsTimestamp) of
169 (Right (Just t1), Just t2, Just t3) | t1 < min t2 t3 -> s
173 (Right (Just t1), Just t2, Just t3) | t1 < min t2 t3 -> s
src/Language/PureScript/Sugar/CaseDeclarations.hs+5−1
@@ -19,7 +19,6 @@ module Language.PureScript.Sugar.CaseDeclarations (
19 desugarCasesModule
19 desugarCasesModule
20) where
20) where
21
21
22−import Data.Either (isLeft)
23import Data.Monoid ((<>))
22import Data.Monoid ((<>))
24import Data.List (nub, groupBy)
23import Data.List (nub, groupBy)
25
24
@@ -35,6 +34,11 @@ import Language.PureScript.Supply
35import Language.PureScript.Traversals
34import Language.PureScript.Traversals
36import Language.PureScript.TypeChecker.Monad (guardWith)
35import Language.PureScript.TypeChecker.Monad (guardWith)
37
36
37+-- Data.Either.isLeft (base 4.7)
38+isLeft :: Either a b -> Bool
39+isLeft (Left _) = True
40+isLeft (Right _) = False
41+
38-- |
42-- |
39-- Replace all top-level binders in a module with case expressions.
43-- Replace all top-level binders in a module with case expressions.
40--
44--