将 D3 vis 从 Javascript 转换为 Purescript 的神秘语法错误
Mysterious syntax error converting a D3 vis from Javascript to Purescript
我正在将 D3 可视化从 Javascript 转换为 Purescript,但在尝试在 do 块中保存选择时出现语法错误。
这是代码:
enterCountry country = do
sel <- select "g.root"
.. selectAll "g.country"
.. data (\c -> c.name)
.. enter
.. append "g" .. attr "class" "country"
sel .. append "title" .. text (\c -> c.name)
这是错误:
unexpected LArrow
expecting no indentation or end of input
See https://github.com/purescript/purescript/wiki/Error-Code-ErrorParsingModule for more information, or to contribute content related to this error.
错误指向以 sel <- ...
开头的行
不幸的是,在这种情况下,它似乎不是特别有用的错误消息,但我相信这是因为您试图将关键字 data
用作函数。
我不知道 purescript-d3 api,所以我不确定该函数应该是什么。但希望这会引导您朝着正确的方向前进。
我正在将 D3 可视化从 Javascript 转换为 Purescript,但在尝试在 do 块中保存选择时出现语法错误。
这是代码:
enterCountry country = do
sel <- select "g.root"
.. selectAll "g.country"
.. data (\c -> c.name)
.. enter
.. append "g" .. attr "class" "country"
sel .. append "title" .. text (\c -> c.name)
这是错误:
unexpected LArrow
expecting no indentation or end of input
See https://github.com/purescript/purescript/wiki/Error-Code-ErrorParsingModule for more information, or to contribute content related to this error.
错误指向以 sel <- ...
不幸的是,在这种情况下,它似乎不是特别有用的错误消息,但我相信这是因为您试图将关键字 data
用作函数。
我不知道 purescript-d3 api,所以我不确定该函数应该是什么。但希望这会引导您朝着正确的方向前进。