Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upAlternative interface and Seminearring annotations #2
Conversation
tel
added some commits
Mar 11, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
tel commentedMar 10, 2014
If you just have an applicative interface then you can annotate it by
folding a
Monoid ann => Const annover your applicative. If you have analternative interface, though, which is at least interesting for this use
case if not required, then you need more structure on your annotation.
In particular, here we can see annotation which is carried out by choosing
the alternative to be left-distributive and sequential (deterministic
choice, ordered choice) and then annotating the process with a
(left-distributive) semi-nearring.
The end result is basically perfect, but this feature is very complex. The
sequential nature does provide a simple API, however, though, as we can
write 'first' which simply ignores choice to provide a "preferred" entry.
We also might want to write 'flatten' which converts the seminearring to
disjunctive normal form, though it's unclear what exactly that is.
There's also the question of whether closure should make sense in a scenario
like this. Obviously this has some relation to 'some' and 'many' which,
themselves, don't make a whole lot of sense yet.