-
Notifications
You must be signed in to change notification settings - Fork 2
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
[#39] String interpolation in coffer
output messages
#63
Conversation
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, just one small suggestion! 👍
app/Main.hs
Outdated
let entryTo = getEntryFromCreateError err | ||
let header = "'" +| from |+ "' to '" +| entryTo ^. path |+ "':" | ||
let header = [int|s|'#{from}' to '#{entryTo ^. path}':|] | ||
let errorMsg = createErrorToBuilder err | ||
pure $ unlinesF @_ @Builder $ header : [indentF 2 errorMsg] |
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 didn't test it, but would this work?
let entryTo = getEntryFromCreateError err
pure [int||
'#{from}' to '#{entryTo ^. path}':
#{createErrorToBuilder err}
|]
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.
Actually, also just noticed that buildErrorMessages
doesn't have to return Sem r [Builder]
, it could just return a [Builder]
.
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.
Oh, I'm afraid no. Just a couple of days ago I witnessed the need for such functionality too, so let the ticket be serokell/nyan-interpolation#11.
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.
Ah right, and one of the messages returned by createErrorToBuilder
does have multiple lines :/
Ok, let's leave it like this for now. @DK318, please create a separate issue to improve this when serokell/nyan-interpolation#11 is done + released.
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.
Note: while we're here, we could still change Sem r [Builder]
-> [Builder]
in this PR.
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.
@DK318 I checked, Sem r [Builder]
can be changed to [Builder]
(as mentioned above). For example, like this:
buildErrorMessages = fmap \(from, err) ->
let entryPath = getEntryFromCreateError err
header = [int|s|'#{from}' to '#{entryTo ^. path}':|]
errorMsg = createErrorToBuilder err
in unlinesF @_ @Builder $ header : [indentF 2 errorMsg]
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.
Please, resolve conflicts with the main branch and maybe change the buildErrorMessages
type :)
Everything else looks good
app/Main.hs
Outdated
let entryTo = getEntryFromCreateError err | ||
let header = "'" +| from |+ "' to '" +| entryTo ^. path |+ "':" | ||
let header = [int|s|'#{from}' to '#{entryTo ^. path}':|] | ||
let errorMsg = createErrorToBuilder err | ||
pure $ unlinesF @_ @Builder $ header : [indentF 2 errorMsg] |
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.
@DK318 I checked, Sem r [Builder]
can be changed to [Builder]
(as mentioned above). For example, like this:
buildErrorMessages = fmap \(from, err) ->
let entryPath = getEntryFromCreateError err
header = [int|s|'#{from}' to '#{entryTo ^. path}':|]
errorMsg = createErrorToBuilder err
in unlinesF @_ @Builder $ header : [indentF 2 errorMsg]
Oh, this PR is really outdated. Still waiting for a review 😄 |
Looks like you have 2 reviews now, I really only had that 1 small comment ^^ |
Oh. This |
5432993
to
ce9d09a
Compare
Problem: at this moment constructing some messages in `Main.hs` looks very convoluted (e.g. message in `set-field` command). Solution: used `nyan-interpolation` package in `Main.hs`.
f9505cf
to
0608ae9
Compare
Description
Problem
At this moment constructing some messages in
Main.hs
looks very convoluted (e.g. message in
set-field
command).Solution
Used
nyan-interpolation
package inMain.hs
.Related issue(s)
nyan-interpolation
#39✅ Checklist for your Pull Request
Related changes (conditional)
silently reappearing again.
of Public Contracts policy.
and
Stylistic guide (mandatory)