Changes between Version 1 and Version 2 of ExistentialQuantification


Ignore:
Timestamp:
Nov 29, 2005 12:32:10 AM (8 years ago)
Author:
ross@…
Comment:

ref + variations between implementations

Legend:

Unmodified
Added
Removed
Modified
  • ExistentialQuantification

    v1 v2  
    77 
    88== References == 
    9  * [http://www.haskell.org/ghc/docs/latest/html/users_guide/type-extensions.html#existential-quantification] GHC documentation 
     9 * [http://www.cs.luc.edu/users/laufer/papers/toplas94.pdf Polymorphic Type Inference and Abstract Data Types] by K. Läufer and M. Odersky, in TOPLAS, Sep 1994. 
     10 * [http://www.haskell.org/ghc/docs/latest/html/users_guide/type-extensions.html#existential-quantification GHC documentation] 
     11 
     12== Variations == 
     13 
     14 * Hugs allows existential quantification for newtype declarations, as long as there are no class constraints. 
     15   {{{ 
     16newtype T = forall a. C a 
     17}}} 
     18   GHC and Nhc98 do not. 
     19 
     20 * Hugs and Nhc98 allow matching on an existentially quantified constructor in a pattern binding declaration, except at the top level. 
     21   {{{ 
     22data T = forall a. C (a -> Int) a 
     23foo t = let C f x = t in f x 
     24}}} 
     25   GHC does not allow such matching. 
     26 
     27 * None of the implementations can derive instances for existentially quantified types, but this could be relaxed, e.g 
     28   {{{ 
     29data T = forall a. Show a => C [a] 
     30        deriving Show 
     31}}} 
     32 
     33 * GHC 6.5 allows fields with existentially quantified types, though selectors may only be used if their type does not include the quantified variable. 
     34   {{{ 
     35data T = forall a. C { f1 :: a, f2 :: Int } 
     36}}} 
    1037 
    1138== Pros ==