packages feed

purescript 0.6.4 → 0.6.4.1

raw patch · 82 files changed

+365/−278 lines, 82 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

LICENSE view
@@ -41,43 +41,43 @@ base LICENSE file:    This library (libraries/base) is derived from code from several-  sources: -  +  sources:+     * Code from the GHC project which is largely (c) The University of       Glasgow, and distributable under a BSD-style license (see below),-  +     * Code from the Haskell 98 Report which is (c) Simon Peyton Jones       and freely redistributable (but see the full license for       restrictions).-  +     * Code from the Haskell Foreign Function Interface specification,       which is (c) Manuel M. T. Chakravarty and freely redistributable       (but see the full license for restrictions).-  +   The full text of these licenses is reproduced below.  All of the   licenses are BSD-style or compatible.-  +   ------------------------------------------------------------------------------  +   The Glasgow Haskell Compiler License-  -  Copyright 2004, The University Court of the University of Glasgow. ++  Copyright 2004, The University Court of the University of Glasgow.   All rights reserved.-  +   Redistribution and use in source and binary forms, with or without   modification, are permitted provided that the following conditions are met:-  +   - Redistributions of source code must retain the above copyright notice,   this list of conditions and the following disclaimer.-   +   - Redistributions in binary form must reproduce the above copyright notice,   this list of conditions and the following disclaimer in the documentation   and/or other materials provided with the distribution.-   +   - Neither name of the University nor the names of its contributors may be   used to endorse or promote products derived from this software without-  specific prior written permission. -  +  specific prior written permission.+   THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF   GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND@@ -90,14 +90,14 @@   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH   DAMAGE.-  +   ------------------------------------------------------------------------------  +   Code derived from the document "Report on the Programming Language   Haskell 98", is distributed under the following license:-  +     Copyright (c) 2002 Simon Peyton Jones-  +     The authors intend this Report to belong to the entire Haskell     community, and so we grant permission to copy and distribute it for     any purpose, provided that it is reproduced in its entirety,@@ -105,15 +105,15 @@     copied and distributed for any purpose, provided that the modified     version is clearly presented as such, and that it does not claim to     be a definition of the Haskell 98 Language.-  +   ------------------------------------------------------------------------------  +   Code derived from the document "The Haskell 98 Foreign Function   Interface, An Addendum to the Haskell 98 Report" is distributed under   the following license:-  +     Copyright (c) 2002 Manuel M. T. Chakravarty-  +     The authors intend this Report to belong to the entire Haskell     community, and so we grant permission to copy and distribute it for     any purpose, provided that it is reproduced in its entirety,@@ -121,9 +121,9 @@     copied and distributed for any purpose, provided that the modified     version is clearly presented as such, and that it does not claim to     be a definition of the Haskell 98 Foreign Function Interface.-  +   ------------------------------------------------------------------------------  + containers LICENSE file:    The Glasgow Haskell Compiler License@@ -161,7 +161,7 @@ directory LICENSE file:    This library (libraries/base) is derived from code from two-  sources: +  sources:      * Code from the GHC project which is largely (c) The University of       Glasgow, and distributable under a BSD-style license (see below),@@ -177,7 +177,7 @@    The Glasgow Haskell Compiler License -  Copyright 2004, The University Court of the University of Glasgow. +  Copyright 2004, The University Court of the University of Glasgow.   All rights reserved.    Redistribution and use in source and binary forms, with or without@@ -185,14 +185,14 @@    - Redistributions of source code must retain the above copyright notice,   this list of conditions and the following disclaimer.- +   - Redistributions in binary form must reproduce the above copyright notice,   this list of conditions and the following disclaimer in the documentation   and/or other materials provided with the distribution.- +   - Neither name of the University nor the names of its contributors may be   used to endorse or promote products derived from this software without-  specific prior written permission. +  specific prior written permission.    THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF   GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,@@ -451,7 +451,7 @@ process LICENSE file:    This library (libraries/process) is derived from code from two-  sources: +  sources:      * Code from the GHC project which is largely (c) The University of       Glasgow, and distributable under a BSD-style license (see below),@@ -467,7 +467,7 @@    The Glasgow Haskell Compiler License -  Copyright 2004, The University Court of the University of Glasgow. +  Copyright 2004, The University Court of the University of Glasgow.   All rights reserved.    Redistribution and use in source and binary forms, with or without@@ -475,14 +475,14 @@    - Redistributions of source code must retain the above copyright notice,   this list of conditions and the following disclaimer.- +   - Redistributions in binary form must reproduce the above copyright notice,   this list of conditions and the following disclaimer in the documentation   and/or other materials provided with the distribution.- +   - Neither name of the University nor the names of its contributors may be   used to endorse or promote products derived from this software without-  specific prior written permission. +  specific prior written permission.    THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF   GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ examples/failing/DuplicateDeclarationsInLet.purs view
@@ -0,0 +1,9 @@+module Main where++foo = a+  where+  a :: Number+  a = 1++  a :: Number+  a = 2
examples/failing/NewtypeMultiArgs.purs view
examples/failing/NewtypeMultiCtor.purs view
examples/failing/SkolemEscape2.purs view
@@ -6,4 +6,4 @@  test _ = do   r <- runST (newSTRef 0)-  return 0 +  return 0
examples/failing/UnknownType.purs view
+ examples/passing/810.purs view
@@ -0,0 +1,11 @@+module Main where++data Maybe a = Nothing | Just a++test :: forall a. Maybe a -> Maybe a+test m = o.x+  where+    o = case m of Nothing -> { x : Nothing }+                  Just a  -> { x : Just a }++main = Debug.Trace.trace "Done"
examples/passing/BindersInFunctions.purs view
@@ -5,12 +5,14 @@ tail = \(_:xs) -> xs  foreign import error-  "function error(msg) {\-  \  throw msg;\-  \}" :: forall a. String -> a+  """+  function error(msg) {+    throw msg;+  }+  """ :: forall a. String -> a -main = +main =   let ts = tail [1, 2, 3] in-  if ts == [2, 3] +  if ts == [2, 3]   then Debug.Trace.trace "Done"   else error "Incorrect result from 'tails'."
examples/passing/BindingGroups.purs view
@@ -1,6 +1,6 @@ module Main where-  -foo = bar ++foo = bar   where bar r = r + 1  r = foo 2
examples/passing/CheckSynonymBug.purs view
@@ -2,12 +2,14 @@    import Prelude -  type Foo a = [a]  +  type Foo a = [a]    foreign import length-    "function length(a) {\-    \  return a.length;\-    \}" :: forall a. [a] -> Number+    """+    function length(a) {+      return a.length;+    }+    """ :: forall a. [a] -> Number    foo _ = length ([] :: Foo Number) 
examples/passing/Comparisons.purs view
@@ -6,12 +6,14 @@ foreign import data Assert :: !  foreign import assert-  "function assert(x) {\-  \  return function () {\-  \    if (!x) throw new Error('assertion failed');\-  \    return {};\-  \  };\-  \};" :: forall e. Boolean -> Eff (assert :: Assert | e) Unit+  """+  function assert(x) {+    return function() {+      if (!x) throw new Error('assertion failed');+      return {};+    };+  }+  """ :: forall e. Boolean -> Eff (assert :: Assert | e) Unit  main = do   assert (1 < 2)
examples/passing/Conditional.purs view
@@ -2,7 +2,7 @@    import Prelude () -  fns = \f -> if f true then f else \x -> x +  fns = \f -> if f true then f else \x -> x    not = \x -> if x then false else true 
examples/passing/Console.purs view
@@ -9,5 +9,5 @@ replicateM_ n act = do   act   replicateM_ (n - 1) act-    + main = replicateM_ 10 (trace "Hello World!")
examples/passing/DeepArrayBinder.purs view
@@ -6,10 +6,12 @@ match2 (x : y : xs) = x * y + match2 xs match2 _ = 0 -foreign import explode -  "function explode() {\-  \  throw new Error('Incorrect result');\-  \}" :: forall eff a. Eff eff a+foreign import explode+  """+  function explode() {+    throw new Error('Incorrect result');+  }+  """ :: forall eff a. Eff eff a  main = case match2 [1, 2, 3, 4, 5, 6, 7, 8, 9] of   100 -> Debug.Trace.trace "Done"
examples/passing/DeepCase.purs view
@@ -4,9 +4,9 @@ import Control.Monad.Eff import Control.Monad.ST -f x y = +f x y =   let-    g = case y of +    g = case y of 	  0 -> x           x -> 1 + x * x   in g + x + y
examples/passing/Dollar.purs view
@@ -12,5 +12,5 @@ test1 x = id $ id $ id $ id $ x  test2 x = id id $ id x-    + main = Debug.Trace.trace "Done"
examples/passing/EmptyDataDecls.purs view
@@ -11,19 +11,23 @@ nil = ArrayBox []  foreign import concat-  "function concat(l1) {\-  \  return function (l2) {\-  \    return l1.concat(l2);\-  \  };\-  \}" :: forall a. [a] -> [a] -> [a]+  """+  function concat(l1) {+    return function(l2) {+      return l1.concat(l2);+    };+  }+  """ :: forall a. [a] -> [a] -> [a]  cons' :: forall a n. a -> ArrayBox n a -> ArrayBox (S n) a cons' x (ArrayBox xs) = ArrayBox $ concat [x] xs  foreign import error-    "function error(msg) {\-    \  throw msg;\-    \}" :: forall a. String -> a+  """+  function error(msg) {+    throw msg;+  }+  """ :: forall a. String -> a  main = case cons' 1 $ cons' 2 $ cons' 3 nil of          ArrayBox [1, 2, 3] -> Debug.Trace.trace "Done"
examples/passing/EmptyRow.purs view
@@ -1,6 +1,6 @@ module Main where -data Foo r = Foo { | r } +data Foo r = Foo { | r }  test :: Foo () test = Foo {}
examples/passing/ExternRaw.purs view
@@ -1,13 +1,26 @@ module Main where -foreign import first "function first(xs) { return xs[0]; }" :: forall a. [a] -> a+foreign import first+  """+  function first(xs) {+    return xs[0];+  }+  """ :: forall a. [a] -> a -foreign import loop "function loop() { while (true) {} }" :: forall a. a+foreign import loop+  """+  function loop() {+    while (true) {}+  }+  """ :: forall a. a -foreign import concat "function concat(xs) { \-                      \  return function(ys) { \-                      \    return xs.concat(ys); \-                      \  };\-                      \}" :: forall a. [a] -> [a] -> [a]+foreign import concat+  """+  function concat(xs) {+    return function(ys) {+      return xs.concat(ys);+    };+  }+  """ :: forall a. [a] -> [a] -> [a]  main = Debug.Trace.trace "Done"
examples/passing/FFI.purs view
@@ -1,9 +1,11 @@ module Main where -foreign import foo -  "function foo(s) {\-  \  return s;\-  \}" :: String -> String+foreign import foo+  """+  function foo(s) {+    return s;+  }+  """ :: String -> String  bar :: String -> String bar _ = foo "test"
examples/passing/FinalTagless.purs view
@@ -5,7 +5,7 @@ class E e where   num :: Number -> e Number   add :: e Number -> e Number -> e Number-  + type Expr a = forall e. (E e) => e a  data Id a = Id a
examples/passing/FunctionScope.purs view
@@ -5,10 +5,12 @@   mkValue :: Number -> Number   mkValue id = id -  foreign import error -    "function error(msg) {\-    \  throw msg;\-    \}" :: forall a. String -> a+  foreign import error+    """+    function error(msg) {+      throw msg;+    }+    """ :: forall a. String -> a    main = do     let value = mkValue 1
examples/passing/Functions2.purs view
@@ -6,9 +6,11 @@   test = \const _ -> const    foreign import error-    "function error(msg) {\-    \  throw msg;\-    \}" :: forall a. String -> a+    """+    function error(msg) {+      throw msg;+    }+    """ :: forall a. String -> a    main = do     let value = test "Done" {}
examples/passing/Guards.purs view
@@ -21,9 +21,9 @@       | otherwise -> m    testIndentation :: Number -> Number -> Number-  testIndentation x y | x > 0 +  testIndentation x y | x > 0     = x + y-                      | otherwise +                      | otherwise     = y - x    main = Debug.Trace.trace $ min "Done" "ZZZZ"
examples/passing/HoistError.purs view
@@ -4,11 +4,13 @@ import Debug.Trace  foreign import f-  "function f(x) {\-  \  return function () {\-  \    if (x !== 0) throw new Error('x is not 0');\-  \  }\-  \}" :: forall e. Number -> Eff e Number+  """+  function f(x) {+    return function() {+      if (x !== 0) throw new Error('x is not 0');+    };+  }+  """ :: forall e. Number -> Eff e Number  main = do   let x = 0
examples/passing/JSReserved.purs view
@@ -4,9 +4,9 @@    yield = 0   member = 1-  +   public = \return -> return-  +   this catch = catch    main = Debug.Trace.trace "Done"
examples/passing/KindedType.purs view
@@ -26,6 +26,6 @@   def :: a  instance clazzString :: Clazz String where-  def = "test"	+  def = "test"  main = Debug.Trace.trace "Done"
examples/passing/Let.purs view
@@ -4,12 +4,12 @@ import Control.Monad.Eff import Control.Monad.ST -test1 x = let +test1 x = let             y :: Number-            y = x + 1 +            y = x + 1           in y -test2 x y = +test2 x y =   let x' = x + 1 in   let y' = y + 1 in   x' + y'@@ -17,10 +17,10 @@ test3 = let f x y z = x + y + z in         f 1 2 3 -test4 = let f x [y, z] = x y z in +test4 = let f x [y, z] = x y z in         f (+) [1, 2] -test5 = let +test5 = let           f x | x > 0 = g (x / 2) + 1           f x = 0           g x = f (x - 1) + 1@@ -42,12 +42,12 @@         in if f true then f 1 else f 2  test8 :: Number -> Number-test8 x = let +test8 x = let             go y | (x - 0.1 < y * y) && (y * y < x + 0.1) = y             go y = go $ (y + x / y) / 2           in go x -test10 _ = +test10 _ =   let     f x = g x * 3     g x = f x / 2
examples/passing/Monad.purs view
@@ -17,12 +17,12 @@   maybe = { return : Just 	  , bind : \ma f -> case ma of 	      Nothing -> Nothing-	      Just a -> f a +	      Just a -> f a 	  }    test :: forall m. Monad m -> m Number   test = \m -> m.bind (m.return 1) (\n1 ->-		 m.bind (m.return "Test") (\n2 -> +		 m.bind (m.return "Test") (\n2 -> 		   m.return n1))    test1 = test id
examples/passing/MutRec.purs view
@@ -1,4 +1,4 @@-module Main where +module Main where    import Prelude 
examples/passing/MutRec2.purs view
@@ -1,7 +1,7 @@ module Main where  data A = A B- + data B = B A  foreign import data S :: *
examples/passing/MutRec3.purs view
@@ -1,7 +1,7 @@ module Main where  data A = A B- + data B = B A  foreign import data S :: *
examples/passing/NamedPatterns.purs view
@@ -1,6 +1,6 @@ module Main where -  foo = \x -> case x of +  foo = \x -> case x of     y@{ foo = "Foo" } -> y     y -> y 
examples/passing/Newtype.purs view
@@ -12,9 +12,9 @@  instance showBox :: (Show a) => Show (Box a) where   show (Box x) = "Box " ++ show x-  + apply f x = f x- + main = do   print $ Thing "hello"   print $ Box 42
+ examples/passing/NewtypeWithRecordUpdate.purs view
@@ -0,0 +1,15 @@+-- https://github.com/purescript/purescript/issues/812++module Main where++import Debug.Trace++newtype NewType a = NewType (Object a)++rec1 :: Object (a :: Number, b :: Number, c:: Number)+rec1 = { a: 0, b: 0, c: 0 } ++rec2 :: NewType (a :: Number, b :: Number, c :: Number)+rec2 = NewType (rec1 { a = 1 })++main = trace "Done"
examples/passing/ObjectSynonym.purs view
@@ -10,4 +10,4 @@ outer :: Outer outer = { inner: inner } -main = Debug.Trace.trace "Done"  +main = Debug.Trace.trace "Done"
examples/passing/ObjectUpdate2.purs view
@@ -7,7 +7,7 @@ blah :: forall r. X r -> X r blah x = x -test = blah x +test = blah x   { baz = "blah"   } 
examples/passing/Objects.purs view
@@ -31,5 +31,5 @@                { "***": n } -> n    test7 {a:    snoog , b     : blah } = blah-    +   main = Debug.Trace.trace "Done"
examples/passing/OperatorAssociativity.purs view
@@ -6,20 +6,26 @@ foreign import data Assert :: !  foreign import assert-  "function assert(x) { return function (desc) {\-  \  return function () {\-  \    if (!x) throw new Error('assertion (' + desc + ') failed');\-  \    return {};\-  \  };\-  \};};" :: forall e. Boolean -> String -> Eff (assert :: Assert | e) Unit+  """+  function assert(x) {+    return function(desc) {+      return function() {+        if (!x) throw new Error('assertion (' + desc + ') failed');+        return {};+      };+    };+  }+  """ :: forall e. Boolean -> String -> Eff (assert :: Assert | e) Unit  bug :: Number -> Number -> Number bug a b = 0 - (a - b)  foreign import explode-  "function explode() {\-  \  throw new Error('Assertion failed!');\-  \}":: forall eff a. Eff eff a+  """+  function explode() {+    throw new Error('Assertion failed!');+  }+  """ :: forall eff a. Eff eff a  main = do     assert (bug 0 2 == 2)       "bug 0 2 == 2"
examples/passing/Operators.purs view
@@ -2,7 +2,7 @@    import Control.Monad.Eff   import Debug.Trace-  +   (?!) :: forall a. a -> a -> a   (?!) x _ = x @@ -29,7 +29,7 @@    test6 = ((\x -> x) `k` 2) 3 -  (<+>) :: String -> String -> String +  (<+>) :: String -> String -> String   (<+>) = \s1 s2 -> s1 ++ s2    test7 = "Hello" <+> "World!"@@ -39,7 +39,7 @@    foo :: String -> String   foo = \s -> s- +   test8 = foo @@ "Hello World"    test9 = Main.foo @@ "Hello World"@@ -52,7 +52,7 @@   test11 = [1, 2, 3] ... [4, 5, 6]    test12 (<%>) a b = a <%> b-  +   test13 = \(<%>) a b -> a <%> b    test14 :: Number -> Number -> Boolean@@ -61,7 +61,7 @@   test15 :: Number -> Number -> Boolean   test15 a b = const false $ a `test14` b -  test16 :: Number -> Number -> Number +  test16 :: Number -> Number -> Number   test16 x y = x .|. y .&. y    test17 :: Number
examples/passing/OptimizerBug.purs view
@@ -5,5 +5,5 @@ x a = 1 + y a  y a = x a-    + main = Debug.Trace.trace "Done"
examples/passing/PartialFunction.purs view
@@ -1,14 +1,16 @@ module Main where  foreign import testError-  "function testError(f) {\-  \  try {\-  \    return f();\-  \  } catch (e) {\-  \    if (e instanceof Error) return 'success';\-  \    throw new Error('Pattern match failure is not Error');\-  \  }\-  \}" :: (Unit -> Number) -> String+  """+  function testError(f) {+    try {+      return f();+    } catch (e) {+      if (e instanceof Error) return 'success';+      throw new Error('Pattern match failure is not Error');+    }+  }+  """ :: (Unit -> Number) -> String  fn :: Number -> Number fn 0 = 0
examples/passing/Patterns.purs view
@@ -2,7 +2,7 @@    import Prelude -  test = \x -> case x of +  test = \x -> case x of     { str = "Foo", bool = true } -> true     { str = "Bar", bool = b } -> b     _ -> false@@ -17,12 +17,12 @@     _ -> 0  -  h = \o -> case o of +  h = \o -> case o of     a@[_,_,_] -> a     _ -> []    isDesc :: [Number] -> Boolean   isDesc [x, y] | x > y = true   isDesc _ = false-    +   main = Debug.Trace.trace "Done"
examples/passing/Person.purs view
@@ -4,13 +4,15 @@    data Person = Person { name :: String, age :: Number } -  foreign import itoa -    "function itoa(n) {\-    \  return n.toString();\-    \}" :: Number -> String-	  +  foreign import itoa+    """+    function itoa(n) {+      return n.toString();+    }+    """ :: Number -> String+   showPerson :: Person -> String   showPerson = \p -> case p of     Person o -> o.name ++ ", aged " ++ itoa(o.age)-    +   main = Debug.Trace.trace "Done"
examples/passing/Rank2Data.purs view
@@ -25,5 +25,5 @@   two = succ zero   four = add two two   fourNumber = runNat four-   +   main = Debug.Trace.trace "Done"
examples/passing/Rank2TypeSynonym.purs view
@@ -3,10 +3,10 @@ import Control.Monad.Eff  type Foo a = forall f. (Monad f) => f a- + foo :: forall a. a -> Foo a foo x = pure x- + bar :: Foo Number bar = foo 3 
examples/passing/Rank2Types.purs view
@@ -7,5 +7,5 @@    forever :: forall m a b. (forall a b. m a -> (a -> m b) -> m b) -> m a -> m b   forever = \bind action -> bind action $ \_ -> forever bind action-    +   main = Debug.Trace.trace "Done"
examples/passing/Recursion.purs view
@@ -6,5 +6,5 @@     0 -> 1     1 -> 1     n -> fib (n - 1) + fib (n - 2)-   +   main = Debug.Trace.trace "Done"
examples/passing/Sequence.purs view
@@ -4,9 +4,9 @@  class Sequence t where   sequence :: forall m a. (Monad m) => t (m a) -> m (t a)-  + instance sequenceArray :: Sequence [] where   sequence [] = pure []-  sequence (x:xs) = (:) <$> x <*> sequence xs +  sequence (x:xs) = (:) <$> x <*> sequence xs  main = sequence $ [Debug.Trace.trace "Done"]
examples/passing/ShadowedRename.purs view
@@ -4,11 +4,13 @@ import Debug.Trace  foreign import f-  "function f(x) {\-  \  return function () {\-  \    if (x !== 2) throw new Error('x is not 2');\-  \  }\-  \}" :: forall e. Number -> Eff e Number+  """+  function f(x) {+    return function() {+      if (x !== 2) throw new Error('x is not 2');+    };+  }+  """ :: forall e. Number -> Eff e Number  foo foo = let foo_1 = \_ -> foo               foo_2 = foo_1 unit + 1
examples/passing/ShadowedTCOLet.purs view
@@ -1,7 +1,7 @@ module Main where -f x y z = -  let f 1 2 3 = 1 +f x y z =+  let f 1 2 3 = 1   in f x z y-  + main = Debug.Trace.trace $ show $ f 1 3 2
examples/passing/SignedNumericLiterals.purs view
@@ -6,10 +6,10 @@   y = -0.5   z = 0.5   w = 1- +   f :: Number -> Number   f x = -x    test1 = 2 - 1-  +   main = Debug.Trace.trace "Done"
examples/passing/Superclasses3.purs view
@@ -33,7 +33,7 @@ instance bindMTrace :: Bind MTrace where   (>>=) m f = MTrace (runMTrace m >>= (runMTrace <<< f)) -instance monadMTrace :: Monad MTrace +instance monadMTrace :: Monad MTrace  instance writerMTrace :: MonadWriter String MTrace where   tell s = MTrace (trace s)
examples/passing/TailCall.purs view
@@ -9,7 +9,7 @@ loop :: forall a. Number -> a loop x = loop (x + 1) -notATailCall = \x -> +notATailCall = \x ->   (\notATailCall -> notATailCall x) (\x -> x)-    + main = Debug.Trace.print (test 0 [1, 2, 3])
examples/passing/TopLevelCase.purs view
@@ -14,5 +14,5 @@   data A = A    parseTest A 0 = 0-    +   main = Debug.Trace.trace "Done"
examples/passing/TypeClassImport.purs view
@@ -7,9 +7,9 @@ foreign import t "var t = null;" :: T  foreign import inst """-  var inst = { -    show: function(t) { -      return 'Done'; +  var inst = {+    show: function(t) {+      return 'Done';     }   }""" :: C 
examples/passing/TypeClassMemberOrderChange.purs view
@@ -3,7 +3,7 @@ class Test a where   fn :: a -> a -> a   val :: a-  + instance testBoolean :: Test Boolean where   val = true   fn x y = y
examples/passing/TypeDecl.purs view
@@ -8,5 +8,5 @@   iterate :: forall a. Number -> (a -> a) -> a -> a   iterate 0 f a = a   iterate n f a = iterate (n - 1) f (f a)-    +   main = Debug.Trace.trace "Done"
examples/passing/TypeSynonyms.purs view
@@ -1,6 +1,6 @@ module Main where -  type Lens a b = +  type Lens a b =     { get :: a -> b     , set :: a -> b -> a     }@@ -14,7 +14,7 @@   type Pair a b = { fst :: a, snd :: b }    fst :: forall a b. Lens (Pair a b) a-  fst = +  fst =     { get: \p -> p.fst     , set: \p a -> { fst: a, snd: p.snd }     }
examples/passing/TypeWildcardsRecordExtension.purs view
@@ -1,5 +1,5 @@ module Main where-    + foo :: forall a. {b :: Number | a} -> {b :: Number | _} foo f = f 
examples/passing/Where.purs view
@@ -7,24 +7,24 @@ test1 x = y   where   y :: Number-  y = x + 1 +  y = x + 1  test2 x y = x' + y'   where   x' = x + 1   y' = y + 1-   + test3 = f 1 2 3   where f x y z = x + y + z-         + test4 = f (+) [1, 2]   where f x [y, z] = x y z-         + test5 = g 10-  where +  where   f x | x > 0 = g (x / 2) + 1   f x = 0   g x = f (x - 1) + 1@@ -35,7 +35,7 @@  test7 :: Number -> Number test7 x = go x-  where +  where   go y | (x - 0.1 < y * y) && (y * y < x + 0.1) = y   go y = go $ (y + x / y) / 2 
examples/passing/s.purs view
@@ -1,5 +1,5 @@ module Main where    s = \x y z -> x z (y z)-    +   main = Debug.Trace.trace "Done"
psc-docs/Main.hs view
@@ -136,7 +136,7 @@ renderDeclaration n _ (P.TypeSynonymDeclaration name args ty) = do   let     typeApp  = foldl P.TypeApp (P.TypeConstructor (P.Qualified Nothing name)) (map toTypeVar args)-    typeName = prettyPrintType' typeApp    +    typeName = prettyPrintType' typeApp   atIndent n $ "type " ++ typeName ++ " = " ++ prettyPrintType' ty renderDeclaration n exps (P.TypeClassDeclaration name args implies ds) = do   let impliesText = case implies of@@ -161,7 +161,7 @@ renderComments n cs = mapM_ (atIndent n) ls   where   ls = concatMap toLines cs-  +   toLines (P.LineComment s) = [s]   toLines (P.BlockComment s) = lines s @@ -217,7 +217,7 @@   <> help "The input .purs file(s)"  includeHeirarcy :: Parser Bool-includeHeirarcy = switch $ +includeHeirarcy = switch $      long "hierarchy-images"   <> help "Include markdown for type class hierarchy images in the output." @@ -232,6 +232,6 @@   infoModList = fullDesc <> headerInfo <> footerInfo   headerInfo  = header   "psc-docs - Generate Markdown documentation from PureScript extern files"   footerInfo  = footer $ "psc-docs " ++ showVersion Paths.version-  +   version :: Parser (a -> a)   version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden
psc-make/Main.hs view
@@ -111,12 +111,12 @@   <> help "The output directory"  noTco :: Parser Bool-noTco = switch $ +noTco = switch $      long "no-tco"   <> help "Disable tail call optimizations"  noPrelude :: Parser Bool-noPrelude = switch $ +noPrelude = switch $      long "no-prelude"   <> help "Omit the Prelude" @@ -137,15 +137,15 @@   <> help "Display verbose error messages"  noPrefix :: Parser Bool-noPrefix = switch $ +noPrefix = switch $      short 'p'   <> long "no-prefix"   <> help "Do not include comment header"   options :: Parser (P.Options P.Make)-options = P.Options <$> noPrelude -                    <*> noTco +options = P.Options <$> noPrelude+                    <*> noTco                     <*> noMagicDo                     <*> pure Nothing                     <*> noOpts@@ -153,9 +153,9 @@                     <*> pure P.MakeOptions  pscMakeOptions :: Parser PSCMakeOptions-pscMakeOptions = PSCMakeOptions <$> many inputFile -                                <*> outputDirectory -                                <*> options +pscMakeOptions = PSCMakeOptions <$> many inputFile+                                <*> outputDirectory+                                <*> options                                 <*> (not <$> noPrefix)  main :: IO ()@@ -165,6 +165,6 @@   infoModList = fullDesc <> headerInfo <> footerInfo   headerInfo  = header   "psc-make - Compiles PureScript to Javascript"   footerInfo  = footer $ "psc-make " ++ showVersion Paths.version-  +   version :: Parser (a -> a)   version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden
psc/Main.hs view
@@ -115,25 +115,25 @@   where   defaultVal = "Main"   noArgs     = flag' defaultVal (long "main")-  withArgs   = strOption $ +  withArgs   = strOption $         long "main"      <> help (concat [             "Generate code to run the main method in the specified module. ",             "(no argument: \"", defaultVal, "\")"         ])-        + noMagicDo :: Parser Bool noMagicDo = switch $      long "no-magic-do"   <> help "Disable the optimization that overloads the do keyword to generate efficient code specifically for the Eff monad."-        + noTco :: Parser Bool-noTco = switch $ +noTco = switch $      long "no-tco"   <> help "Disable tail call optimizations"  noPrelude :: Parser Bool-noPrelude = switch $ +noPrelude = switch $      long "no-prelude"   <> help "Omit the Prelude" @@ -161,22 +161,22 @@   <> help "The output .e.purs file"  noPrefix :: Parser Bool-noPrefix = switch $ +noPrefix = switch $      short 'p'   <> long "no-prefix"   <> help "Do not include comment header"  options :: Parser (P.Options P.Compile)-options = P.Options <$> noPrelude -                    <*> noTco +options = P.Options <$> noPrelude+                    <*> noTco                     <*> noMagicDo                     <*> runMain                     <*> noOpts                     <*> verboseErrors                     <*> additionalOptions   where-  additionalOptions = -    P.CompileOptions <$> browserNamespace +  additionalOptions =+    P.CompileOptions <$> browserNamespace                      <*> many dceModule                      <*> many codeGenModule @@ -195,7 +195,7 @@   infoModList = fullDesc <> headerInfo <> footerInfo   headerInfo  = header   "psc - Compiles PureScript to Javascript"   footerInfo  = footer $ "psc " ++ showVersion Paths.version-  +   version :: Parser (a -> a)   version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden 
psci/Parser.hs view
@@ -34,8 +34,8 @@ -- Parses PSCI metacommands or expressions input from the user. -- parseCommand :: String -> Either String Command-parseCommand cmdString = -  case splitCommand cmdString of +parseCommand cmdString =+  case splitCommand cmdString of     Just ('?', _) -> return Help     Just ('q', _) -> return Quit     Just ('r', _) -> return Reset@@ -52,7 +52,7 @@   parseRest p s = either (Left . show) Right $ do     ts <- P.lex "" s     P.runTokenParser "" (p <* eof) ts-  +   trimEnd :: String -> String   trimEnd = reverse . dropWhile isSpace . reverse @@ -68,7 +68,7 @@   --   psciExpression :: P.TokenParser Command   psciExpression = Expression <$> P.parseValue-  +   -- |   -- PSCI version of @let@.   -- This is essentially let from do-notation.
purescript.cabal view
@@ -1,5 +1,5 @@ name: purescript-version: 0.6.4+version: 0.6.4.1 cabal-version: >=1.8 build-type: Simple license: MIT@@ -150,7 +150,7 @@     ghc-options: -Wall -fno-warn-warnings-deprecations -O2  executable psc-docs-    build-depends: base >=4 && <5, purescript -any, +    build-depends: base >=4 && <5, purescript -any,                    optparse-applicative >= 0.10.0, process -any, mtl -any     main-is: Main.hs     buildable: True
src/Language/PureScript/AST/SourcePos.hs view
@@ -48,6 +48,6 @@     --   , spanEnd :: SourcePos   } deriving (D.Data, D.Typeable)-  + instance Show SourceSpan where   show sp = spanName sp ++ " " ++ show (spanStart sp) ++ " - " ++ show (spanEnd sp)
src/Language/PureScript/CodeGen/Externs.hs view
@@ -45,11 +45,18 @@      declToPs :: Declaration -> Writer [String] ()     declToPs (ImportDeclaration mn _ _) = tell ["import " ++ show mn ++ " ()"]-    declToPs (FixityDeclaration (Fixity assoc prec) ident) =-      tell [ unwords [ show assoc, show prec, ident ] ]+    declToPs (FixityDeclaration (Fixity assoc prec) op) =+      case find exportsOp exts of+        Nothing -> return ()+        Just _ -> tell [ unwords [ show assoc, show prec, op ] ]+      where+      exportsOp :: DeclarationRef -> Bool+      exportsOp (PositionedDeclarationRef _ _ r) = exportsOp r+      exportsOp (ValueRef ident') = ident' == Op op+      exportsOp _ = False     declToPs (PositionedDeclaration _ com d) = mapM commentToPs com >> declToPs d     declToPs _ = return ()-    +     commentToPs :: Comment -> Writer [String] ()     commentToPs (LineComment s) = tell ["-- " ++ s]     commentToPs (BlockComment s) = tell ["{- " ++ s ++ " -}"]
src/Language/PureScript/CodeGen/JS.hs view
@@ -81,7 +81,7 @@ bindToJs mp (Rec vals) = forM vals (uncurry (nonRecToJS mp))  -- |--- Generate code in the simplified Javascript intermediate representation for a single non-recursive +-- Generate code in the simplified Javascript intermediate representation for a single non-recursive -- declaration. -- -- The main purpose of this function is to handle code generation for comments.@@ -92,7 +92,7 @@ nonRecToJS mp ident val = do   js <- valueToJs mp val   return $ JSVariableIntroduction (identToJs ident) (Just js)-  +  -- | -- Generate code in the simplified Javascript intermediate representation for a variable based on a
src/Language/PureScript/Comments.hs view
@@ -18,7 +18,7 @@ module Language.PureScript.Comments where  import qualified Data.Data as D-    + data Comment   = LineComment String   | BlockComment String
src/Language/PureScript/CoreFn/Ann.hs view
src/Language/PureScript/Parser.hs view
src/Language/PureScript/Parser/Lexer.hs view
@@ -15,7 +15,7 @@  {-# LANGUAGE TupleSections #-} -module Language.PureScript.Parser.Lexer +module Language.PureScript.Parser.Lexer   ( PositionedToken(..)   , Token()   , TokenParser()@@ -34,8 +34,8 @@   , squares   , indent   , indentAt-  , larrow -  , rarrow +  , larrow+  , rarrow   , lfatArrow   , rfatArrow   , colon@@ -83,7 +83,7 @@  import qualified Text.Parsec as P import qualified Text.Parsec.Token as PT-  + data Token   = LParen   | RParen@@ -112,7 +112,7 @@   | StringLiteral String   | Number (Either Integer Double)   deriving (Show, Eq, Ord)-  + prettyPrintToken :: Token -> String prettyPrintToken LParen            = "(" prettyPrintToken RParen            = ")"@@ -146,19 +146,19 @@   , ptToken     :: Token   , ptComments  :: [Comment]   } deriving (Eq)-  + instance Show PositionedToken where   show = show . ptToken  lex :: FilePath -> String -> Either P.ParseError [PositionedToken] lex filePath input = P.parse parseTokens filePath input-      + parseTokens :: P.Parsec String u [PositionedToken] parseTokens = whitespace *> P.many parsePositionedToken <* P.skipMany parseComment <* P.eof  whitespace :: P.Parsec String u () whitespace = P.skipMany (P.satisfy isSpace)-    + parseComment :: P.Parsec String u Comment parseComment = (BlockComment <$> blockComment <|> LineComment <$> lineComment) <* whitespace   where@@ -177,11 +177,11 @@  parseToken :: P.Parsec String u Token parseToken = P.choice-  [ P.try $ P.string "<-" *> P.notFollowedBy symbolChar *> pure LArrow    +  [ P.try $ P.string "<-" *> P.notFollowedBy symbolChar *> pure LArrow   , P.try $ P.string "<=" *> P.notFollowedBy symbolChar *> pure LFatArrow-  , P.try $ P.string "->" *> P.notFollowedBy symbolChar *> pure RArrow    -  , P.try $ P.string "=>" *> P.notFollowedBy symbolChar *> pure RFatArrow -  , P.try $ P.string "::" *> P.notFollowedBy symbolChar *> pure DoubleColon +  , P.try $ P.string "->" *> P.notFollowedBy symbolChar *> pure RArrow+  , P.try $ P.string "=>" *> P.notFollowedBy symbolChar *> pure RFatArrow+  , P.try $ P.string "::" *> P.notFollowedBy symbolChar *> pure DoubleColon   , P.try $ P.char '('    *> pure LParen   , P.try $ P.char ')'    *> pure RParen   , P.try $ P.char '{'    *> pure LBrace@@ -196,10 +196,10 @@   , P.try $ P.char '.'    *> P.notFollowedBy symbolChar *> pure Dot   , P.try $ P.char ';'    *> P.notFollowedBy symbolChar *> pure Semi   , P.try $ P.char '@'    *> P.notFollowedBy symbolChar *> pure At-  , LName         <$> parseLName +  , LName         <$> parseLName   , do uName <- parseUName        (guard (validModuleName uName) >> Qualifier uName <$ P.char '.') <|> pure (UName uName)-  , Symbol        <$> parseSymbol +  , Symbol        <$> parseSymbol   , StringLiteral <$> parseStringLiteral   , Number        <$> parseNumber   ] <* whitespace@@ -207,16 +207,16 @@   where   parseLName :: P.Parsec String u String   parseLName = (:) <$> identStart <*> P.many identLetter-  +   parseUName :: P.Parsec String u String   parseUName = (:) <$> P.upper <*> P.many uidentLetter-  +   parseSymbol :: P.Parsec String u String   parseSymbol = P.many1 symbolChar-  +   identStart :: P.Parsec String u Char   identStart = P.lower <|> P.oneOf "_"-  +   identLetter :: P.Parsec String u Char   identLetter = P.alphaNum <|> P.oneOf "_'" @@ -225,13 +225,13 @@    symbolChar :: P.Parsec String u Char   symbolChar = P.oneOf opChars-  +   parseStringLiteral :: P.Parsec String u String   parseStringLiteral = blockString <|> PT.stringLiteral tokenParser-    where +    where     delimeter   = P.try (P.string "\"\"\"")     blockString = delimeter >> P.manyTill P.anyChar delimeter-  +   parseNumber :: P.Parsec String u (Either Integer Double)   parseNumber = (Right <$> P.try (PT.float tokenParser) <|>                  Left <$> P.try (PT.natural tokenParser)) P.<?> "number"@@ -261,10 +261,10 @@ tokenParser = PT.makeTokenParser langDef  type TokenParser a = P.Parsec [PositionedToken] ParseState a- + anyToken :: TokenParser PositionedToken anyToken = P.token (prettyPrintToken . ptToken) ptSourcePos Just- + token :: (Token -> Maybe a) -> TokenParser a token f = P.token (prettyPrintToken . ptToken) ptSourcePos (f . ptToken) @@ -347,7 +347,7 @@ semi = match Semi  at :: TokenParser ()-at = match At +at = match At  -- | -- Parse zero or more values separated by semicolons@@ -408,7 +408,7 @@   where   go (UName s') | s == s' = Just ()   go _ = Nothing-  + symbol :: TokenParser String symbol = token go P.<?> "symbol"   where@@ -424,7 +424,7 @@   go Colon       | s == ":"  = Just ()   go LFatArrow   | s == "<=" = Just ()   go _ = Nothing-  + stringLiteral :: TokenParser String stringLiteral = token go P.<?> "string literal"   where@@ -448,10 +448,10 @@   where   go (LName s) | s `notElem` reservedPsNames = Just s   go _ = Nothing-  + validModuleName :: String -> Bool validModuleName s = not ('_' `elem` s)-  + -- | -- A list of purescript reserved identifiers --@@ -479,7 +479,7 @@                   , "in"                   , "where"                   ]-                  + reservedTypeNames :: [String] reservedTypeNames = [ "forall", "where" ] @@ -488,4 +488,4 @@ -- opChars :: [Char] opChars = ":!#$%&*+./<=>?@\\^|-~"-  +
src/Language/PureScript/Pretty/JS.hs view
@@ -135,16 +135,16 @@     commentLines :: Comment -> [String]     commentLines (LineComment s) = [s]     commentLines (BlockComment s) = lines s-    -    asLine :: String -> StateT PrinterState Maybe String ++    asLine :: String -> StateT PrinterState Maybe String     asLine s = do       i <- currentIndent       return $ i ++ " * " ++ removeComments s ++ "\n"-    +     removeComments :: String -> String     removeComments ('*' : '/' : s) = removeComments s     removeComments (c : s) = c : removeComments s-    +     removeComments [] = []   match (JSRaw js) = return js   match _ = mzero
src/Language/PureScript/Pretty/Types.hs view
@@ -34,7 +34,7 @@ typeLiterals :: Pattern () Type String typeLiterals = mkPattern match   where-  match TypeWildcard = Just "_"      +  match TypeWildcard = Just "_"   match (TypeVar var) = Just var   match (PrettyPrintObject row) = Just $ "{ " ++ prettyPrintRow row ++ " }"   match (PrettyPrintArray ty) = Just $ "[" ++ prettyPrintType ty ++ "]"
src/Language/PureScript/Sugar/BindingGroups.hs view
@@ -52,12 +52,12 @@ createBindingGroups moduleName = mapM f <=< handleDecls    where-  (f, _, _) = everywhereOnValuesTopDownM return handleExprs return -      +  (f, _, _) = everywhereOnValuesTopDownM return handleExprs return+   handleExprs :: Expr -> Either ErrorStack Expr   handleExprs (Let ds val) = flip Let val <$> handleDecls ds   handleExprs other = return other-  +   -- |   -- Replace all sets of mutually-recursive declarations with binding groups   --
src/Language/PureScript/Sugar/Names.hs view
@@ -219,9 +219,12 @@   updateValue :: (Maybe SourceSpan, [Ident]) -> Expr -> Either ErrorStack ((Maybe SourceSpan, [Ident]), Expr)   updateValue (_, bound) v@(PositionedValue pos' _ _) = return ((Just pos', bound), v)   updateValue (pos, bound) (Abs (Left arg) val') = return ((pos, arg : bound), Abs (Left arg) val')-  updateValue (pos, bound) (Let ds val') =+  updateValue (pos, bound) (Let ds val') = do       let args = mapMaybe letBoundVariable ds-      in return ((pos, args ++ bound), Let ds val')+      unless (length (nub args) == length args) $ +        throwError $ maybe id (\p e -> positionError p <> e) pos $ mkErrorStack ("Overlapping names in let binding.") Nothing+      return ((pos, args ++ bound), Let ds val')+      where   updateValue (pos, bound) (Var name'@(Qualified Nothing ident)) | ident `notElem` bound =     (,) (pos, bound) <$> (Var <$> updateValueName name' pos)   updateValue (pos, bound) (Var name'@(Qualified (Just _) _)) =
src/Language/PureScript/TypeChecker.hs view
@@ -89,7 +89,7 @@  addTypeClassDictionaries :: [TypeClassDictionaryInScope] -> Check () addTypeClassDictionaries entries =-  let mentries = M.fromList [ ((canonicalizeDictionary entry, mn), entry) | entry@TypeClassDictionaryInScope{ tcdName = Qualified mn _ }  <- entries ]+  let mentries = M.fromList [ ((canonicalizeDictionary entry, mn), entry) | entry@TypeClassDictionaryInScope{ tcdName = Qualified mn _ } <- entries ]   in modify $ \st -> st { checkEnv = (checkEnv st) { typeClassDictionaries = (typeClassDictionaries . checkEnv $ st) `M.union` mentries } }  checkDuplicateTypeArguments :: [String] -> Check ()
src/Language/PureScript/TypeChecker/Types.hs view
@@ -52,6 +52,7 @@ import Language.PureScript.Kinds import Language.PureScript.Names import Language.PureScript.Pretty+import Language.PureScript.Traversals import Language.PureScript.TypeChecker.Entailment import Language.PureScript.TypeChecker.Kinds import Language.PureScript.TypeChecker.Monad@@ -271,8 +272,8 @@   env <- getEnv   case M.lookup c (dataConstructors env) of     Nothing -> throwError . strMsg $ "Constructor " ++ show c ++ " is undefined"-    Just (_, _, ty) -> do ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms $ ty-                          return $ TypedValue True v ty'+    Just (_, _, ty) -> do (v', ty') <- sndM (introduceSkolemScope <=< replaceAllTypeSynonyms) <=< instantiatePolyTypeWithUnknowns v $ ty+                          return $ TypedValue True v' ty' infer' (Case vals binders) = do   ts <- mapM infer vals   ret <- fresh@@ -565,7 +566,7 @@   val' <- check' val ty   return $ TypedValue True val' kt check' (PositionedValue pos _ val) ty =-  rethrowWithPosition pos $ check val ty+  rethrowWithPosition pos $ check' val ty check' val ty = throwError $ mkErrorStack ("Expr does not have type " ++ prettyPrintType ty) (Just (ExprError val))  containsTypeSynonyms :: Type -> Bool@@ -581,18 +582,14 @@ checkProperties :: [(String, Expr)] -> Type -> Bool -> UnifyT Type Check [(String, Expr)] checkProperties ps row lax = let (ts, r') = rowToList row in go ps ts r' where   go [] [] REmpty = return []-  go [] [] u@(TUnknown _) = do u =?= REmpty-                               return []+  go [] [] u@(TUnknown _) +    | lax = return []+    | otherwise = do u =?= REmpty+                     return []   go [] [] Skolem{} | lax = return []   go [] ((p, _): _) _ | lax = return []                       | otherwise = throwError $ mkErrorStack ("Object does not have property " ++ p) (Just (ExprError (ObjectLiteral ps)))   go ((p,_):_) [] REmpty = throwError $ mkErrorStack ("Property " ++ p ++ " is not present in closed object type " ++ prettyPrintRow row) (Just (ExprError (ObjectLiteral ps)))-  go ((p,v):ps') [] u@(TUnknown _) = do-    v'@(TypedValue _ _ ty) <- infer v-    rest <- fresh-    u =?= RCons p ty rest-    ps'' <- go ps' [] rest-    return $ (p, v') : ps''   go ((p,v):ps') ts r =     case lookup p ts of       Nothing -> do
src/Language/PureScript/TypeChecker/Unify.hs view
@@ -158,7 +158,7 @@ replaceVarWithUnknown ident ty = do   tu <- fresh   return $ replaceTypeVars ident tu ty-  + -- | -- Replace type wildcards with unknowns --
tests/Main.hs view
@@ -35,7 +35,7 @@   return (inputFile, text)  loadPrelude :: Either String (String, String, P.Environment)-loadPrelude = +loadPrelude =   case P.parseModulesFromFiles id [("", P.prelude)] of     Left parseError -> Left (show parseError)     Right ms -> P.compile (P.defaultCompileOptions { P.optionsAdditional = P.CompileOptions "Tests" [] [] }) (map snd ms) []@@ -85,7 +85,7 @@  main :: IO () main = do-  putStrLn "Compiling Prelude" +  putStrLn "Compiling Prelude"   case loadPrelude of     Left err -> putStrLn err >> exitFailure     Right (preludeJs, exts, _) -> do