git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix building on ghc-7.6 (base 4.6) for #713

Just add missing functions or rewrite in simple cases. Also add explicit base version requirement.

commit7c90e56ee7713dec355cd4ab79fb1e95e18f7184 authorDylan Simon <dylan@dylex.net> dateTue 18 Nov 2014, 14:49 (12 years ago) parent74d7de7
5 files changed+14−8
psc-make/Main.hs+1−2 psc/Main.hs+1−2 purescript.cabal+1−1 src/Language/PureScript.hs+6−2 src/Language/PureScript/Sugar/CaseDeclarations.hs+5−1
psc-make/Main.hs+1−2
@@ -19,7 +19,6 @@ module Main where
1919import Control.Applicative
2020import Control.Monad.Error
2121
22−import Data.Bool (bool)
2322import Data.Version (showVersion)
2423
2524import System.Console.CmdTheLine
@@ -41,7 +40,7 @@ data InputOptions = InputOptions
4140readInput :: InputOptions -> IO [(Either P.RebuildPolicy FilePath, String)]
4241readInput InputOptions{..} = do
4342 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)
4544
4645newtype Make a = Make { unMake :: ErrorT String IO a } deriving (Functor, Applicative, Monad, MonadIO, MonadError String)
4746
psc/Main.hs+1−2
@@ -19,7 +19,6 @@ module Main where
1919import Control.Applicative
2020import Control.Monad.Error
2121
22−import Data.Bool (bool)
2322import Data.Maybe (fromMaybe)
2423import Data.Version (showVersion)
2524
@@ -43,7 +42,7 @@ readInput :: InputOptions -> IO [(Maybe FilePath, String)]
4342readInput InputOptions{..}
4443 | ioUseStdIn = return . (Nothing ,) <$> getContents
4544 | 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)
4746
4847compile :: P.Options P.Compile -> Bool -> [FilePath] -> Maybe FilePath -> Maybe FilePath -> Bool -> IO ()
4948compile opts stdin input output externs usePrefix = do
purescript.cabal+1−1
@@ -24,7 +24,7 @@ source-repository head
2424 location: https://github.com/purescript/purescript.git
2525
2626library
27− build-depends: base >=4 && <5,
27+ build-depends: base >=4.6 && <5,
2828 cmdtheline == 0.2.*,
2929 containers -any,
3030 unordered-containers -any,
src/Language/PureScript.hs+6−2
@@ -42,7 +42,6 @@ import Data.Time.Clock
4242import Data.Function (on)
4343import Data.Maybe (fromMaybe)
4444import Data.FileEmbed (embedFile)
45−import Data.Traversable (traverse)
4645
4746import Control.Monad.Error
4847import Control.Arrow ((&&&))
@@ -142,6 +141,11 @@ data RebuildPolicy
142141 -- | Always rebuild this module
143142 | RebuildAlways deriving (Show, Eq, Ord)
144143
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+
145149-- |
146150-- Compiles in "make" mode, compiling each module separately to a js files and an externs file
147151--
@@ -163,7 +167,7 @@ make outputDir opts ms prefix = do
163167
164168 jsTimestamp <- getTimestamp jsFile
165169 externsTimestamp <- getTimestamp externsFile
166− inputTimestamp <- traverse getTimestamp inputFile
170+ inputTimestamp <- traverseEither getTimestamp inputFile
167171
168172 return $ case (inputTimestamp, jsTimestamp, externsTimestamp) of
169173 (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 (
1919 desugarCasesModule
2020) where
2121
22−import Data.Either (isLeft)
2322import Data.Monoid ((<>))
2423import Data.List (nub, groupBy)
2524
@@ -35,6 +34,11 @@ import Language.PureScript.Supply
3534import Language.PureScript.Traversals
3635import Language.PureScript.TypeChecker.Monad (guardWith)
3736
37+-- Data.Either.isLeft (base 4.7)
38+isLeft :: Either a b -> Bool
39+isLeft (Left _) = True
40+isLeft (Right _) = False
41+
3842-- |
3943-- Replace all top-level binders in a module with case expressions.
4044--