git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #515 from purescript/newtype-updates

Newtype updates

commitf1f5295dc0593593f656c1e7e68f1158a275a7b1 authorPhil Freeman <paf31@cantab.net> dateSun 27 Jul 2014, 12:29 (12 years ago) parentdfb4475b5b1471
2 files changed+3−3
prelude/prelude.purs+2−2 src/Language/PureScript/TypeChecker.hs+1−1
prelude/prelude.purs+2−2
@@ -228,7 +228,7 @@ module Prelude
228228 (%) = numMod
229229 negate = numNegate
230230
231− data Unit = Unit {}
231+ newtype Unit = Unit {}
232232
233233 unit :: Unit
234234 unit = Unit {}
@@ -740,7 +740,7 @@ module Data.Function where
740740
741741module Data.Eq where
742742
743− data Ref a = Ref a
743+ newtype Ref a = Ref a
744744
745745 liftRef :: forall a b. (a -> a -> b) -> Ref a -> Ref a -> b
746746 liftRef f (Ref x) (Ref y) = f x y
src/Language/PureScript/TypeChecker.hs+1−1
@@ -120,7 +120,7 @@ typeCheckAll mainModuleName moduleName (d@(DataDeclaration dtype name args dctor
120120 return $ d : ds
121121 where
122122 checkNewtype :: [(ProperName, [Type])] -> Check ()
123− checkNewtype [(_, [ty])] = return ()
123+ checkNewtype [(_, [_])] = return ()
124124 checkNewtype [(_, _)] = throwError . strMsg $ "newtypes constructors must have a single argument"
125125 checkNewtype _ = throwError . strMsg $ "newtypes must have a single constructor"
126126typeCheckAll mainModuleName moduleName (d@(DataBindingGroupDeclaration tys) : rest) = do