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

Output the context of a type error with syntax highlighting #1556

Merged
merged 1 commit into from
Nov 19, 2019

Conversation

sjakobi
Copy link
Collaborator

@sjakobi sjakobi commented Nov 19, 2019

No description provided.

@@ -4252,21 +4252,23 @@ data TypeError s a = TypeError
}

instance (Eq a, Pretty s, Pretty a) => Show (TypeError s a) where
show = Pretty.renderString . Dhall.Pretty.layout . Pretty.pretty
show = Pretty.renderString . Dhall.Pretty.layout . prettyTypeError
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry, this is actually unrelated – it just allows us to skip unAnnotate which can be expensive for large Docs (which isn't the case here).

)
where
prettyKV (key, val) =
pretty key <> " : " <> Dhall.Util.snipDoc (Dhall.Pretty.prettyExpr val)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The change from pretty to prettyExpr is the key bit.

Copy link
Collaborator

@Gabriella439 Gabriella439 left a comment

Choose a reason for hiding this comment

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

Nice idea! 🙂

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

Successfully merging this pull request may close these issues.

2 participants