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

Added "find" option that allows for regex searching in recipebook #123

Merged
merged 16 commits into from
Oct 17, 2020

Conversation

dreamsmasher
Copy link
Contributor

@dreamsmasher dreamsmasher commented Oct 2, 2020

Implements #36. The hard part wasn't actually implementing the search function, it was integrating it into the app ;)

Right now it only supports a single search string at a time, and doesn't output colour. Otherwise, it matches the specification laid out in #36.

I had to add toStr to src/RichText's exports in order to get this to work, it's actually a useful function.

Builds successfully, passes all tests and elementary regex testing. Need to add unit tests too.

Copy link
Collaborator

@langston-barrett langston-barrett left a comment

Choose a reason for hiding this comment

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

A few nits so far, but looks good overall. Looking forward to seeing the final state! Thanks @dreamsmasher!

app/herms.hs Outdated Show resolved Hide resolved
app/herms.hs Show resolved Hide resolved
app/herms.hs Outdated Show resolved Hide resolved
app/herms.hs Outdated Show resolved Hide resolved
app/herms.hs Show resolved Hide resolved
src/Find.hs Outdated Show resolved Hide resolved
src/Find.hs Outdated Show resolved Hide resolved
src/Find.hs Show resolved Hide resolved
src/Find.hs Outdated Show resolved Hide resolved
src/Types.hs Show resolved Hide resolved
Copy link
Contributor Author

@dreamsmasher dreamsmasher left a comment

Choose a reason for hiding this comment

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

Changes addressed in 1fdcd1e.

src/Types.hs Show resolved Hide resolved
app/herms.hs Outdated Show resolved Hide resolved
app/herms.hs Show resolved Hide resolved
src/Find.hs Outdated Show resolved Hide resolved
src/Find.hs Outdated Show resolved Hide resolved
@dreamsmasher
Copy link
Contributor Author

Added requested changes, and readded the Data.Monoid imports. Sorry about the failing build on GHC-8.2.2!

@langston-barrett
Copy link
Collaborator

Sorry about the failing build on GHC-8.2.2!

I think we can drop GHC 8.2.2, compatibility with three major versions is already pretty good. Feel free to make an issue and/or a pre-PR for that if you prefer it to fixing the 8.2.2 build.

@langston-barrett
Copy link
Collaborator

Thanks for addressing those comments, this is looking pretty good! I'll test locally and merge once the build passes and the final comment gets resolved.

@dreamsmasher
Copy link
Contributor Author

Awesome, thank you so much @langston-barrett! All comments now resolved.

@langston-barrett
Copy link
Collaborator

@dreamsmasher It looks like the build is still failing. Could you remove GHC 8.2.2 from the build configuration?

@langston-barrett
Copy link
Collaborator

(We should also remove it from the supported list in the Cabal file)

@dreamsmasher
Copy link
Contributor Author

All checks passed!

@dreamsmasher
Copy link
Contributor Author

Also - any chance we could add the ‘hacktoberfest‘ tag back to this repo’s topics? New regulations just came out that only PR’s to repos with the tag will be accepted for the free shirts :/

@langston-barrett
Copy link
Collaborator

Also - any chance we could add the ‘hacktoberfest‘ tag back to this repo’s topics? New regulations just came out that only PR’s to repos with the tag will be accepted for the free shirts :/

I made #124 to track this. Does it need to be done before merging this?

All checks passed!

Thanks! I just need to try it out locally now.

Copy link
Collaborator

@langston-barrett langston-barrett left a comment

Choose a reason for hiding this comment

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

A few more tiny changes, otherwise looks good.

showRecipeHeader t r serv
~~ newline ~~ List.unlines (showRecipeSteps r)
where serv = case (maybeServings) of
-- Nothing -> "Error: use a serving size greater than 0\n"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's go ahead and just delete this line

showRecipe t r maybeServings =
showRecipeHeader t r serv
~~ newline ~~ List.unlines (showRecipeSteps r)
where serv = case (maybeServings) of
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unnecessary parens:

Suggested change
where serv = case (maybeServings) of
where serv = case maybeServings of

~~ newline ~~ List.unlines (showRecipeSteps r)

showRecipe t r maybeServings =
showRecipeHeader t r serv
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of the where with the case, you can equivalently use

Suggested change
showRecipeHeader t r serv
showRecipeHeader t r (maybeServings <|> Just 1)

where <|> comes from Control.Applicative.

@langston-barrett langston-barrett merged commit b37d00d into LuxMiranda:master Oct 17, 2020
@langston-barrett
Copy link
Collaborator

Thanks @dreamsmasher!

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