Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Semiring incorrect, needs to be re-designed #11

Open
bkase opened this issue May 29, 2017 · 1 comment
Open

Semiring incorrect, needs to be re-designed #11

bkase opened this issue May 29, 2017 · 1 comment

Comments

@bkase
Copy link
Member

bkase commented May 29, 2017

With the current definition of Semiring, that is:

protocol Semiring: Multiplicative, Additive { }

There is no notion of defining a separate plus and times, as Multiplicative and Additive both inherit from Semigroup and Magma and so only have a single <> operation defined on them.

I propose we rename Additive -> Monoid and make Multiplicative use a new operator for the times operation. We can alias <+> to <> as in the Haskell Semiring package.
Since <.> can't be defined in Swift (what's used in Haskell's Semiring) and <*> is apply, maybe we use <**>?

@bkase
Copy link
Member Author

bkase commented May 29, 2017

Alternatively we can just overload + and *

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant