purescript-deprecated / purescript-generics

21 stars 20 forks source link

Record labels not quoted if necessary with gShow #40

Open rightfold opened 8 years ago

rightfold commented 8 years ago
data Person = Person 
  { "first name"   :: String
  , "last name"    :: String
  , address        :: Address
  }

Using gShow with this structure returns:

{address: Main.Address {city: "Faketown", state: "CA"}, first name: "John", last name: "Smith"}

which is obviously not valid PureScript. It should return:

{address: Main.Address {city: "Faketown", state: "CA"}, "first name": "John", "last name": "Smith"}
garyb commented 8 years ago

Good point. It needs to use the same escaping rules as the compiler to cover reserved names too.