Skip to content

Example usage of droste with expressions of varying inner types #178

Open
@kthompson

Description

I have looked at higherkindness.athema.Expr[V, A] and it seems to provide type variable V for certain expressions.

I have an expression tree that I would like to define similar to above but what makes it unique is that there are at least five different base types if you will where expressions would require and only work with one of those base types. My thought was to define a type something like:

sealed trait Expr[A, B, C, D, E]
case class OpOnA[A, B, C, D, E](a: A) extends Expr[A, B, C, D, E]
case class CombineOnlyAsAndBs[A, B, C, D, E](a: A, b: B) extends Expr[A, B, C, D, E]
case class ConvertBToC[A, B, C, D, E](b: B, someValue: String) extends Expr[A, B, C, D, E]
case class RunC[A, B, C, D, E](c: C, time: Int) extends Expr[A, B, C, D, E]
...

Am I on the right track with the above? If so how do I use Fix with so many type parameters on Expr?

If not is there a more in depth example of droste that I can look at that has a similar constraint?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions