Skip to content

Instantly share code, notes, and snippets.

@sellout sellout/categories.md
Last active Feb 19, 2019

Embed
What would you like to do?

So, I have these declarations

https://github.com/sellout/cheshire/blob/eliminate-TCategory/core/src/main/scala/cheshire/Category/Monoidal.scala#L35-L43

which bottom out with these type aliases

https://github.com/sellout/cheshire/blob/eliminate-TCategory/core/src/main/scala/cheshire/Semiring.scala#L6-L12

but then these definitions

https://github.com/sellout/cheshire/blob/eliminate-TCategory/core/src/main/scala/cheshire/Category/Set.scala#L60-L74

fail with errors like

overriding method leftDistribute in trait TRigCategory of type [A, B, C]=> this.Multiply[A,this.Add[B,C]] => this.Add[this.Multiply[A,B],this.Multiply[A,C]];
[error]  method leftDistribute has incompatible type
[error]     def leftDistribute[A, B, C]
[error]         ^
[info] [A, B, C]=> (A, Either[B,C]) => Either[(A, B),(A, C)] <: [A, B, C]=> this.Multiply[A,this.Add[B,C]] => this.Add[this.Multiply[A,B],this.Multiply[A,C]]?
[info]   => (A, Either[B,C]) => Either[(A, B),(A, C)] <: => this.Multiply[A,this.Add[B,C]] => this.Add[this.Multiply[A,B],this.Multiply[A,C]]?
[Info]   false
[info] false

and if I remove the explicit type annotations, it’s like

type mismatch;
[error]  found   : scala.util.Left[(Any, Any),Nothing]
[error]  required: this.Add[this.Multiply[A,B],this.Multiply[A,C]]
[error]     (which expands to)  cheshire.TCommutativeSemigroup#Product[cheshire.TMonoid#Product[A,B],cheshire.TMonoid#Product[A,C]]
[error]       case (a, Left(b)) => Left((a, b))
[error]                                ^
[info] scala.util.Left[(Any, Any),Nothing] <: this.Add[this.Multiply[A,B],this.Multiply[A,C]]?
[info] false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.