Haskell IO system is super hard to understand for me so i have question : How to read from standard input to list ? I know that there is function getLine :: IO String and interact. But i do not know how to convert the input to list so I can use it in this three functions :
powerset [] = [[]]
powerset (x:xs) = xss ++ map (x:) xss
where xss = powerset xs
main = print $ powerset([1,2])
import Control.Monad(filterM)
p = filterM(const[True,False])
main = p[1,2]
main = subsequences([1,2])
I want to be able to write 1 2 3 and pass this values to the function. Can you tell/show how to do it ?
Extra question
Haskell is full of magic so i was wondering if it possible to use input directly in the function like this :
main = subsequences(some input magic here)