Hindley-Milner型推論
よく知られた型推論アルゴリズムの一つ
HaskellでTypeInferを作るはこれに沿っている
#WIP
#??
HM型推論って、単相のものだけを指す?
多相のものは全てHMの拡張?
HM型推論とはコレである!バン!!という資料を読みたい
HM型推論以外の型推論アルゴリズムはあるのか
HM型システムと、HM型推論の関係
単相型のHindley-Milner型推論
http://esumii.github.io/min-caml/tutorial-mincaml-8.htm
https://www.fos.kuis.kyoto-u.ac.jp/~igarashi/class/isle4-06w/text/miniml011.html
https://qiita.com/uint256_t/items/7d8c8feeffc03b388825
単相型のHindley-Milner型推論を多相型に拡張したもの
https://en.wikipedia.org/wiki/Hindley–Milner_type_system#An_inference_algorithm
Algorithm W
最もオーソドックス,型の集合と束縛された型変数の置換表を使って単一化する
Algorithm M
Algorithm W を改善(高速化)したもの.Algorithm W が構文木をトップダウンに見て推論していく一方,Algorithm M はボトムアップに推論していく.W の逆なので M
Level-based HM
level という値を導入することで置き換え表を使わず多相型を扱えるようにしたもの.アルゴリズムがシンプルになり実行効率も高い
https://rhysd.hatenablog.com/entry/2017/12/16/002048
EXTENSION OF ML TYPE SYSTEM WITH A SORTED EQUATIONAL THEORY ON TYPES
(Didier Rémy 1992)
http://gallium.inria.fr/~remy/ftp/eq-theory-on-types.pdf
こんなコードがあった時に、どのタイミングでgの型が決定されるのかを知りたい #??
code:hs
rank1 :: forall a. (a -> a) -> a -> a
rank1 g x = g x
code:hs
int = rank1 (+1) 1 -- 2
chrome-extension://oemmndcbldboiebfnladdacbdfmadadm/http://lucacardelli.name/Papers/BasicTypechecking.pdf
読みやすいらしい
http://dev.stephendiehl.com/fun/006_hindley_milner.html
https://codeday.me/jp/qa/20190205/232046.html
https://speakerdeck.com/cannorin/a-brief-introduction-to-type-inference?slide=36
自動的に全称型をつける様に設計されたアルゴリズム
Generics的な、最も汎用的な型を推論
TaPL.icon 23章
/utgwkk-pub/Hindley-Milner型推論の実行時間最悪ケース
https://bellbind.hatenadiary.org/entry/20060704/1151974490
https://www.scala-lang.org/docu/files/ScalaByExample-ja_JP.pdf
https://speakerdeck.com/biacco42/17
#??
型推論器のinputとoutput
具体的にどれのことを指しているのか
HM以外のものを知らないがゆえになっているのかも知らん
実装
scala
http://dysphoria.net/2009/06/28/hindley-milner-type-inference-in-scala/
https://sites.google.com/site/scalajp/home/documentation/scala-by-example/chapter16
Groovy
http://uehaj.hatenablog.com/entry/2014/02/01/183039
kotlin
https://github.com/reki2000/hyndley-milner-kotlin/blob/master/HindleyMilner.kt
https://qiita.com/reki2000/items/b7f26e65930519295355
C
https://admarimoin.hatenablog.com/entry/2019/12/30/000337
https://github.com/semahawk/type-inference
Rust
https://slides.com/rchaser53/deck-3#/3
https://keens.github.io/blog/2019/12/08/tetsuzukigatanoudekatasuironwojissoushitemita/
Haskell
HaskellでTypeInferを作るにメモってる
自作言語の型推論
https://qiita.com/cannorin/items/73bacedd11c64293957f
http://zehnpaard.hatenablog.com/entry/2019/07/01/102918
jsで
https://takuto-h.hatenadiary.org/entry/20110401/impl
https://takuto-h.hatenadiary.org/entry/20110401/unify
ML
https://www.fos.kuis.kyoto-u.ac.jp/~igarashi/class/isle4-06w/text/miniml011.html
ocaml
https://tech.nikkeibp.co.jp/it/article/COLUMN/20070717/277580/
prolog
https://qiita.com/h_sakurai/items/6ca2b523f39f7c4bf300
F#
https://gist.github.com/pocarist/d276210532940f51b353
https://github.com/tcr/rust-hindley-milner