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

Refactoring logging functions / make the error messages more closely match gccs output #249

Merged
merged 9 commits into from
Oct 5, 2024

Conversation

jaredponn
Copy link
Collaborator

@jaredponn jaredponn commented Sep 16, 2024

This PR:

  • Refactored all logging (logError and logInfo functions (from lambda-buffers-frontend and lambda-buffers-codegen) to reuse the logging functions in lambda-buffers-compiler since lambda-buffers-compiler is an existing dependency of both lambda-buffers-frontend and lambda-buffers-codegen
  • Change error / info messages to be dumped to stderr instead of stdout (this is more aligned with other compilers' behaviors)
  • Shuffled error messages to more closely follow what gcc outputs e.g.
    $ lbf-prelude-to-haskell DoesNotExist.lbf
    DoesNotExist.lbf: error: the provided module file DoesNotExist.lbf doesn't exist
    
    $ cat TEST.lbf
    module TEST
    
    import Prelude (Eq, Json, Maybe, Either, List, Integer)
    
    derive Eq What
    $ lbf-prelude-to-haskell TEST.lbf
    TEST.lbf:5.11-5.15: error: [module TEST] type What not found in the module's scope Either Integer List Maybe Prelude.Either Prelude.Integer Prelude.List Prelude.Maybe
    
    $ cat TEST.lbf
    module TEST
    
    import Prelude (Eq, Json, Maybe, Either, List, Integer)
    
    prod What = (Integer
    derive Eq What
    
    $ lbf-prelude-to-haskell TEST.lbf
    TEST.lbf:6.7: error:
    unexpected keyword
    expecting s-expression
    

and shuffled error messages s.t. it more closely follows the output of
gcc
Copy link
Collaborator

@bladyjoker bladyjoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great!

I left a comment about extras/lambda-buffers-utils to keep the compilation level separation. Let me know if that works

lambda-buffers-compiler/src/LambdaBuffers/Logger.hs Outdated Show resolved Hide resolved
lambda-buffers-frontend/lambda-buffers-frontend.cabal Outdated Show resolved Hide resolved
@jaredponn jaredponn force-pushed the jared/refactor-logging branch 3 times, most recently from 61a960b to 0acd00c Compare September 24, 2024 07:00
Copy link
Collaborator

@bladyjoker bladyjoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank youuuu!!!

extras/lambda-buffers-utils/cabal.project Outdated Show resolved Hide resolved
extras/lambda-buffers-utils/src/LambdaBuffers/Logger.hs Outdated Show resolved Hide resolved
extras/lambda-buffers-utils/.envrc Outdated Show resolved Hide resolved
…`dev-lambda-buffers-(utils|frontend|codegen|compiler)`
Copy link
Collaborator

@szg251 szg251 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought I reviewed this earlier...

@jaredponn
Copy link
Collaborator Author

jaredponn commented Oct 5, 2024

I'll merge this since it seems we've addressed all PR feedback :P

@jaredponn jaredponn added this pull request to the merge queue Oct 5, 2024
Merged via the queue into main with commit a9d2eca Oct 5, 2024
2 checks passed
@jaredponn jaredponn deleted the jared/refactor-logging branch October 5, 2024 22:46
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

Successfully merging this pull request may close these issues.

3 participants