Changes between Version 1 and Version 2 of ScopedTypeVariables
 Timestamp:
 Nov 29, 2005 2:18:57 PM (10 years ago)
Legend:
 Unmodified
 Added
 Removed
 Modified

ScopedTypeVariables
v1 v2 6 6 == Brief Explanation == 7 7 8 Type annotations, which Haskell 98 allows in expressions, are also allowed in patterns and (currently in GHC only) in result type signatures, attached to the left side of a function definition. New type variables in these annotations scope over the function body, permitting locally defined variables to be given signatures in situations where it would be impossible in Haskell 98, e.g. 9 {{{ 10 sortImage :: Ord b => (a > b) > [a] > [a] 11 sortImage (f::a>b) = sortBy cmp 12 where cmp :: a > a > Ordering 13 cmp x y = compare (f x) (f y) 14 }}} 15 8 16 == References == 9 * [http://www.haskell.org/ghc/docs/latest/html/users_guide/typeextensions.html#scopedtypevariables] GHC documentation. 17 * [http://www.haskell.org/ghc/docs/latest/html/users_guide/typeextensions.html#scopedtypevariables GHC documentation] 18 * [http://cvs.haskell.org/Hugs/pages/users_guide/typeannotations.html Hugs documentation] 19 20 Note that although GHC and Hugs use the same syntax, the meaning of type variables is quite different, and there are other differences too. 10 21 11 22 == Pros ==