[GHC] #13097: Num a => Num (Down a)

GHC ghc-devs at haskell.org
Tue Jan 10 10:32:36 UTC 2017


#13097: Num a => Num (Down a)
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  libraries/base    |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Description changed by Iceland_jack:

@@ -26,1 +26,0 @@
-
@@ -31,0 +30,8 @@
+
+ with #12363 + #12465
+
+
+ {{{#!hs
+ >>> 10 < @Down{} 20
+ False
+ }}}

New description:

 There are many missing instances for `Down`, I happened to need `Num (Down
 _)`. It can be derived with GND:

 {{{#!hs
 newtype Down a = Down a deriving (Eq, Show, Read, Num)
 }}}

 which let's us write

 {{{#!hs
 >>> (<) 10 20
 True

 >>> (<) @(Down _) 10 20
 False
 }}}

 We can of course add instances for `Functor`, `Applicative`, `Monad`,
 `MonadFix`, ... I don't know that they would ever get but it wouldn't be
 much trouble copying `Identity`, `Dual` instances.

 ----

 With #12363

 {{{#!hs
 >>> 10 < @(Down _) 20
 False
 }}}

 with #12363 + #12465


 {{{#!hs
 >>> 10 < @Down{} 20
 False
 }}}

--

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


More information about the ghc-tickets mailing list