たとえば、Idris の関数で型を返すことができます。
t : Type -> Type -> Type
t a b = a -> b
->
しかし、タイプのリストを折り畳むために使用したい状況が発生しました(いくつかのパーサーを作成して実験したとき) 、つまり
typeFold : List Type -> Type
typeFold = foldr1 (->)
だからそれtypeFold [String, Int]
は与えるだろうString -> Int : Type
. ただし、これはコンパイルされません。
error: no implicit arguments allowed
here, expected: ")",
dependent type signature,
expression, name
typeFold = foldr1 (->)
^
しかし、これはうまくいきます:
t : Type -> Type -> Type
t a b = a -> b
typeFold : List Type -> Type
typeFold = foldr1 t
を使用するためのより良い方法はあり->
ますか?そうでない場合は、機能要求として提起する価値がありますか?