Elmプログラムの起動
code:elm
main = text "hello"
code:javascript
var $author$project$Main$main = $elm$html$Html$text('hello');
_Platform_export({'Main':{'init':_VirtualDom_init($author$project$Main$main)(0)(0)}});}(this));
code:js
var $author$project$Main$main = $elm$browser$Browser$element(
{
init: function (_v0) {
return _Utils_Tuple2(_Utils_Tuple0, $elm$core$Platform$Cmd$none);
},
subscriptions: function (_v1) {
return $elm$core$Platform$Sub$none;
},
update: F2(
function (_v2, _v3) {
return _Utils_Tuple2(_Utils_Tuple0, $elm$core$Platform$Cmd$none);
}),
view: function (_v4) {
return $elm$html$Html$text('view');
}
});
_Platform_export({'Main':{'init':$author$project$Main$main(
$elm$json$Json$Decode$succeed(_Utils_Tuple0))(0)}});}(this));
Browser.element を読んでいる
var _Browser_element = __Debugger_element || F4(function(impl, flagDecoder, debugMetadata, args) という定義になっているが、implはBrowser.element の第一引数、 flagDecoderはmainのflagに入る型情報からコンパイラが適切なjsonDecoderを考えて挿入してくれている。debugMetadataは、elm make --debugをしたときにコンパイラのversionなどのメタデータを生成して渡すようになっている
_Browser_element
-> _Platform_initialize