-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't invoke magnolia for built-in customs instances (e.g. encodeList)
- Loading branch information
Showing
5 changed files
with
88 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package pl.msitko.dhallj.generic | ||
|
||
// Workaround for issues with magnolia trying to derive instances having custom encoder/decoders | ||
// Read more about that workaround here: https://github.com/propensive/magnolia/issues/107#issuecomment-589289260 | ||
case class Exported[A](instance: A) extends AnyVal | ||
|
||
//import scala.language.higherKinds | ||
import magnolia.Magnolia | ||
import scala.reflect.macros.whitebox | ||
|
||
object ExportedMagnolia { | ||
|
||
def exportedMagnolia[TC[_], A: c.WeakTypeTag](c: whitebox.Context): c.Expr[Exported[TC[A]]] = { | ||
val magnoliaTree = c.Expr[TC[A]](Magnolia.gen[A](c)) | ||
c.universe.reify(Exported(magnoliaTree.splice)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters