Testing Mithril with Bucklescript
- write js-ffi (in bucklescript) and normal ocaml code in src/
- npm run watch runs ninja build tool, compiles src-files to folder lib/js/src
- npm run bundle-watch runs webpack via entry lib/js/src/main.js, puts bundle under dist/
- browser-> public/index.html
- { [Function: m] mount: ”, … }
- this object we get when var m = require(‘mithril’)
- m here is mithrils m-helper which unifies a lot of functionality
- this not working: external h : string -> string -> vnode = “m” [@@bs.module “mithril”]
- SOLUTION: leave [@@bs.module] empty, i.e.:
- external m : string -> string -> vnode = “mithril” [@@bs.module]
- will generate: M(“span”, v[0])
- SOLUTION: leave [@@bs.module] empty, i.e.:
- when removing mli declarations, bsc complaining: unbound symbols