Open
Description
When building with new js backend, the following code breaks:
setInputValue :: JSString -> JSString -> JSM ()
setInputValue elId val = do
mdoc <- currentDocument
for_ mdoc $ \doc -> do
mel <- getElementById doc elId
for_ mel $ \el -> do
minp <- castTo HTMLInputElement el
for_ minp $ \inp -> do
setValue inp val
as does the equivalent code with HTMLTextAreaElement
. The error message is:
TypeError: Failed to construct 'HTMLInputElement': Please use the 'new' operator, this DOM object constructor cannot be called as a function.
and the underlying generated code that breaks is:
function h$ghcjszmdomzmjavascriptzm0zi9zi9zi0zm9L333ZZodsSjL72bj0Jts5nZCGHCJSziDOMziTypeszizdfIsGObjectHTMLInputElement1_e() {h$bh();
var h$$55b79042=window["HTMLInputElement"]();
var h$$75b79042=h$$55b79042;
h$r1=h$c1(h$baseZCGHCziJSziPrimziJSVal_con_e,h$$75b79042);
return h$rs();
};
Following the suggested fix with new
just gives a different error:
TypeError: Illegal constructor
This is using commit 9b4b41a
of this repo, on haskell.nix
commit 660bbe7
, with ghc-9.8.2
.
Metadata
Assignees
Labels
No labels