haskell-problem: io string -> [int]

前端 未结 4 1698
天涯浪人
天涯浪人 2021-01-18 00:18

Hello great programmers out there,

I\'m doing my first steps in haskell and have a function that confuses me:

import Data.List.Split
getncheck_guessl         


        
4条回答
  •  执念已碎
    2021-01-18 01:01

    If something is within the IO monad, you can't take it to the pure outside world for further processing. Instead, you pass your pure functions to work inside the functions within IO.

    In the end, your program reads some input and writes some output, so your main function is going to work with IO, else you'll just not be able to output anything. Instead of reading IO String and creating an [Int], pass the function that consumes that [Int] into your main function and use it inside do.

提交回复
热议问题