Repository navigation
v0.5.0
0.5.0 - 2023-12-23
New Features
-
[
refined4s-cats] AddcontraCoercibletoF[B] => F[A]withContravariant[F]andCoercible[A, B](#152)This is useful to derive type-class instances for
Newtype,RefinedandInlinedRefinedfrom the type-class instances of the actual types.e.g.)
import refined4s.modules.cats.derivation.instances.contraCoercible inline given eqDerived[A, B](using coercible: Coercible[A, B], eqB: Eq[B]): Eq[A] = contraCoercible(eqB) inline given showDerived[A, B](using coercible: Coercible[A, B], showB: Show[B]): Show[A] = contraCoercible(showB)
where
Bis the actual type andAcould be a newtype or a refined type.
Improvement
- Add missing
inlinetoinvalidReasonin the sub-types ofInlinedNumeric(#146)
-
[
refined4s-pureconfig] Add type name to the error message ofPureconfigRefinedConfigReaderandrefined4s.modules.pureconfig.derivation.instances.derivedRefinedConfigReader(#150)So a message like this
Invalid value found: -2373683071661092303 with error: Invalid value: [-2373683071661092303]. It must be a positive Longshould be like this instead.
The value -2373683071661092303 cannot be created as the expected type, mytypes.blah.Id.Type, due to the following error: Invalid value: [-2373683071661092303]. It must be a positive Long
- [
refined4s-doobie] Make type-classes inrefined4s.modules.doobie.derivation.instancesinline(#156)
-
[
refined4s-core] Improve compile-time error message forinline applymethod (#158)The old compile-time error for the constant value passed to the
inlineapplymethod may look like this.[error] 2780 | NegBigInt(1) [error] | ^^^^^^^^^^^^ [error] |A literal string is expected as an argument to `compiletime.error`. Got "Invalid value: [BigInt.apply(1)]. ".+( [error] | { [error] | val a$proxy4: BigInt = BigInt.apply(1) [error] | "It must be a negative BigInt":String:String [error] | }:String [error] |) [error] one error foundIt is not so readable, and it is hard to comprehend what is wrong with the input.
After this release, it will be like
[error] 2780 | NegBigInt(1) [error] | ^^^^^^^^^^^^ [error] | Invalid value: [BigInt.apply(1)]. It must be a negative BigInt [error] one error found
Internal Housekeeping
-
[
refined4s-circe] Updaterefined4s.modules.circe.derivation.instances.derivedEncoderto usecontraCoercibleand make itinline(#154)The old code has the following issue if it's turned into an
inlinemethod.[error] 13 | a => encoder(coercible(a)) [error] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ [error] |An inline given alias with a function value as right-hand side can significantly increase [error] |generated code size. You should either drop the `inline` or rewrite the given with an [error] |explicit `apply` method.
- Rename
Coerciblemethods and type parameters (#160)wrapandunwrapsuffixed withM:MtoTC(type constructor)wrapandunwrapsuffixed withMOfM:MOfMtoHKT(higher-kinded type)M[*]toF[*]M1[*]toF[*]andM2[*]toG[*]e.g.)M1[M2[A]]toF[G[A]]
What's Changed
- Add the doc site by @kevin-lee in #132
- Update docs: add
core.mdandnewtype.md-refined4s-coreandNewtypeby @kevin-lee in #133 - Update docs: add refined -
refined.mdandtypes.md: pre-defined refined types by @kevin-lee in #134 - Update docs:
custom-type.md: Add custom refined types by @kevin-lee in #135 - Bump actions/setup-java from 3 to 4 by @dependabot[bot] in #136
- Update docs:
docusaurus.config.ts- Docusaurus config to change the code block theme and handle potential Algolia and Google Analytics configs by @kevin-lee in #137 - Update docs:
docusaurus.config.ts- Fix the broken function to check if an object is empty by @kevin-lee in #138 - Add empty
algolia.config.jsonandgoogle-analytics.config.jsonby @kevin-lee in #139 - Update docs: Add doc for the
refined4s-catsmodule by @kevin-lee in #140 - Update docs: Change the width of the doc page to 80% by @kevin-lee in #141
- Update:
README.mdby @kevin-lee in #142 - Update docs: Add docs for the rest of modules (incomplete) by @kevin-lee in #143
- Update docs: Add more to
cats.mdby @kevin-lee in #144 - Update docs: Add pre-defined
Longtypes -types.mdby @kevin-lee in #145 - Close #146 - Add missing
inlinetoinvalidReasonin the sub-types ofInlinedNumericby @kevin-lee in #147 - Bump sbt to 1.9.8 by @kevin-lee in #148
- Bump sbt plugins by @kevin-lee in #149
- Close #150 - [
refined4s-pureconfig] Add type name to the error message ofPureconfigRefinedConfigReaderandrefined4s.modules.pureconfig.derivation.instances.derivedRefinedConfigReaderby @kevin-lee in #151 - Close #152 - [
refined4s-core] AddcontraCoercibletoF[B] => F[A]withContravariant[F]andCoercible[A, B]by @kevin-lee in #153 - Close #154 - [
refined4s-circe] Updaterefined4s.modules.circe.derivation.instances.derivedEncoderto usecontraCoercibleand make itinlineby @kevin-lee in #155 - Close #156 - [
refined4s-doobie] Make type-classes inrefined4s.modules.doobie.derivation.instancesinlineby @kevin-lee in #157 - Close #158 - [
refined4s-core] Improve compile-time error message forinline applymethod by @kevin-lee in #159 - Close #160 - Rename
Coerciblemethods and type parameters by @kevin-lee in #161 - refined4s v0.5.0 by @kevin-lee in #162
Full Changelog: v0.4.0...v0.5.0