Reputation: 8058
Basically what is said in the title.
I would like to input
4 6 17 4
and it would give me the list
[4, 6, 17, 4]
Upvotes: 0
Views: 859
Reputation: 52029
main = do
ln <- getLine
let ints = map read (words ln) :: [Int]
... do something with ints...
ints
is a list of Int
values.
The type signature :: [Int]
is needed so read
knows what to return.
Upvotes: 3