Skip to content

JavaScript: forceBool uses old GHCJS syntax

In GHC.HsToCore.Foreign.JavaScript we define forceBool, which is intended to "cast" a JavaScript value to a JavaScript bool by double-negating it.

Currently, this is implemented as:

let forceBool e = mkJsCall ccall_uniq (fsLit "$r = !(!$1)") [e] boolTy

GHCJS previously used this $r return register, but the JavaScript backend uses anonymous functions, so the implementation should be:

(($1) => { return !(!$1); })
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information