hashmap withdrawal and poor haskell style

Jan de Wit Jan de Wit" <jwit@cs.uu.nl
Wed, 3 Apr 2002 14:46:44 +0200


> 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