タグ

関連タグで絞り込む (1)

タグの絞り込みを解除

Rank-NTypesに関するtheatricalのブックマーク (2)

  • Haskellのforallについて理解したことを書いておく(ランクN多相限定)。 - uehaj's blog

    Haskellのforallについて理解したことを書いておくyo!(ランクN多相限定*1 )。 前提知識のおさらい: 型・多相型・型検査・型推論… 最初に基概念を整理しておきます。 IntやInt->Intは単相型、aやa->aは多相型である。ここでaを型変数と呼ぶ。型変数を含む型が多相型ってわけです。 言語処理系の実装上、型という概念は型変数や型コンストラクタのツリー構造として表現される。Int,Char,[],->,(,),(,,,),IO aなどが型コンストラクタ。 a,bが型変数。組合せて(a->[Int])->[b]->(a,b)とか。::の右に書くやつです。 型は、プログラムの字面上に直接的実体がある関数や変数だけではなく、値を生じさせる部分式すべてに付随し、コンパイル時に決定されるべき情報である(値あるところに型がある。*2 )。それを決定しようというのが(静的)型検査であ

    Haskellのforallについて理解したことを書いておく(ランクN多相限定)。 - uehaj's blog
  • Rank-N types - HaskellWiki

    is also a Rank-1 type because it is equivalent to the previous signature. However, a forall appearing within the left-hand side of (->) cannot be moved up, and therefore forms another level or rank. The type is labeled "Rank-N" where N is the number of foralls which are nested and cannot be merged with a previous one. For example: (forall a. a -> a) -> (forall b. b -> b) is a Rank-2 type because t

  • 1