Define a Haskell program that contains a function main :: 10 () . When executed the program should read one line after the other (via getLine ). It should stop its execution when reading an empty line, and then prints the lines with line-numbers attached. Here is an example dialog. All lines after the empty line have been printed by the program. Hello, this is some text. (empty line) 1 of 3. Hello, 2 of 3. this is some 3 of 3. text.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 8SA
icon
Related questions
Question
please solve asap.
Define a Haskell program that contains a
function main :: IO () . When executed the
program should read one line after the other
(via getLine ). It should stop its
execution when reading an empty line, and
then prints the lines with line-numbers
attached.
Here is an example dialog. All lines after the
empty line have been printed by the program.
Hello,
this is some
text.
(empty line)
1 of 3. Hello,
2 of 3. this is some
3 of 3. text.
Make sure that in your program, the output is
precisely formatted as indicated.
Transcribed Image Text:Define a Haskell program that contains a function main :: IO () . When executed the program should read one line after the other (via getLine ). It should stop its execution when reading an empty line, and then prints the lines with line-numbers attached. Here is an example dialog. All lines after the empty line have been printed by the program. Hello, this is some text. (empty line) 1 of 3. Hello, 2 of 3. this is some 3 of 3. text. Make sure that in your program, the output is precisely formatted as indicated.
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning