how do I print a list in haskell?
How do I print a list to stdout in Haskell?
Let's say 开发者_如何学运维I have a list [1,2,3]
and I want to convert that list into a string and print it out. I guess I could build my own function, but surely Haskell has a function built in to do that.
Indeed there is a built in function, aptly named print
.
> print [1,2,3]
[1,2,3]
This is equivalent to putStrLn $ show [1,2,3]
.
精彩评论