ohnosequences / stuff

Useful stuff.
GNU Affero General Public License v3.0
1 stars 0 forks source link

Review Functors #57

Closed eparejatobes closed 7 years ago

eparejatobes commented 7 years ago

Similar to #56.

eparejatobes commented 7 years ago

Note to self: I think I should go back to not having upper-bounds containing projections; if you need <: X#Y where X <: Buh use Buh.is[X]#Y instead, and give it a name. Example:

// inside functor
type SourceObjects = Category.is[Source]#Objects
type TargetObjects = Category.is[Target]#Objects
// now the type constructor
type F[X <: SourceObjects] <: TargetObjects
eparejatobes commented 7 years ago

Re https://github.com/ohnosequences/stuff/pull/57#issuecomment-337589581:

There's no need for the Category.is there. We do need names like SourceObjects, but the is for a type variable Fn <: Functor would bound them to be Fn#SourceObjects. Then, if we need to do something with that, we have a value Category.is[Source], for which the projection #Objects will match is[Fn]#SourceObjects = Fn#SourceObjects = Source#Objects.

eparejatobes commented 7 years ago

A note for future optimizers: you cannot make FunctorSyntax a value class; type inference fails (yes, is a bug).

eparejatobes commented 7 years ago

LGTM