This for example:
"use strict"
function powerOfTwo (power) {
return 2.0 ** power;
};
exports.powerOfTwo = powerOfTwo
module Power where
foreign import powerOfTwo :: Number -> Number
Throws this error
The module could not be parsed:
MulToken {tokenSpan = TokenPn 58 4 15, tokenComment = []}
PureScript only supports ECMAScript 5 (which was standardized in 2009).
The ** operator was added in ECMAScript 2016, which is quite recent.
You can use Math.pow(2.0, power) instead.
This would need to be addressed in language-javascript, but @Pauan is right that this is expected behavior as we expect ES5 syntax.
TIL ** was introduced in ECMAScript 2016. Thanks 馃檪!
Most helpful comment
PureScript only supports ECMAScript 5 (which was standardized in 2009).
The
**operator was added in ECMAScript 2016, which is quite recent.You can use
Math.pow(2.0, power)instead.