# 098: either.hs で context reduction [↑up](bunny_notes) - issued: 2020-06-03 - 分類: A サンプルコードが fail - status: Closed (2020-06-03) ## 概要 either.hs で context reduction エラー。 [Char] が Ord クラスのインスタンスになっていないことから型チェックにひっかかっている。 これを回避した either2.hs を作成して、これは test に加えておく (sample236.hs)。 ## 調査ログ ## 2020-06-03 lib/Prelude.hs に以下を追加して解決: $$
{
instance (Ord a) => Ord [a] where
[] <= _ = True
_ <= [] = False
(x:xs) <= (y:ys) | x == y = xs <= ys
| x < y = True
| otherwise = False
$$}
- either.hs -> sample237.hs