Changes between Version 4 and Version 5 of MultiParamTypeClasses


Ignore:
Timestamp:
Dec 5, 2005 5:56:23 PM (10 years ago)
Author:
ross@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MultiParamTypeClasses

    v4 v5  
    88Classes take one or more arguments, becoming relations between types.
    99
     10The `base` package of the [http://www.haskell.org/ghc/current/docs/html/libraries/index.html Haskell hierarchical libraries] contains only two such classes:
     11{{{
     12class HasBounds a => IArray a e
     13class (HasBounds a, Monad m) => MArray a e m
     14}}}
     15There are FlexibleInstances
     16{{{
     17instance IArray Array e
     18instance IArray UArray Bool
     19instance IArray UArray Char
     20...
     21}}}
     22but no OverlappingInstances.
     23
    1024== References ==
    1125
     
    1630== Pros ==
    1731 * offered by GHC and Hugs for years
    18  * express more interesting relationships, as in the two occurrences in the `base` package of the [http://www.haskell.org/ghc/docs/latest/html/libraries/index.html Haskell hierarchical libraries]:
    19 {{{
    20 class HasBounds a => IArray a e
    21 class (HasBounds a, Monad m) => MArray a e m
    22 }}}
    23    The instances supplied do not overlap.
     32 * express more interesting relationships
    2433
    2534== Cons ==
    26  * not very usable without FlexibleInstances or UndecidableInstances
     35 * usually require FlexibleInstances or UndecidableInstances
    2736 * often lead to OverlappingInstances and ambiguity, though these can sometimes be avoided using FunctionalDependencies or AssociatedTypes. Examples include container and monad classes.