
#15078: base: Customary type class laws (e.g. for Eq) and non-abiding instances (e.g. Float) should be documented -------------------------------------+------------------------------------- Reporter: sjakobi | Owner: Azel Type: feature request | Status: merge Priority: normal | Milestone: 8.6.1 Component: Core Libraries | Version: 8.4.2 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4736 Wiki Page: | -------------------------------------+------------------------------------- Old description:
As beginning Haskellers regularly ask about these laws and instances I think it would be good to have them documented where they are defined.
=== Documented so far:
(in 793902e6891c30150fd3ac1e0e471269a4766780)
==== Classes
* `Eq` * `Floating` * `Fractional` * `Integral` * `Num` * `Ord`
==== Non-abiding instances
* `CDouble` (shares `Double`'s deficiencies) * `CFloat` (shares `Float`'s deficiencies) * `Complex a` (inherits deficiencies) * `Double`: `Eq`, `Ord`, `Fractional`, `Num` * `Float`: `Eq`, `Ord`, `Fractional`, `Num` * `Ratio a` (inherits deficiencies) * `Natural`: `Num`
=== TODO
(This is not an exhaustive list, please add more)
* `RealFrac` * the Arrow classes * `Word` & co
New description: As beginning Haskellers regularly ask about these laws and instances I think it would be good to have them documented where they are defined. === Documented so far: (in 793902e6891c30150fd3ac1e0e471269a4766780) ==== Classes * `Eq` * `Floating` * `Fractional` * `Integral` * `Num` * `Ord` ==== Non-abiding instances * `CDouble` (shares `Double`'s deficiencies) * `CFloat` (shares `Float`'s deficiencies) * `Complex a` (inherits deficiencies) * `Double`: `Eq`, `Ord`, `Fractional`, `Num` * `Float`: `Eq`, `Ord`, `Fractional`, `Num` * `Ratio a` (inherits deficiencies) * `Natural`: `Num` === TODO (This is not an exhaustive list, please add more) * the Arrow classes * Document non-abiding instances for the types from `Data.Word` and `Data.Int`. -- Comment (by sjakobi):
What structure would RealFrac represent though?
And do all instances of Monad, Functor and Applicative in base respect
Not sure if there's any fitting structure, but I guess you could say that `RealFrac`'s are already documented on the methods. I'm removing it from the TODO list. the relevant laws? I think this is question for a different ticket. I'd like to keep this ticket about classes whose laws haven't been documented so far.
* the Arrow classes
What about them? Their laws seem to be well documented. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15078#comment:16 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler