summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilFreeman <>2014-07-04 18:07:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2014-07-04 18:07:00 (GMT)
commit3345c3dda7db1f188af95405d6464594f2df901f (patch)
treed74d68caec0352ed31fe1458cbec01677bda32bb
parent44a53b9bc9a3d7dd07de606104056b6aea068eb8 (diff)
version 0.5.2.60.5.2.6
-rw-r--r--prelude/prelude.purs22
-rw-r--r--psc/Main.hs5
-rw-r--r--purescript.cabal2
-rw-r--r--src/Language/PureScript/TypeChecker/Types.hs4
4 files changed, 24 insertions, 9 deletions
diff --git a/prelude/prelude.purs b/prelude/prelude.purs
index 9edeb7e..0900929 100644
--- a/prelude/prelude.purs
+++ b/prelude/prelude.purs
@@ -7,7 +7,7 @@ module Prelude
, ($), (#)
, (:), cons
, Show, show
- , Functor, (<$>)
+ , Functor, (<$>), void
, Apply, (<*>)
, Applicative, pure, liftA1
, Alternative, empty, (<|>)
@@ -116,6 +116,9 @@ module Prelude
class Functor f where
(<$>) :: forall a b. (a -> b) -> f a -> f b
+ void :: forall f a. (Functor f) => f a -> f Unit
+ void fa = const unit <$> fa
+
infixl 4 <*>
class (Functor f) <= Apply f where
@@ -267,10 +270,21 @@ module Prelude
(==) = refEq
(/=) = refIneq
+ foreign import eqArrayImpl
+ "function eqArrayImpl(f) {\
+ \ return function(xs) {\
+ \ return function(ys) {\
+ \ if (xs.length !== ys.length) return false;\
+ \ for (var i = 0; i < xs.length; i++) {\
+ \ if (!f(xs[i])(ys[i])) return false;\
+ \ }\
+ \ return true;\
+ \ };\
+ \ };\
+ \}" :: forall a. (a -> a -> Boolean) -> [a] -> [a] -> Boolean
+
instance eqArray :: (Eq a) => Eq [a] where
- (==) [] [] = true
- (==) (x:xs) (y:ys) = x == y && xs == ys
- (==) _ _ = false
+ (==) xs ys = eqArrayImpl (==) xs ys
(/=) xs ys = not (xs == ys)
data Ordering = LT | GT | EQ
diff --git a/psc/Main.hs b/psc/Main.hs
index ecad91d..e70b068 100644
--- a/psc/Main.hs
+++ b/psc/Main.hs
@@ -25,6 +25,7 @@ import System.Console.CmdTheLine
import System.Directory (createDirectoryIfMissing)
import System.FilePath (takeDirectory)
import System.Exit (exitSuccess, exitFailure)
+import System.IO (stderr)
import Text.Parsec (ParseError)
@@ -51,12 +52,12 @@ compile opts input output externs = do
modules <- readInput input
case modules of
Left err -> do
- U.print err
+ U.hPutStr stderr $ show err
exitFailure
Right ms -> do
case P.compile opts (map snd ms) of
Left err -> do
- U.putStrLn err
+ U.hPutStrLn stderr err
exitFailure
Right (js, exts, _) -> do
case output of
diff --git a/purescript.cabal b/purescript.cabal
index 96d47e6..743f0bf 100644
--- a/purescript.cabal
+++ b/purescript.cabal
@@ -1,5 +1,5 @@
name: purescript
-version: 0.5.2.5
+version: 0.5.2.6
cabal-version: >=1.8
build-type: Custom
license: MIT
diff --git a/src/Language/PureScript/TypeChecker/Types.hs b/src/Language/PureScript/TypeChecker/Types.hs
index 39213bf..3b9f266 100644
--- a/src/Language/PureScript/TypeChecker/Types.hs
+++ b/src/Language/PureScript/TypeChecker/Types.hs
@@ -600,8 +600,8 @@ infer' v@(BooleanLiteral _) = return $ TypedValue True v tyBoolean
infer' (ArrayLiteral vals) = do
ts <- mapM infer vals
els <- fresh
- forM_ ts $ \(TypedValue _ _ t) -> els =?= TypeApp tyArray t
- return $ TypedValue True (ArrayLiteral ts) els
+ forM_ ts $ \(TypedValue _ _ t) -> els =?= t
+ return $ TypedValue True (ArrayLiteral ts) (TypeApp tyArray els)
infer' (ObjectLiteral ps) = do
ensureNoDuplicateProperties ps
ts <- mapM (infer . snd) ps