purescript 0.6.1 → 0.6.1.1
raw patch · 12 files changed
+51/−35 lines, 12 filesdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
- Language.PureScript.Constants: (&) :: String
- Language.PureScript.Constants: (^) :: String
- Language.PureScript.Constants: bar :: String
+ Language.PureScript.Constants: (.&.) :: String
+ Language.PureScript.Constants: (.^.) :: String
+ Language.PureScript.Constants: (.|.) :: String
Files
- examples/passing/Guards.purs +6/−0
- examples/passing/Operators.purs +4/−0
- prelude/prelude.purs +10/−10
- psc-make/Main.hs +1/−2
- psc/Main.hs +1/−2
- purescript.cabal +2/−2
- src/Language/PureScript.hs +6/−2
- src/Language/PureScript/Constants.hs +6/−6
- src/Language/PureScript/Optimizer/Inliner.hs +3/−3
- src/Language/PureScript/Parser/Common.hs +1/−1
- src/Language/PureScript/Parser/Declarations.hs +6/−6
- src/Language/PureScript/Sugar/CaseDeclarations.hs +5/−1
examples/passing/Guards.purs view
@@ -20,4 +20,10 @@ _ | m < n -> n | otherwise -> m + testIndentation :: Number -> Number -> Number+ testIndentation x y | x > 0 + = x + y+ | otherwise + = y - x+ main = Debug.Trace.trace $ min "Done" "ZZZZ"
examples/passing/Operators.purs view
@@ -61,6 +61,9 @@ test15 :: Number -> Number -> Boolean test15 a b = const false $ a `test14` b + test16 :: Number -> Number -> Number + test16 x y = x .|. y .&. y+ main = do let t1 = test1 1 2 (\x y -> x + y) let t2 = test2@@ -77,4 +80,5 @@ let t13 = test13 k 1 2 let t14 = test14 1 2 let t15 = test15 1 2+ let t16 = test16 1 2 trace "Done"
prelude/prelude.purs view
@@ -17,7 +17,7 @@ , negate , Eq, (==), (/=), refEq, refIneq , Ord, Ordering(..), compare, (<), (>), (<=), (>=)- , Bits, (&), (|), (^), shl, shr, zshr, complement+ , Bits, (.&.), (.|.), (.^.), shl, shr, zshr, complement , BoolLike, (&&), (||) , not , Semigroup, (<>), (++)@@ -372,14 +372,14 @@ EQ -> compare xs ys other -> other - infixl 10 &- infixl 10 |- infixl 10 ^+ infixl 10 .&.+ infixl 10 .|.+ infixl 10 .^. class Bits b where- (&) :: b -> b -> b- (|) :: b -> b -> b- (^) :: b -> b -> b+ (.&.) :: b -> b -> b+ (.|.) :: b -> b -> b+ (.^.) :: b -> b -> b shl :: b -> Number -> b shr :: b -> Number -> b zshr :: b -> Number -> b@@ -426,9 +426,9 @@ \}" :: Number -> Number instance bitsNumber :: Bits Number where- (&) = numAnd- (|) = numOr- (^) = numXor+ (.&.) = numAnd+ (.|.) = numOr+ (.^.) = numXor shl = numShl shr = numShr zshr = numZshr
psc-make/Main.hs view
@@ -19,7 +19,6 @@ import Control.Applicative import Control.Monad.Error -import Data.Bool (bool) import Data.Version (showVersion) import System.Console.CmdTheLine@@ -41,7 +40,7 @@ readInput :: InputOptions -> IO [(Either P.RebuildPolicy FilePath, String)] readInput InputOptions{..} = do content <- forM ioInputFiles $ \inputFile -> (Right inputFile, ) <$> U.readFile inputFile- return $ bool ((Left P.RebuildNever, P.prelude) :) id ioNoPrelude content+ return (if ioNoPrelude then content else (Left P.RebuildNever, P.prelude) : content) newtype Make a = Make { unMake :: ErrorT String IO a } deriving (Functor, Applicative, Monad, MonadIO, MonadError String)
psc/Main.hs view
@@ -19,7 +19,6 @@ import Control.Applicative import Control.Monad.Error -import Data.Bool (bool) import Data.Maybe (fromMaybe) import Data.Version (showVersion) @@ -43,7 +42,7 @@ readInput InputOptions{..} | ioUseStdIn = return . (Nothing ,) <$> getContents | otherwise = do content <- forM ioInputFiles $ \inputFile -> (Just inputFile, ) <$> U.readFile inputFile- return $ bool ((Nothing, P.prelude) :) id ioNoPrelude content+ return (if ioNoPrelude then content else (Nothing, P.prelude) : content) compile :: P.Options P.Compile -> Bool -> [FilePath] -> Maybe FilePath -> Maybe FilePath -> Bool -> IO () compile opts stdin input output externs usePrefix = do
purescript.cabal view
@@ -1,5 +1,5 @@ name: purescript-version: 0.6.1+version: 0.6.1.1 cabal-version: >=1.8 build-type: Simple license: MIT@@ -24,7 +24,7 @@ location: https://github.com/purescript/purescript.git library- build-depends: base >=4 && <5,+ build-depends: base >=4.6 && <5, cmdtheline == 0.2.*, containers -any, unordered-containers -any,
src/Language/PureScript.hs view
@@ -42,7 +42,6 @@ import Data.Function (on) import Data.Maybe (fromMaybe) import Data.FileEmbed (embedFile)-import Data.Traversable (traverse) import Control.Monad.Error import Control.Arrow ((&&&))@@ -142,6 +141,11 @@ -- | Always rebuild this module | RebuildAlways deriving (Show, Eq, Ord) +-- Traverse (Either e) instance (base 4.7)+traverseEither :: Applicative f => (a -> f b) -> Either e a -> f (Either e b)+traverseEither _ (Left x) = pure (Left x)+traverseEither f (Right y) = Right <$> f y+ -- | -- Compiles in "make" mode, compiling each module separately to a js files and an externs file --@@ -163,7 +167,7 @@ jsTimestamp <- getTimestamp jsFile externsTimestamp <- getTimestamp externsFile- inputTimestamp <- traverse getTimestamp inputFile+ inputTimestamp <- traverseEither getTimestamp inputFile return $ case (inputTimestamp, jsTimestamp, externsTimestamp) of (Right (Just t1), Just t2, Just t3) | t1 < min t2 t3 -> s
src/Language/PureScript/Constants.hs view
@@ -65,14 +65,14 @@ (/=) :: String (/=) = "/=" -(&) :: String-(&) = "&"+(.&.) :: String+(.&.) = ".&." -bar :: String-bar = "|"+(.|.) :: String+(.|.) = ".|." -(^) :: String-(^) = "^"+(.^.) :: String+(.^.) = ".^." (&&) :: String (&&) = "&&"
src/Language/PureScript/Optimizer/Inliner.hs view
@@ -117,9 +117,9 @@ , binaryFunction C.bitsNumber C.shl ShiftLeft , binaryFunction C.bitsNumber C.shr ShiftRight , binaryFunction C.bitsNumber C.zshr ZeroFillShiftRight- , binary C.bitsNumber (C.&) BitwiseAnd- , binary C.bitsNumber C.bar BitwiseOr- , binary C.bitsNumber (C.^) BitwiseXor+ , binary C.bitsNumber (C..&.) BitwiseAnd+ , binary C.bitsNumber (C..|.) BitwiseOr+ , binary C.bitsNumber (C..^.) BitwiseXor , unary C.bitsNumber C.complement BitwiseNot , binary C.boolLikeBoolean (C.&&) And
src/Language/PureScript/Parser/Common.hs view
@@ -71,7 +71,7 @@ -- A list of reserved operators -- reservedOpNames :: [String]-reservedOpNames = [ "=>", "->", "=", ".", "\\" ]+reservedOpNames = [ "=>", "->", "=", ".", "\\", "|" ] -- | -- Valid first characters for an identifier
src/Language/PureScript/Parser/Declarations.hs view
@@ -83,9 +83,9 @@ name <- parseIdent binders <- P.many parseBinderNoParens value <- Left <$> (C.indented *>- C.mark (P.many1 ((,) <$> (C.same *> parseGuard)- <*> (lexeme (indented *> P.char '=') *> parseValueWithWhereClause)- )))+ P.many1 ((,) <$> parseGuard+ <*> (lexeme (indented *> P.char '=') *> parseValueWithWhereClause)+ )) <|> Right <$> (lexeme (indented *> P.char '=') *> parseValueWithWhereClause) return $ ValueDeclaration name Value binders value where@@ -304,9 +304,9 @@ parseCaseAlternative :: P.Parsec String ParseState CaseAlternative parseCaseAlternative = CaseAlternative <$> (return <$> parseBinder) <*> (Left <$> (C.indented *>- C.mark (P.many1 ((,) <$> (C.same *> parseGuard)- <*> (lexeme (indented *> C.reservedOp "->") *> parseValue)- )))+ P.many1 ((,) <$> parseGuard+ <*> (lexeme (indented *> C.reservedOp "->") *> parseValue)+ )) <|> Right <$> (lexeme (indented *> C.reservedOp "->") *> parseValue)) P.<?> "case alternative"
src/Language/PureScript/Sugar/CaseDeclarations.hs view
@@ -19,7 +19,6 @@ desugarCasesModule ) where -import Data.Either (isLeft) import Data.Monoid ((<>)) import Data.List (nub, groupBy) @@ -34,6 +33,11 @@ import Language.PureScript.Supply import Language.PureScript.Traversals import Language.PureScript.TypeChecker.Monad (guardWith)++-- Data.Either.isLeft (base 4.7)+isLeft :: Either a b -> Bool+isLeft (Left _) = True+isLeft (Right _) = False -- | -- Replace all top-level binders in a module with case expressions.