-
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
Resolve #1451: fix format --check
given STDIN input.
#1462
Conversation
I'm not really sure if this is the "best" approach so let me know if you know a way to simplify this. The issue was that `getExpressionAndHeader` was doing a second `IO.getContents` (thus reading STDIN twice).
5633fe5
to
1904409
Compare
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.
Cheers! That's already much nicer than what I had been able to think of. :)
dhall/src/Dhall/Util.hs
Outdated
@@ -122,13 +125,21 @@ data Censor = NoCensor | Censor | |||
-- | Path to input | |||
data Input = StandardInput | InputFile FilePath | |||
|
|||
-- | Path to input or raw input text, necessary since we can't read STDIN twice | |||
data InputOrTextFromStdin = PathTo Input | StdinText Text |
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.
PathTo StandardInput
seems like a bit of a strange combination to me. How about
data InputOrTextFromStdin = PathTo Input | StdinText Text | |
data InputOrTextFromStdin = Input_ Input | StdinText Text |
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.
Done.
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.
Cheers! :)
I'm not really sure if this is the "best" approach so let me know if you
know a way to simplify this.
The issue was that
getExpressionAndHeader
was doing a secondIO.getContents
(thus reading STDIN twice).