ekzhang/crepe

support for enums

dvc94ch opened this issue · 2 comments

currently you can work around it like this:

Authorized(p.root(), f.principal(), f.permission(), f.label())
        <- Says(p, f, c), (la_auth(p, f) && f.is_can() && c.is_none());

but this quickly gets out of hand. I'd much prefer being able to write something like this:

Authorized(d, p, r, l) <- Says(Principal::LocalAuthority(d), Fact::Can(p, r, l), None), (l.root() == d)

Just cloned the repo to add this feature and found the destructure test. I'm pretty sure there was no example using enums in the crepe! docs :)

Ah yeah, there wasn't an example of it, but we do support destructuring let bindings. You're welcome to contribute an example, it would be appreciated! :)