-- Ordのインスタンスも自動導出が出来る -- 2つの値が同じ値コンストラクタで出来ている場合、フィールドがなければ -- 2つは等しいとされる。フィールドがあれば、フィールド同士が比較され、 -- どっちが大きいか決まる(そのときフィールドの型もOrdに属している必要はある) -- Prelude> True `compare` False -- GT -- Prelude> True > False -- True -- Prelude> True < False -- False -- 2つの値が同じ値コンストラクタで出来ている場合、フィールドが -- なければ2つは等しいとされる。フィールドがあればフィールド同士が -- 比較され、どちらが大きいか決まる。 -- Maybe a データ型では、Nothing値コンストラクタがJust値コンストラクタの -- 前に定義されているので、Nothing値は常にJust somethingより小さい。 -- Prelude> True `compare` False -- GT -- Prelude> True > False -- True -- Prelude> True < False -- False -- Prelude> Nothing < Just 100 -- True -- Prelude> Nothing > Just (-49999) -- False -- Prelude> Just 3 `compare` Just 2 -- GT -- Prelude> Just 100 > Just 50 -- True