Changes between Version 5 and Version 6 of ExistentialQuantification


Ignore:
Timestamp:
Dec 2, 2005 5:29:05 PM (8 years ago)
Author:
ross@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ExistentialQuantification

    v5 v6  
    2828Several possibilities have been proposed: 
    2929 
    30 implicit quantification:: 
     30 implicit quantification:: 
    3131  {{{ 
    3232data Accum a = MkAccum s (a -> s -> s) (s -> a) 
     
    3535  The main counterargument is that one can easily introduce an existential type by forgetting an argument to the data type. Error messages might confuse the novice programmer. 
    3636 
    37 `forall` before the constructor:: 
     37 `forall` before the constructor:: 
    3838  {{{ 
    3939data Accum a = forall s. MkAccum s (a -> s -> s) (s -> a) 
     
    4141  This is the currently implemented syntax, motivated by the type of the data constructor, but it can be confused with PolymorphicComponents. 
    4242 
    43 `exists` before the constructor:: 
     43 `exists` before the constructor:: 
    4444  {{{ 
    4545data Accum a = exists s. MkAccum s (a -> s -> s) (s -> a) 
    4646}}} 
    4747  which reinforces the connection to existential types. When analysing such a value, you know only that there exists some type `s` such that the arguments have these types. 
    48 Reserves an extra word. 
     48  Reserves an extra word. 
    4949 
    50 [wiki:GADTs GADT] syntax:: 
     50 [wiki:GADTs GADT] syntax:: 
    5151  {{{ 
    5252data Accum :: * -> * where 
     
    8181}}} 
    8282 
    83  
    84  
    85  
    86  
    8783== Pros == 
     84 * offered by GHC and Hugs for over 15 years, HBC even longer and also by Nhc98. 
    8885 * quite handy for representations that delay composition or application, e.g. objects, various parser combinator libraries from Utrecht. 
    8986