From: simonmar Date: Thu, 5 Apr 2001 09:10:35 +0000 (+0000) Subject: [project @ 2001-04-05 09:10:35 by simonmar] X-Git-Tag: Approximately_9120_patches~2197 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=a55f1f2cbd30b1a0337360f6d28986807e57f9e5;p=ghc-hetmet.git [project @ 2001-04-05 09:10:35 by simonmar] Add notes on parallel list comprehensions from Jeff Lewis. --- diff --git a/ghc/docs/users_guide/5-00-notes.sgml b/ghc/docs/users_guide/5-00-notes.sgml index b1377c3..11bc59f 100644 --- a/ghc/docs/users_guide/5-00-notes.sgml +++ b/ghc/docs/users_guide/5-00-notes.sgml @@ -50,7 +50,8 @@ been removed. - Parallel list comprehensions added. + Parallel list comprehensions added. See . Profiling: please use @@ -118,14 +119,28 @@ linkend="sec-MVars">). - The Integer type now has an instance - of Bits (). + The Int and + Integer types now have instances of + Bits (). Package hssource has been added. It contains a Haskell 98 abstract syntax, parser, lexer and pretty printer. No documentation yet. + + The methods fromInt and + toInt, which used to be in class + Num but exported from module + Int, are no longer in class + Num. They're still available from module + Int, however. + + In most cases, there should be no benefit from using + fromInt instead of + fromIntegral, which is specialised for all + integral types. + diff --git a/ghc/docs/users_guide/glasgow_exts.sgml b/ghc/docs/users_guide/glasgow_exts.sgml index b0b36ba..bea9fcd 100644 --- a/ghc/docs/users_guide/glasgow_exts.sgml +++ b/ghc/docs/users_guide/glasgow_exts.sgml @@ -96,6 +96,15 @@ Executive summary of our extensions: + Parallel list comprehensions + + An extension to the list comprehension syntax to support + zipWith-like functionality. See . + + + + Foreign calling: Just what it sounds like. We provide @@ -533,6 +542,56 @@ qualifier list has just one element, a boolean expression. + + Parallel List Comprehensions + list comprehensionsparallel + + parallel list comprehensions + + + Parallel list comprehensions are a natural extension to list + comprehensions. List comprehensions can be thought of as a nice + syntax for writing maps and filters. Parallel comprehensions + extend this to include the zipWith family. + + A parallel list comprehension has multiple independent + branches of qualifier lists, each separated by a `|' symbol. For + example, the following zips together two lists: + + + [ (x, y) | x <- xs | y <- ys ] + + + The behavior of parallel list comprehensions follows that of + zip, in that the resulting list will have the same length as the + shortest branch. + + We can define parallel list comprehensions by translation to + regular comprehensions. Here's the basic idea: + + Given a parallel comprehension of the form: + + + [ e | p1 <- e11, p2 <- e12, ... + | q1 <- e21, q2 <- e22, ... + ... + ] + + + This will be translated to: + + + [ e | ((p1,p2), (q1,q2), ...) <- zipN [(p1,p2) | p1 <- e11, p2 <- e12, ...] + [(q1,q2) | q1 <- e21, q2 <- e22, ...] + ... + ] + + + where `zipN' is the appropriate zip for the given number of + branches. + + + The foreign interface