[GHC] #15078: base: Customary type class laws (e.g. for Eq) and non-abiding instances (e.g. Float) should be documented

GHC ghc-devs at haskell.org
Mon Jun 18 15:11:46 UTC 2018


#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)
>
> * the Arrow classes
> * Document non-abiding instances for the types from `Data.Word` and
> `Data.Int`.

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)

 * Document non-abiding instances for the types from `Data.Word` and
 `Data.Int`.

--

Comment (by Azel):

 Ah yes my bad: I was looking at the wrong version of base's documentation.
 I'll remove it from the TODO list.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15078#comment:19>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list