高階多相型
型と多層を同一視するのはさすがにおかしいからページ分けた
↓書いてることおかしいかも
例
hsdata HigherKinded f a
= Bare a
| Wrapped (f a)
この
HigherKinded
の
kindは
(* -> *) -> * -> *
これ、例として正しいのか ??


Proxy
型みたいなやつを高階多相型と呼ぶのか?
refhs>>> import Data.Proxy
>>> :kind Proxy
Proxy :: k -> * // kindが多相になっている
>>> :type Proxy :: Proxy (Monoid Bool)
Proxy :: Proxy (Monoid Bool) :: Proxy (Monoid Bool)
>>> :type Proxy :: Proxy Monoid
Proxy :: Proxy Monoid :: Proxy Monoid
Proxy :: k -> *
のようにkindが多相になっているので、
k
には具体型
*
も、
型制約種 Constraint
も型引数に取ることができる
kindが多相なときは、必ず高階型の話になるのか

たぶん
多相な関数型必ず引数を取るような感じ
例えば、
f :: a
に合うような関数って定義できないよね
#??コレと同じ話で、kindが多層的な型って存在しないよね
だから k -> *
みたいに必ず1つ以上の型引数をとる型の話になるので、自動的に高階型になる
だから「多相型な高階型」と言わずとも、「多相型」といえば自動的に高階型と言ってるようなことになるはず
でもわかりやすさのためにこう書くのはありだと思う