diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -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,
diff --git a/examples/failing/DuplicateDeclarationsInLet.purs b/examples/failing/DuplicateDeclarationsInLet.purs
new file mode 100644
--- /dev/null
+++ b/examples/failing/DuplicateDeclarationsInLet.purs
@@ -0,0 +1,9 @@
+module Main where
+
+foo = a
+  where
+  a :: Number
+  a = 1
+
+  a :: Number
+  a = 2
diff --git a/examples/failing/NewtypeMultiArgs.purs b/examples/failing/NewtypeMultiArgs.purs
--- a/examples/failing/NewtypeMultiArgs.purs
+++ b/examples/failing/NewtypeMultiArgs.purs
diff --git a/examples/failing/NewtypeMultiCtor.purs b/examples/failing/NewtypeMultiCtor.purs
--- a/examples/failing/NewtypeMultiCtor.purs
+++ b/examples/failing/NewtypeMultiCtor.purs
diff --git a/examples/failing/SkolemEscape2.purs b/examples/failing/SkolemEscape2.purs
--- a/examples/failing/SkolemEscape2.purs
+++ b/examples/failing/SkolemEscape2.purs
@@ -6,4 +6,4 @@
 
 test _ = do
   r <- runST (newSTRef 0)
-  return 0 
+  return 0
diff --git a/examples/failing/UnknownType.purs b/examples/failing/UnknownType.purs
--- a/examples/failing/UnknownType.purs
+++ b/examples/failing/UnknownType.purs
diff --git a/examples/passing/810.purs b/examples/passing/810.purs
new file mode 100644
--- /dev/null
+++ b/examples/passing/810.purs
@@ -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"
diff --git a/examples/passing/BindersInFunctions.purs b/examples/passing/BindersInFunctions.purs
--- a/examples/passing/BindersInFunctions.purs
+++ b/examples/passing/BindersInFunctions.purs
@@ -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'."
diff --git a/examples/passing/BindingGroups.purs b/examples/passing/BindingGroups.purs
--- a/examples/passing/BindingGroups.purs
+++ b/examples/passing/BindingGroups.purs
@@ -1,6 +1,6 @@
 module Main where
-  
-foo = bar 
+
+foo = bar
   where bar r = r + 1
 
 r = foo 2
diff --git a/examples/passing/CheckSynonymBug.purs b/examples/passing/CheckSynonymBug.purs
--- a/examples/passing/CheckSynonymBug.purs
+++ b/examples/passing/CheckSynonymBug.purs
@@ -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)
 
diff --git a/examples/passing/Comparisons.purs b/examples/passing/Comparisons.purs
--- a/examples/passing/Comparisons.purs
+++ b/examples/passing/Comparisons.purs
@@ -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)
diff --git a/examples/passing/Conditional.purs b/examples/passing/Conditional.purs
--- a/examples/passing/Conditional.purs
+++ b/examples/passing/Conditional.purs
@@ -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
 
diff --git a/examples/passing/Console.purs b/examples/passing/Console.purs
--- a/examples/passing/Console.purs
+++ b/examples/passing/Console.purs
@@ -9,5 +9,5 @@
 replicateM_ n act = do
   act
   replicateM_ (n - 1) act
-    
+
 main = replicateM_ 10 (trace "Hello World!")
diff --git a/examples/passing/DeepArrayBinder.purs b/examples/passing/DeepArrayBinder.purs
--- a/examples/passing/DeepArrayBinder.purs
+++ b/examples/passing/DeepArrayBinder.purs
@@ -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"
diff --git a/examples/passing/DeepCase.purs b/examples/passing/DeepCase.purs
--- a/examples/passing/DeepCase.purs
+++ b/examples/passing/DeepCase.purs
@@ -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
diff --git a/examples/passing/Dollar.purs b/examples/passing/Dollar.purs
--- a/examples/passing/Dollar.purs
+++ b/examples/passing/Dollar.purs
@@ -12,5 +12,5 @@
 test1 x = id $ id $ id $ id $ x
 
 test2 x = id id $ id x
-    
+
 main = Debug.Trace.trace "Done"
diff --git a/examples/passing/EmptyDataDecls.purs b/examples/passing/EmptyDataDecls.purs
--- a/examples/passing/EmptyDataDecls.purs
+++ b/examples/passing/EmptyDataDecls.purs
@@ -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"
diff --git a/examples/passing/EmptyRow.purs b/examples/passing/EmptyRow.purs
--- a/examples/passing/EmptyRow.purs
+++ b/examples/passing/EmptyRow.purs
@@ -1,6 +1,6 @@
 module Main where
 
-data Foo r = Foo { | r } 
+data Foo r = Foo { | r }
 
 test :: Foo ()
 test = Foo {}
diff --git a/examples/passing/ExternRaw.purs b/examples/passing/ExternRaw.purs
--- a/examples/passing/ExternRaw.purs
+++ b/examples/passing/ExternRaw.purs
@@ -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"
diff --git a/examples/passing/FFI.purs b/examples/passing/FFI.purs
--- a/examples/passing/FFI.purs
+++ b/examples/passing/FFI.purs
@@ -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"
diff --git a/examples/passing/FinalTagless.purs b/examples/passing/FinalTagless.purs
--- a/examples/passing/FinalTagless.purs
+++ b/examples/passing/FinalTagless.purs
@@ -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
diff --git a/examples/passing/FunctionScope.purs b/examples/passing/FunctionScope.purs
--- a/examples/passing/FunctionScope.purs
+++ b/examples/passing/FunctionScope.purs
@@ -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
diff --git a/examples/passing/Functions2.purs b/examples/passing/Functions2.purs
--- a/examples/passing/Functions2.purs
+++ b/examples/passing/Functions2.purs
@@ -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" {}
diff --git a/examples/passing/Guards.purs b/examples/passing/Guards.purs
--- a/examples/passing/Guards.purs
+++ b/examples/passing/Guards.purs
@@ -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"
diff --git a/examples/passing/HoistError.purs b/examples/passing/HoistError.purs
--- a/examples/passing/HoistError.purs
+++ b/examples/passing/HoistError.purs
@@ -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
diff --git a/examples/passing/JSReserved.purs b/examples/passing/JSReserved.purs
--- a/examples/passing/JSReserved.purs
+++ b/examples/passing/JSReserved.purs
@@ -4,9 +4,9 @@
 
   yield = 0
   member = 1
-  
+
   public = \return -> return
-  
+
   this catch = catch
 
   main = Debug.Trace.trace "Done"
diff --git a/examples/passing/KindedType.purs b/examples/passing/KindedType.purs
--- a/examples/passing/KindedType.purs
+++ b/examples/passing/KindedType.purs
@@ -26,6 +26,6 @@
   def :: a
 
 instance clazzString :: Clazz String where
-  def = "test"	
+  def = "test"
 
 main = Debug.Trace.trace "Done"
diff --git a/examples/passing/Let.purs b/examples/passing/Let.purs
--- a/examples/passing/Let.purs
+++ b/examples/passing/Let.purs
@@ -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
diff --git a/examples/passing/Monad.purs b/examples/passing/Monad.purs
--- a/examples/passing/Monad.purs
+++ b/examples/passing/Monad.purs
@@ -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
diff --git a/examples/passing/MutRec.purs b/examples/passing/MutRec.purs
--- a/examples/passing/MutRec.purs
+++ b/examples/passing/MutRec.purs
@@ -1,4 +1,4 @@
-module Main where 
+module Main where
 
   import Prelude
 
diff --git a/examples/passing/MutRec2.purs b/examples/passing/MutRec2.purs
--- a/examples/passing/MutRec2.purs
+++ b/examples/passing/MutRec2.purs
@@ -1,7 +1,7 @@
 module Main where
 
 data A = A B
- 
+
 data B = B A
 
 foreign import data S :: *
diff --git a/examples/passing/MutRec3.purs b/examples/passing/MutRec3.purs
--- a/examples/passing/MutRec3.purs
+++ b/examples/passing/MutRec3.purs
@@ -1,7 +1,7 @@
 module Main where
 
 data A = A B
- 
+
 data B = B A
 
 foreign import data S :: *
diff --git a/examples/passing/NamedPatterns.purs b/examples/passing/NamedPatterns.purs
--- a/examples/passing/NamedPatterns.purs
+++ b/examples/passing/NamedPatterns.purs
@@ -1,6 +1,6 @@
 module Main where
 
-  foo = \x -> case x of 
+  foo = \x -> case x of
     y@{ foo = "Foo" } -> y
     y -> y
 
diff --git a/examples/passing/Newtype.purs b/examples/passing/Newtype.purs
--- a/examples/passing/Newtype.purs
+++ b/examples/passing/Newtype.purs
@@ -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
diff --git a/examples/passing/NewtypeWithRecordUpdate.purs b/examples/passing/NewtypeWithRecordUpdate.purs
new file mode 100644
--- /dev/null
+++ b/examples/passing/NewtypeWithRecordUpdate.purs
@@ -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"
diff --git a/examples/passing/ObjectSynonym.purs b/examples/passing/ObjectSynonym.purs
--- a/examples/passing/ObjectSynonym.purs
+++ b/examples/passing/ObjectSynonym.purs
@@ -10,4 +10,4 @@
 outer :: Outer
 outer = { inner: inner }
 
-main = Debug.Trace.trace "Done"  
+main = Debug.Trace.trace "Done"
diff --git a/examples/passing/ObjectUpdate2.purs b/examples/passing/ObjectUpdate2.purs
--- a/examples/passing/ObjectUpdate2.purs
+++ b/examples/passing/ObjectUpdate2.purs
@@ -7,7 +7,7 @@
 blah :: forall r. X r -> X r
 blah x = x
 
-test = blah x 
+test = blah x
   { baz = "blah"
   }
 
diff --git a/examples/passing/Objects.purs b/examples/passing/Objects.purs
--- a/examples/passing/Objects.purs
+++ b/examples/passing/Objects.purs
@@ -31,5 +31,5 @@
                { "***": n } -> n
 
   test7 {a:    snoog , b     : blah } = blah
-    
+
   main = Debug.Trace.trace "Done"
diff --git a/examples/passing/OperatorAssociativity.purs b/examples/passing/OperatorAssociativity.purs
--- a/examples/passing/OperatorAssociativity.purs
+++ b/examples/passing/OperatorAssociativity.purs
@@ -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"
diff --git a/examples/passing/Operators.purs b/examples/passing/Operators.purs
--- a/examples/passing/Operators.purs
+++ b/examples/passing/Operators.purs
@@ -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
diff --git a/examples/passing/OptimizerBug.purs b/examples/passing/OptimizerBug.purs
--- a/examples/passing/OptimizerBug.purs
+++ b/examples/passing/OptimizerBug.purs
@@ -5,5 +5,5 @@
 x a = 1 + y a
 
 y a = x a
-    
+
 main = Debug.Trace.trace "Done"
diff --git a/examples/passing/PartialFunction.purs b/examples/passing/PartialFunction.purs
--- a/examples/passing/PartialFunction.purs
+++ b/examples/passing/PartialFunction.purs
@@ -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
diff --git a/examples/passing/Patterns.purs b/examples/passing/Patterns.purs
--- a/examples/passing/Patterns.purs
+++ b/examples/passing/Patterns.purs
@@ -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"
diff --git a/examples/passing/Person.purs b/examples/passing/Person.purs
--- a/examples/passing/Person.purs
+++ b/examples/passing/Person.purs
@@ -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"
diff --git a/examples/passing/Rank2Data.purs b/examples/passing/Rank2Data.purs
--- a/examples/passing/Rank2Data.purs
+++ b/examples/passing/Rank2Data.purs
@@ -25,5 +25,5 @@
   two = succ zero
   four = add two two
   fourNumber = runNat four
-   
+
   main = Debug.Trace.trace "Done"
diff --git a/examples/passing/Rank2TypeSynonym.purs b/examples/passing/Rank2TypeSynonym.purs
--- a/examples/passing/Rank2TypeSynonym.purs
+++ b/examples/passing/Rank2TypeSynonym.purs
@@ -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
 
diff --git a/examples/passing/Rank2Types.purs b/examples/passing/Rank2Types.purs
--- a/examples/passing/Rank2Types.purs
+++ b/examples/passing/Rank2Types.purs
@@ -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"
diff --git a/examples/passing/Recursion.purs b/examples/passing/Recursion.purs
--- a/examples/passing/Recursion.purs
+++ b/examples/passing/Recursion.purs
@@ -6,5 +6,5 @@
     0 -> 1
     1 -> 1
     n -> fib (n - 1) + fib (n - 2)
-   
+
   main = Debug.Trace.trace "Done"
diff --git a/examples/passing/Sequence.purs b/examples/passing/Sequence.purs
--- a/examples/passing/Sequence.purs
+++ b/examples/passing/Sequence.purs
@@ -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"]
diff --git a/examples/passing/ShadowedRename.purs b/examples/passing/ShadowedRename.purs
--- a/examples/passing/ShadowedRename.purs
+++ b/examples/passing/ShadowedRename.purs
@@ -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
diff --git a/examples/passing/ShadowedTCOLet.purs b/examples/passing/ShadowedTCOLet.purs
--- a/examples/passing/ShadowedTCOLet.purs
+++ b/examples/passing/ShadowedTCOLet.purs
@@ -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
diff --git a/examples/passing/SignedNumericLiterals.purs b/examples/passing/SignedNumericLiterals.purs
--- a/examples/passing/SignedNumericLiterals.purs
+++ b/examples/passing/SignedNumericLiterals.purs
@@ -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"
diff --git a/examples/passing/Superclasses3.purs b/examples/passing/Superclasses3.purs
--- a/examples/passing/Superclasses3.purs
+++ b/examples/passing/Superclasses3.purs
@@ -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)
diff --git a/examples/passing/TailCall.purs b/examples/passing/TailCall.purs
--- a/examples/passing/TailCall.purs
+++ b/examples/passing/TailCall.purs
@@ -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])
diff --git a/examples/passing/TopLevelCase.purs b/examples/passing/TopLevelCase.purs
--- a/examples/passing/TopLevelCase.purs
+++ b/examples/passing/TopLevelCase.purs
@@ -14,5 +14,5 @@
   data A = A
 
   parseTest A 0 = 0
-    
+
   main = Debug.Trace.trace "Done"
diff --git a/examples/passing/TypeClassImport.purs b/examples/passing/TypeClassImport.purs
--- a/examples/passing/TypeClassImport.purs
+++ b/examples/passing/TypeClassImport.purs
@@ -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
 
diff --git a/examples/passing/TypeClassMemberOrderChange.purs b/examples/passing/TypeClassMemberOrderChange.purs
--- a/examples/passing/TypeClassMemberOrderChange.purs
+++ b/examples/passing/TypeClassMemberOrderChange.purs
@@ -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
diff --git a/examples/passing/TypeDecl.purs b/examples/passing/TypeDecl.purs
--- a/examples/passing/TypeDecl.purs
+++ b/examples/passing/TypeDecl.purs
@@ -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"
diff --git a/examples/passing/TypeSynonyms.purs b/examples/passing/TypeSynonyms.purs
--- a/examples/passing/TypeSynonyms.purs
+++ b/examples/passing/TypeSynonyms.purs
@@ -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 }
     }
diff --git a/examples/passing/TypeWildcardsRecordExtension.purs b/examples/passing/TypeWildcardsRecordExtension.purs
--- a/examples/passing/TypeWildcardsRecordExtension.purs
+++ b/examples/passing/TypeWildcardsRecordExtension.purs
@@ -1,5 +1,5 @@
 module Main where
-    
+
 foo :: forall a. {b :: Number | a} -> {b :: Number | _}
 foo f = f
 
diff --git a/examples/passing/Where.purs b/examples/passing/Where.purs
--- a/examples/passing/Where.purs
+++ b/examples/passing/Where.purs
@@ -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
 
diff --git a/examples/passing/s.purs b/examples/passing/s.purs
--- a/examples/passing/s.purs
+++ b/examples/passing/s.purs
@@ -1,5 +1,5 @@
 module Main where
 
   s = \x y z -> x z (y z)
-    
+
   main = Debug.Trace.trace "Done"
diff --git a/psc-docs/Main.hs b/psc-docs/Main.hs
--- a/psc-docs/Main.hs
+++ b/psc-docs/Main.hs
@@ -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
diff --git a/psc-make/Main.hs b/psc-make/Main.hs
--- a/psc-make/Main.hs
+++ b/psc-make/Main.hs
@@ -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
diff --git a/psc/Main.hs b/psc/Main.hs
--- a/psc/Main.hs
+++ b/psc/Main.hs
@@ -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
 
diff --git a/psci/Parser.hs b/psci/Parser.hs
--- a/psci/Parser.hs
+++ b/psci/Parser.hs
@@ -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.
diff --git a/purescript.cabal b/purescript.cabal
--- a/purescript.cabal
+++ b/purescript.cabal
@@ -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
diff --git a/src/Language/PureScript/AST/SourcePos.hs b/src/Language/PureScript/AST/SourcePos.hs
--- a/src/Language/PureScript/AST/SourcePos.hs
+++ b/src/Language/PureScript/AST/SourcePos.hs
@@ -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)
diff --git a/src/Language/PureScript/CodeGen/Externs.hs b/src/Language/PureScript/CodeGen/Externs.hs
--- a/src/Language/PureScript/CodeGen/Externs.hs
+++ b/src/Language/PureScript/CodeGen/Externs.hs
@@ -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 ++ " -}"]
diff --git a/src/Language/PureScript/CodeGen/JS.hs b/src/Language/PureScript/CodeGen/JS.hs
--- a/src/Language/PureScript/CodeGen/JS.hs
+++ b/src/Language/PureScript/CodeGen/JS.hs
@@ -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
diff --git a/src/Language/PureScript/Comments.hs b/src/Language/PureScript/Comments.hs
--- a/src/Language/PureScript/Comments.hs
+++ b/src/Language/PureScript/Comments.hs
@@ -18,7 +18,7 @@
 module Language.PureScript.Comments where
 
 import qualified Data.Data as D
-    
+
 data Comment
   = LineComment String
   | BlockComment String
diff --git a/src/Language/PureScript/CoreFn/Ann.hs b/src/Language/PureScript/CoreFn/Ann.hs
--- a/src/Language/PureScript/CoreFn/Ann.hs
+++ b/src/Language/PureScript/CoreFn/Ann.hs
diff --git a/src/Language/PureScript/Parser.hs b/src/Language/PureScript/Parser.hs
--- a/src/Language/PureScript/Parser.hs
+++ b/src/Language/PureScript/Parser.hs
diff --git a/src/Language/PureScript/Parser/Lexer.hs b/src/Language/PureScript/Parser/Lexer.hs
--- a/src/Language/PureScript/Parser/Lexer.hs
+++ b/src/Language/PureScript/Parser/Lexer.hs
@@ -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 = ":!#$%&*+./<=>?@\\^|-~"
-  
+
diff --git a/src/Language/PureScript/Pretty/JS.hs b/src/Language/PureScript/Pretty/JS.hs
--- a/src/Language/PureScript/Pretty/JS.hs
+++ b/src/Language/PureScript/Pretty/JS.hs
@@ -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
diff --git a/src/Language/PureScript/Pretty/Types.hs b/src/Language/PureScript/Pretty/Types.hs
--- a/src/Language/PureScript/Pretty/Types.hs
+++ b/src/Language/PureScript/Pretty/Types.hs
@@ -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 ++ "]"
diff --git a/src/Language/PureScript/Sugar/BindingGroups.hs b/src/Language/PureScript/Sugar/BindingGroups.hs
--- a/src/Language/PureScript/Sugar/BindingGroups.hs
+++ b/src/Language/PureScript/Sugar/BindingGroups.hs
@@ -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
   --
diff --git a/src/Language/PureScript/Sugar/Names.hs b/src/Language/PureScript/Sugar/Names.hs
--- a/src/Language/PureScript/Sugar/Names.hs
+++ b/src/Language/PureScript/Sugar/Names.hs
@@ -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 _) _)) =
diff --git a/src/Language/PureScript/TypeChecker.hs b/src/Language/PureScript/TypeChecker.hs
--- a/src/Language/PureScript/TypeChecker.hs
+++ b/src/Language/PureScript/TypeChecker.hs
@@ -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 ()
diff --git a/src/Language/PureScript/TypeChecker/Types.hs b/src/Language/PureScript/TypeChecker/Types.hs
--- a/src/Language/PureScript/TypeChecker/Types.hs
+++ b/src/Language/PureScript/TypeChecker/Types.hs
@@ -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
diff --git a/src/Language/PureScript/TypeChecker/Unify.hs b/src/Language/PureScript/TypeChecker/Unify.hs
--- a/src/Language/PureScript/TypeChecker/Unify.hs
+++ b/src/Language/PureScript/TypeChecker/Unify.hs
@@ -158,7 +158,7 @@
 replaceVarWithUnknown ident ty = do
   tu <- fresh
   return $ replaceTypeVars ident tu ty
-  
+
 -- |
 -- Replace type wildcards with unknowns
 --
diff --git a/tests/Main.hs b/tests/Main.hs
--- a/tests/Main.hs
+++ b/tests/Main.hs
@@ -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
