I have got Error while compiling the following code
type shape =
| Circle int
| Square int
| Rectangle int int;
let myShape = Circle 10;
let area =
switch myShape {
| Circle r => float_of_int (r * r) *. 3.14
| Square w => float_of_int (w * w)
| Rectangle w h => float_of_int (w * h)
};
Js.log area;
Fatal error: exception Failure("nth")
ninja: build stopped: subcommand failed.
When I change the Rectangle to tuple (int, int), it works
type shape =
| Circle int
| Square int
| Rectangle (int, int);
let myShape = Circle 10;
let area =
switch myShape {
| Circle r => float_of_int (r * r) *. 3.14
| Square w => float_of_int (w * w)
| Rectangle (w, h) => float_of_int (w * h)
};
Js.log area;
Ref. stackoverflow
my-first-app|⇒ npm run build
> [email protected] build /Users/kkpoon/Development/my-first-app
> bsb -make-world
BSB check build spec : OK
Making the dependency world!
Package stack: my-first-app
ninja.exe -C lib/bs
ninja: Entering directory `lib/bs'
[2/2] Building src/demo.mlast.d
[1/1] Building src/demo.cmj /Users/kkpoon/Development/my-first-app/lib/js/src/demo.js src/demo.cmi
FAILED: src/demo.cmj /Users/kkpoon/Development/my-first-app/lib/js/src/demo.js src/demo.cmi
/usr/local/lib/node_modules/bs-platform/bin/bsc.exe -bs-package-name my-first-app -bs-package-output commonjs:lib/js/src -bs-assume-no-mli -bs-no-builtin-ppx-ml -bs-no-implicit-include -I src -nostdlib -I '/Users/kkpoon/Development/my-first-app/node_modules/bs-platform/lib/ocaml' -no-alias-deps -color always -w -40+6+7+27+32..39+44+45 -o src/demo.mlast -c src/demo.mlast
Fatal error: exception Failure("nth")
ninja: build stopped: subcommand failed.
Error happened when running command /usr/local/lib/node_modules/bs-platform/bin/bsb.exe with args [ '-make-world' ]
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: `bsb -make-world`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/kkpoon/.npm/_logs/2017-07-25T01_47_46_774Z-debug.log
fixed in #1824
Most helpful comment
fixed in #1824