Changes between Version 22 and Version 23 of Status/Oct11
- Timestamp:
- 10/30/11 18:46:16 (19 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Status/Oct11
v22 v23 41 41 type X a :: Constraint 42 42 insert :: X a => a -> c a -> c a 43 i sntance Coll [] where43 instance Coll [] where 44 44 type X a = Eq a 45 45 insert x [] = [x] … … 47 47 | otherwise = y : insert x ys 48 48 }}} 49 Here `X` is an assoc aited constraints synonmy of the class `Coll`. The key point is that differnet instances can give different definitions to `X`. The GHC wiki page describesethe design [[http://hackage.haskell.org/trac/ghc/wiki/KindFact WikiConstraint]], and Max's blog posts give more examples [[http://blog.omega-prime.co.uk/?p=61 ConstraintFamlies], [http://blog.omega-prime.co.uk/?p=127 ConstraintKind]].49 Here `X` is an associated constraint synonym of the class `Coll`. The key point is that differnet instances can give different definitions to `X`. The GHC wiki page describes the design [[http://hackage.haskell.org/trac/ghc/wiki/KindFact WikiConstraint]], and Max's blog posts give more examples [[http://blog.omega-prime.co.uk/?p=61 ConstraintFamlies], [http://blog.omega-prime.co.uk/?p=127 ConstraintKind]]. 50 50 51 51 * '''Associated type synonym defaults.''' Haskell lets you give a ''default method'' for the operations of a class. 52 Associated type synonym defaults let you declare a ''default type instance'' for the associated type synony ums of a class. This feature, implemented by Max Bolingbroke, nicely fills out missing design corner. For example52 Associated type synonym defaults let you declare a ''default type instance'' for the associated type synonyms of a class. This feature, implemented by Max Bolingbroke, nicely fills out missing design corner. For example 53 53 {{{ 54 54 class C a where
