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

Small adjustment in CLI #399

Merged
merged 5 commits into from
Jun 12, 2019
Merged

Small adjustment in CLI #399

merged 5 commits into from
Jun 12, 2019

Conversation

piotr-iohk
Copy link
Contributor

Issue Number

#397
#398

Overview

Comments

@piotr-iohk piotr-iohk requested a review from KtorZ June 11, 2019 14:50
@piotr-iohk piotr-iohk self-assigned this Jun 11, 2019
TIO.hPutStr stderr ""
else do
TIO.hPutStrLn stderr "Ok."
BL8.putStrLn (encode a)
Copy link
Member

Choose a reason for hiding this comment

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

What's the rational / requirement for the silentMode 🤔 ?
Also, avoid Bool where you can and favor a concrete data-type that conveys the semantic better:

data Mode = Silent | Verbose

Although here, I don't think we need this ?

Copy link
Member

Choose a reason for hiding this comment

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

Instead, I'll suggest to:

  • split runClient into two smaller functions:
    • sendRequest
    • handleResponse

This way, you may re-use sendRequest easily to check that a wallet exists without doing all the standard handling.

@piotr-iohk piotr-iohk force-pushed the piotr/397/fix_faulty_exit_code branch from 07cd348 to 0dd4c0e Compare June 12, 2019 14:27
ts
(ApiT wPwd)
res <- sendRequest $ getWallet $ ApiT wId
if (isRight res) then do
Copy link
Member

Choose a reason for hiding this comment

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

Just a minor thing but pattern-matching case res of Right _; Left _; is more idiomatic in Haskell than if isXXX then else

Copy link
Member

@KtorZ KtorZ left a comment

Choose a reason for hiding this comment

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

👌

@KtorZ KtorZ merged commit 8cd48bb into master Jun 12, 2019
@KtorZ KtorZ deleted the piotr/397/fix_faulty_exit_code branch June 12, 2019 17:06
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.

2 participants