class Foo a where

f :: (a -> a) -> a -> a

というクラスと

class Bar a where

g :: (forall b . b -> b) -> a -> a

とだと、「関数gのほうが引数に強い条件をつけている」ことから「クラスBarのほうがインスタンスにゆるい条件しか要求しない」ということになる。

class Bar a where

...

default g :: Foo a => (forall b . b -> b) -> a -> a

g = f

とはできるけど、逆はできないので確かめられる。

けど、なんか、まぎらわしいな。

Reply to this note

Please Login to reply.

Discussion

No replies yet.