Skip to content
Discussion options

You must be logged in to vote

Hey @andwrobs! There are various things at play here, but you should have a look at CasePaths for more informations about the inner bits.

A CasePath is something similar to a KeyPath that is able to extract/embed associated values for a given enum's case.

You can form a CasePath using explicit extract and embed implementations, but the library is also able to perform some reflection magic and to create a complete CasePath from a function (AssociatedValue) -> Enum.

Enum's cases with associated values are promoted to static functions of this exact shape when used without argument. For example:

enum E {
  case s(String)
}

E.s is inferred as a function (String) -> E, because E.s evaluated wit…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@andwrobs
Comment options

Answer selected by andwrobs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants