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

Add syntax module #589

Closed
wants to merge 1 commit into from
Closed

Conversation

NeQuissimus
Copy link
Contributor

@NeQuissimus NeQuissimus commented Nov 9, 2018

I could have used this a lot today, so I am finally getting around to contributing a syntax module :)

Basically, these return refined types for a few methods on NonEmptyString.
Also, I added a string interpolator that creates NonEmptyString.

Anybody is welcome to add to this, I may provide more convenience syntax as I need it.

Notes: I know virtually nothing about Scala.js or Scala.Native. I created the cross-build targets but am unsure whether they should exist...

Edit: Removed Scaja.js and Scala.Native. Looks like the string interpolator does not work there

@NeQuissimus NeQuissimus force-pushed the syntax_module branch 7 times, most recently from b3d7418 to 938d046 Compare November 9, 2018 13:45
@codecov
Copy link

codecov bot commented Nov 9, 2018

Codecov Report

Merging #589 into master will decrease coverage by 0.04%.
The diff coverage is 90%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #589      +/-   ##
==========================================
- Coverage   93.08%   93.04%   -0.05%     
==========================================
  Files          65       66       +1     
  Lines         709      719      +10     
  Branches       11       11              
==========================================
+ Hits          660      669       +9     
- Misses         49       50       +1
Impacted Files Coverage Δ
.../main/scala/eu/timepit/refined/syntax/string.scala 90% <90%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ef40976...cfa97d3. Read the comment docs.

@fthomas
Copy link
Owner

fthomas commented Nov 15, 2018

Thanks for this, @NeQuissimus! I'd vote to move the NonEmptyStringOps into the core module since it doesn't need new dependencies. And instead of refined-syntax I'd call the new module refined-contextual.

I've also worked on extension methods for NonEmptyString here https://github.com/fthomas/refined/compare/topic/NonEmptyString.Syntax but hadn't time to polish it. The methods there are available without any additional import because NonEmptyString.Syntax is mixed into the implicit scope of NonEmptyString. Not sure if this is the way to go, but it was nice to see that it is possible. Maybe you've any thoughts about that.

@NeQuissimus
Copy link
Contributor Author

I think keeping the implicit conversions behind an import will keep the compile times down for users. I would rather not expose them automatically.

What if we just create a syntax package in the core module?

We can then turn the string interpolation part into refined-contextual.

@NeQuissimus NeQuissimus deleted the syntax_module branch July 26, 2019 13:59
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.

None yet

2 participants