git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #515 from purescript/newtype-updates
f1f5295Phil Freeman
prelude/prelude.purs+2−2
@@ -228,7 +228,7 @@ module Prelude
228 (%) = numMod
228 (%) = numMod
229 negate = numNegate
229 negate = numNegate
230
230
231− data Unit = Unit {}
231+ newtype Unit = Unit {}
232
232
233 unit :: Unit
233 unit :: Unit
234 unit = Unit {}
234 unit = Unit {}
@@ -740,7 +740,7 @@ module Data.Function where
740
740
741module Data.Eq where
741module Data.Eq where
742
742
743− data Ref a = Ref a
743+ newtype Ref a = Ref a
744
744
745 liftRef :: forall a b. (a -> a -> b) -> Ref a -> Ref a -> b
745 liftRef :: forall a b. (a -> a -> b) -> Ref a -> Ref a -> b
746 liftRef f (Ref x) (Ref y) = f x y
746 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
120 return $ d : ds
120 return $ d : ds
121 where
121 where
122 checkNewtype :: [(ProperName, [Type])] -> Check ()
122 checkNewtype :: [(ProperName, [Type])] -> Check ()
123− checkNewtype [(_, [ty])] = return ()
123+ checkNewtype [(_, [_])] = return ()
124 checkNewtype [(_, _)] = throwError . strMsg $ "newtypes constructors must have a single argument"
124 checkNewtype [(_, _)] = throwError . strMsg $ "newtypes constructors must have a single argument"
125 checkNewtype _ = throwError . strMsg $ "newtypes must have a single constructor"
125 checkNewtype _ = throwError . strMsg $ "newtypes must have a single constructor"
126typeCheckAll mainModuleName moduleName (d@(DataBindingGroupDeclaration tys) : rest) = do
126typeCheckAll mainModuleName moduleName (d@(DataBindingGroupDeclaration tys) : rest) = do