-
Notifications
You must be signed in to change notification settings - Fork 211
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
Add --censor
flag support for censoring type errors
#1329
Conversation
Example output:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM apart from a few wibbles! 👍
dhall/src/Dhall/Core.hs
Outdated
censorSrc :: Src -> Src | ||
censorSrc (Src { srcText = oldText, .. }) = Src { srcText = newText, .. } | ||
where | ||
newText = Data.Text.map (\_ -> ' ') oldText |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newText = Data.Text.map (\_ -> ' ') oldText | |
newText = censorText oldText |
dhall/src/Dhall/Hash.hs
Outdated
@@ -27,7 +28,7 @@ hash censor = do | |||
|
|||
resolvedExpression <- State.evalStateT (Dhall.Import.loadWith parsedExpression) status | |||
|
|||
case Dhall.TypeCheck.typeOf resolvedExpression of | |||
case Dhall.TypeCheck.typeWith Context.empty resolvedExpression of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind, but what's the motivation for this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a mistake which I'll undo. I made this change as part of a refactor to add a new argument to typeWith
, but then realized that I could restructure this change to not require argument passing. However, I forgot to undo this change along the way
xys' = [ (censorText x, censorExpression y) | (x, y) <- xys ] | ||
|
||
censorText :: Text -> Text | ||
censorText = Data.Text.map (\_ -> ' ') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we reuse this for censoring parser errors, too?
Fixes #1294