[Haskell-cafe] Lazy Lists and IO

Justin Bailey jgbailey at gmail.com
Wed Jul 11 17:24:35 EDT 2007


On 7/10/07, Ronald Guida <ronguida at mindspring.com> wrote:
> Hi Everyone,
>
> A few weeks ago, I started learning Haskell (and functional
> programming) on my own from the wealth if information on the internet.
> I recently read the paper "Why Functional Programming Matters" [1] and
> it led me to wonder how to input a lazy list.

Another way to do this using my HCL[1] library:

import HCL

main =
  do
    total <- runRequest $ reqLift sum (reqList $ prompt "Please enter
an integer value (or enter to quit): " reqInteger)
    putStrLn $ "Your entries totaled: " ++ (maybe "nothing!" show total)

Justin

[1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HCL-1.1


More information about the Haskell-Cafe mailing list