Changes between Version 1 and Version 2 of PolymorphicKinds
 Timestamp:
 Oct 16, 2008 1:04:07 PM (8 years ago)
Legend:
 Unmodified
 Added
 Removed
 Modified

PolymorphicKinds
v1 v2 102 102 == Type Classes == 103 103 104 Declaration options: 104 105 106 === Option 1: Implicit kind variables === 105 107 106 108 {{{ … … 109 111 110 112 class Bar (a :: k > *) => Baz (a :: * > k) where  superclass, explicit name (shared) 111 class Bar a => Baz (a :: * > k) where  superclass, implicit or new name?113 class Bar a => Baz (a :: * > k) where  superclass, new k? 112 114 113 115 instance Bang (a :: k > *) => Bar (a :: k > *)  instance implication, explic 116 instance Bang a => Bar (a :: k > *)  instance implication, explic 117 118 class Foo (a :: k > *) (b :: k > *) where  MPTC name shared 114 119 }}} 120 121 === Option 2: Explicit kind variables === 122 123 Here reusing {{{forall}} is probably safe, although possibly inconsistent if we go for {{{forall_kind}}} (or other) as a term level quantifier... 115 124 116 125 {{{ 117 126 #!text/xhaskell 118 class forall k . Blah (a :: k > *) where 127 class forall k . Blah (a :: k > *) where  standalone 128 class forall k . Baz (a :: k > *) => Bar (a :: * > k) where  superclass, shared k 129 class forall k . Baz a => Bar (a :: * > k) where  superclass, new k 130 131 instance forall k . Bang (a :: k > *) => Bar (a :: k > *)  instance implication, shared k 132 instance forall k . Bang a => Bar (a :: k > *)  instance implication, new k 133 134 class forall k . Foo (a :: k > *) (b :: k > *) where  MPTC name shared 119 135 }}} 120 136 137 Again, this doesn't seem to add much now, however if we ever want to constrain the kind variables to particular sorts in the future, we will probably need binders for them. 138 139 === Option 3: Explicit kind signatures for type classes === 140 141 Can't do this in general, as you need to name the variables that index the type class for use in member functions. Although for type classes with no member functions this may be a viable option. The question is what is the result of a type class? 142 121 143 {{{ 122 #!text/xhaskell 123 class forall k . Baz (a :: k > *) => Bar (a :: * > k) where 144 class Blah :: forall k . (k > *) > ??? where 124 145 }}} 146 147 148 == Type functions == 149 150 Follow as per type classes 151 125 152 126 153 == Syntax of Kinds == … … 133 160 == Syntax of Types == 134 161 135 Type syntax need to be extended with a new binder TODO162 Type syntax need to be extended with a new binder. 136 163 137 164 138 == Type Classes == 165 == Implementation route == 166 ... 139 167 140 TODO141 168 142 169 == To classify ==