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

Stricter type (alias) for module parser? #8

Open
klaftertief opened this issue Sep 30, 2016 · 2 comments
Open

Stricter type (alias) for module parser? #8

klaftertief opened this issue Sep 30, 2016 · 2 comments

Comments

@klaftertief
Copy link

The parser result is a list of statements at the moment. Are there any plans to add a stricter/richer type or type alias to only support valid combinations of statements, like only one module declaration at the top of the file? This is partially related to the question in #7. Or should something like this be done in some elm-ast-extra package?

@Bogdanp
Copy link
Owner

Bogdanp commented Oct 1, 2016

I think this is a good idea and that it would make sense for something like that to exist in this package. The types of parseModule and parse could then become:

parseModule : OpTable -> String -> (Result (List String) Module, Context)
parse: String -> (Result (List String) Module, Context)

which would make them more useful for someone wanting to parse valid Elm source and for anyone wanting to do more generic stuff parse{Expression,Statement,OpTable} would likely be enough since they can be used to produce List {Expression,Statement} and OpTable respectively.

@klaftertief
Copy link
Author

Cool, I'm going to sketch out some types in the next couple of days...

supermario pushed a commit to supermario/elm-ast that referenced this issue Jul 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants