Skip to content

Instantly share code, notes, and snippets.

@ekmett
Created December 3, 2010 07:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ekmett/726694 to your computer and use it in GitHub Desktop.
Save ekmett/726694 to your computer and use it in GitHub Desktop.
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