简体   繁体   English

如何使用ghcjs进行多线外国进口?

[英]How do I do multiline foreign imports with ghcjs?

How do I do multiline foreign imports in GHCJS? 如何在GHCJS中进行多线外国进口? I have a block of javascript that stretches over multiple lines: 我有一个跨越多行的javascript块:

foreign import javascript unsafe
  "{ var x = 41;\
  \  $r = x + 1; \
  \}"
  answerToGreatestQuestion :: IO (JSRef Double)

And I get an error like: 我得到一个错误,如:

lexical error in string/character literal at character 'i'

which points to the \\ character. 它指向\\字符。 What's going on here? 这里发生了什么?

If you're within a CPP block, remove the leading \\ from each line. 如果您在CPP块内,请从每行中删除前导\\ See this issue . 看到这个问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM