可変長引数を作りたかったわけではないんだけど、というか何がしたかったんだかよく覚えていないんだけど、こういうのを作った。 class Test a where test :: a -> Int test = const 0 instance Test a => Test (b -> a) where test f = 1 + test (f undefined) instance Test Int Test型クラス。 > let c = undefined :: Int > test c 0 > let f = undefined :: Int -> Int > test f 1 > let g = undefined :: Int -> Int -> Int > test g 2 test関数に与えた関数の引数の数を数えられます。 ただし、与える関数の戻り値の型がTestのインスタンスに