how do I print a list in haskell?

前端 未结 1 1785
礼貌的吻别
礼貌的吻别 2021-02-05 04:08

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

1条回答
  •  时光说笑
    2021-02-05 04:35

    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 讨论(0)
提交回复
热议问题