Skip to content

Instantly share code, notes, and snippets.

@ekmett
Created December 3, 2010 07:51
Embed
What would you like to do?
object hom {
trait set {
type inf
type sup >: inf
type hom[_>:inf<:sup,_>:inf<:sup]
type dual = set.of[inf,sup,({type λ[x>:inf<:sup,y>:inf<:sup]=hom[y,x]})#λ]
}
object set {
trait of[l,h>:l,c[_>:l<:h,_>:l<:h]] extends set {
type inf = l
type sup = h
type hom[x>:inf<:sup,y>:inf<:sup] = c[x,y]
}
trait singleton[z] extends of[Nothing,Nothing,({type λ[x>:Nothing<:Nothing,y>:Nothing<:Nothing]=z})#λ]
}
}
trait category[h <: hom.set] {
def id[A>:h#inf<:h#sup]: h#hom[A,A]
def compose[A>:h#inf<:h#sup, B>:h#inf<:h#sup, C>:h#inf<:h#sup](f : h#hom[B,C], g: h#hom[A,B]) : h#hom[A,C]
type dual = category[h#dual]
def dual : dual
}
<console>:9: error: type arguments [y,x] do not conform to type hom's type parameter bounds [_ >: set.this.inf <: set.this.sup,_ >: set.this.inf <: set.this.sup]
type dual = category[h#dual]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment