String formatting in Haskell

前端 未结 5 600
一生所求
一生所求 2021-02-05 00:05

What is Haskell\'s equivalent of

string str = string.Format(\"{0} {1}\",10,20); // C#
5条回答
  •  走了就别回头了
    2021-02-05 00:44

    Putting answer here in case somebody searching for formatting libraries in Haskell on StackOverflow. There's type-safe and fast formatting library called fmt now. With it you can write code like this:

    > "There are "+|n|+" million bicycles in "+|city|+"."
    

提交回复
热议问题