FlexibleInstances
from GHC拡張
FlexibleContextsのinstance宣言バージョン
インスタンス宣言において,型引数を複数持つ型クラス制約を書けるようにする
この説明は雑すぎ
↓たぶん間違ってる
型引数を持つ型クラスのインスタンスを作るときに特定の型を指定できる
code:with.hs
class Hoge a where
hoge :: a -> a
instance Hoge (Maybe Int) where
hoge _ = Nothing
普通は↓こうとしか書けない
code:without.hs
instance CHoge (Maybe a) where
hoge _ = Nothing
関連
UndecidableInstances
https://haskell.jp/blog/posts/2018/about-ghc-exts-1.html
よくわからん
https://connectionrequired.com/blog/2009/07/my-first-introduction-to-haskell-extensions-flexibleinstances
https://qiita.com/YoshikuniJujo/items/33ce63d115378da66417#flexibleinstances拡張