我正在尝试将双精度列表格式化为字符串。我想打开一个列表,例如:
[0.38, 0.94]
变成类似的东西:
"aString 0.380  0.940"
我努力了:
"aString" ++ map (printf "%7.3f") [0.38, 0.94]
并获得反馈:
<interactive>:80:19:
    No instance for (PrintfType Char)
      arising from a use of `printf'
    Possible fix: add an instance declaration for (PrintfType Char)
    In the first argument of `map', namely `(printf "%7.3f")'
    In the second argument of `(++)', namely
      `map (printf "%7.3f") [0.38, 0.94]'
    In the expression: "aString" ++ map (printf "%7.3f") [0.38, 0.94]
我无法解决这个问题。我无法撰写有效的签名。
谢谢