[GHC] #15622: Generalize `E{0,1,2,3,6,9,12}` from `Data.Fixed`

GHC ghc-devs at haskell.org
Mon Oct 8 20:24:27 UTC 2018


#15622: Generalize `E{0,1,2,3,6,9,12}` from `Data.Fixed`
-------------------------------------+-------------------------------------
        Reporter:  rockbmb           |                Owner:  rockbmb
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Core Libraries    |              Version:  8.4.3
      Resolution:                    |             Keywords:  base,
                                     |  Data.Fixed
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Bodigrim):

 Actually, we can generalise the current approach to any base:
 {{{#!hs
 data E (n :: Nat)

 instance KnownNat n => HasResolution (E n) where
     resolution = natVal . Compose

 type Milli = E 1000
 }}}

 ------

 With regards to the representation type: it does not make much sense to
 have `Int8` with resolution 1000. And there are only two integer types
 with arbitrary precision available in `base`. IMHO it is reasonable to
 stick to `Integer`, not least because it allows to avoid having any
 visible breaking change at all.

 ------

 > I would also like to see Data.Fixed (and possibly also Data.Ratio and
 Data.Complex) put in a new core library.

 I believe it could be desired, if there is a demand for a more rapid
 development of these modules than for the rest of `base`, but as far as I
 see this is not the case. Otherwise I do not see any direct benefits of
 such breaking change.

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


More information about the ghc-tickets mailing list