git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix rendering of object/row types, add failing test
commit6cf3dbc6165e7085b3df03255a9c4d72dbc2a9ab authorPhil Freeman <paf31@cantab.net> dateSun 16 Feb 2014, 13:31 (13 years ago) parent8bb1779
2 files changed+7−5
examples/failing/Object.purs+5 src/Language/PureScript/Pretty/Types.hs+2−5
examples/failing/Object.pursnew file+5
@@ -0,0 +1,5 @@
1+module Object where
2+
3+test o = o.foo
4+
5+test1 = test {}
src/Language/PureScript/Pretty/Types.hs+2−5
@@ -32,7 +32,7 @@ import Language.PureScript.Pretty.Common
3232typeLiterals :: Pattern () Type String
3333typeLiterals = mkPattern match
3434 where
35− match (Object row) = Just $ "{ " ++ prettyPrintObjectRow row ++ " }"
35+ match (Object row) = Just $ "{ " ++ prettyPrintRow row ++ " }"
3636 match (TypeVar var) = Just var
3737 match (PrettyPrintArray ty) = Just $ "[" ++ prettyPrintType ty ++ "]"
3838 match ty@(TypeConstructor ctor) = Just $ show ctor
@@ -41,12 +41,9 @@ typeLiterals = mkPattern match
4141 match (ConstrainedType deps ty) = Just $ "(" ++ intercalate "," (map (\(pn, ty') -> show pn ++ " (" ++ prettyPrintType ty' ++ ")") deps) ++ ") => " ++ prettyPrintType ty
4242 match (SaturatedTypeSynonym name args) = Just $ show name ++ "<" ++ intercalate "," (map prettyPrintType args) ++ ">"
4343 match (ForAll ident ty _) = Just $ "forall " ++ ident ++ ". " ++ prettyPrintType ty
44− match REmpty = Just $ "()"
44+ match REmpty = Just "()"
4545 match row@(RCons _ _ _) = Just $ '(' : prettyPrintRow row ++ ")"
4646 match _ = Nothing
47− prettyPrintObjectRow REmpty = ""
48− prettyPrintObjectRow row@(RCons _ _ _) = prettyPrintRow row
49− prettyPrintObjectRow _ = error "Non-row type in Object"
5047
5148-- |
5249-- Generate a pretty-printed string representing a Row