3

How do I do multiline foreign imports in GHCJS? I have a block of javascript that stretches over multiple lines:

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?

pchiusano
  • 775
  • 5
  • 12

1 Answers1

5

If you're within a CPP block, remove the leading \ from each line. See this issue.

pchiusano
  • 775
  • 5
  • 12