RE: List comprehensions

2003-01-30 Thread Jan de Wit

> Hello,
> 
> Recently, I came accross this
> expression:
> [ x + y | x <- xs | y <- ys ]
> 
> As far as I can see (Haskell Report),
> this is not allowed by the haskell 98
> standard. So I assume it to be an ex-
> tension. Where can I find information
> about this?
This is a parallel list comprehension, a GHC extension. See 
http://www.haskell.org/ghc/docs/latest/html/users_guide/syntax-extns.html#PA
RALLEL-LIST-COMPREHENSIONS
for more info. The code above does the same as zipWith (+) xs ys, basically.


Cheers, Jan
###

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.F-Secure.com/

###
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe



Re: hashmap withdrawal and poor haskell style

2002-04-03 Thread Jan de Wit

> On Wed, 3 Apr 2002, D. Tweed wrote:
>
> > > main = do content <- getContents
> > >   let rpt letter = report content letter
> > >   loop rpt alphabet
>
> > I'm a bit confused how this can have worked... in Haskell `let' is used
in
> > the context of a `let ..<1>.. in ..<2>..' where the code ellided in <1>
> > binds some names to values which are then used in the expression <2> (as
> > in `let x=sqrt 2 in exp x') and so the contents of main isn't (unless
I'm
> > missing something) syntactically Haskell.
>
> Beats me, but it was the only (or at least the first) way I
> could find to create a function inside a do block...

You don't need to create a function, you could use partial parametrization
instead:
| main =
|do content <- getContents
| loop (report content) alphabet
[snip]

HTH, Jan de Wit

___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe



Re: newtype/datatype (was efficiency)

2002-01-16 Thread Jan de Wit

Hi,
> data T  -- has 1 value: _|_
Minor nitpick: that Hugs and GHCi accept it, doesn't mean it's legal
Haskell'98. Otherwise we would have existential and universal quantified
types as well :-)

Cheers,

Jan



___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe