[Haskell-cafe] loop problem

Stuart A. Kurtz stuart at cs.uchicago.edu
Sat May 10 17:45:06 UTC 2014

Dear Alexander,

> While we're having fun golfing, my attempt:
> mapM_ (\(x, y) -> printf "%d %d\n" x y) $ [(n, n^2) | n <- [1..100]]

Nice, although I'm a bit perplexed as to why it typechecks without hints, whereas the following (which avoids the boxing/unboxing of pairs) does not:

    mapM_ (\n -> printf "%d %d" n (n^2)) [1..100]



More information about the Haskell-Cafe mailing list