|Subject:||Re: [Haskell-cafe] Restrictions on associated types for classes|
|Date:||Thu, 17 Dec 2009 21:15:27 +0100|
class Cl [a] => Cl a
instance Cl a => Cl [a]
(I omit the type family constructor in the head for simplicyt)
state the same (logical) property:
For each Cl t there must exist Cl [t].
Their operational meaning is different under the dictionary-passing translation .
The instance declaration says we build dictionary Cl [a] given the
dictionary Cl [a]. The super class declaration says that the dictionary for Cl [a]
must be derivable (extractable) from Cl a's dictionary. So, here
we run into a cycle (on the level of terms as well as type inference).
However, if we'd adopt a type-passing translation  (similar to
dynamic method lookup in oo languages) then there isn't
necessarily a cycle (for terms and type inference). Of course,
we still have to verify the 'cyclic' property which smells like
we run into non-termination if we assume some inductive reason
(but we might be fine applying co-induction).
 Cordelia V. Hall, Kevin Hammond, Simon L. Peyton Jones, Philip Wadler: Type Classes in Haskell. ACM Trans. Program. Lang. Syst. 18(2): 109-138 (1996)
 Satish R. Thatte: Semantics of Type Classes Revisited. LISP and Functional Programming 1994: 208-219
On Thu, Dec 17, 2009 at 6:40 PM, Simon Peyton-Jones <[email protected]> wrote:
_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
|<Prev in Thread]||Current Thread||[Next in Thread>|
|Previous by Date:||Re: [Haskell-cafe] lhs2tex, Haskell Platform and cygwin, Stephen Tetley|
|Next by Date:||Re: [Haskell-cafe] Restrictions on associated types for classes, Dan Weston|
|Previous by Thread:||RE: [Haskell-cafe] Restrictions on associated types for classes, Simon Peyton-Jones|
|Next by Thread:||Re: [Haskell-cafe] Restrictions on associated types for classes, Dan Weston|
|Indexes:||[Date] [Thread] [Top] [All Lists]|