开发者

how do I print a list in haskell?

开发者 https://www.devze.com 2023-03-04 17:38 出处:网络
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, bu

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].

0

精彩评论

暂无评论...
验证码 换一张
取 消