Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider using record syntax for the AST to reduce extra work when adding more fields #32

Open
anka-213 opened this issue Mar 3, 2021 · 2 comments
Assignees

Comments

@anka-213
Copy link
Collaborator

anka-213 commented Mar 3, 2021

For example, with this:

data FooBar
  = Foo {x :: Int, _y :: Char}Bar {x :: Int}
  
 showFoo :: FooBar -> String
 showFoo Foo {_y = y} = "Foo with " ++ show y
 showFoo Bar {}       = "Not foo"

we could add any number of fields to Foo and Bar without having to modify showFoo at all.

@Martin-Strecker
Copy link
Contributor

OK, I was not aware of that, looks useful, and we can generalize its use.

@mengwong
Copy link
Contributor

mengwong commented Mar 9, 2021

similarly for annotations, we can have { getType : … , getPos : … }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants