Skip to content

Commit

Permalink
Close #156 - [refined4s-doobie] Make type-classes in refined4s.module…
Browse files Browse the repository at this point in the history
…s.doobie.derivation.instances inline
  • Loading branch information
kevin-lee committed Dec 23, 2023
1 parent 24b1479 commit 5050f45
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import refined4s.{Coercible, RefinedCtor}
*/
trait instances {

given putNewtype[A, B](using coercible: Coercible[A, B], put: Put[B]): Put[A] =
inline given putNewtype[A, B](using coercible: Coercible[A, B], put: Put[B]): Put[A] =
put.contramap(coercible(_))

given derivedRefinedGet[A, B](using refinedCtor: RefinedCtor[B, A], getA: Get[A], showA: Show[A]): Get[B] =
inline given derivedRefinedGet[A, B](using refinedCtor: RefinedCtor[B, A], getA: Get[A], showA: Show[A]): Get[B] =
getA.temap(refinedCtor.create)

given derivedNewtypeGet[A, B](using coercible: Coercible[A, B], getA: Get[A]): Get[B] =
inline given derivedNewtypeGet[A, B](using coercible: Coercible[A, B], getA: Get[A]): Get[B] =
getA.map(coercible(_))

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import refined4s.{Coercible, RefinedCtor}
*/
trait instances {

given putNewtype[A, B](using coercible: Coercible[A, B], put: Put[B]): Put[A] =
inline given putNewtype[A, B](using coercible: Coercible[A, B], put: Put[B]): Put[A] =
put.contramap(coercible(_))

given derivedRefinedGet[A, B](using refinedCtor: RefinedCtor[B, A], getA: Get[A], showA: Show[A]): Get[B] =
inline given derivedRefinedGet[A, B](using refinedCtor: RefinedCtor[B, A], getA: Get[A], showA: Show[A]): Get[B] =
getA.temap(refinedCtor.create)

given derivedNewtypeGet[A, B](using coercible: Coercible[A, B], getA: Get[A]): Get[B] =
inline given derivedNewtypeGet[A, B](using coercible: Coercible[A, B], getA: Get[A]): Get[B] =
getA.map(coercible(_))

}
Expand Down

0 comments on commit 5050f45

Please sign in to comment.