[GHC] #10297: Floating instance for Data.Fixed

GHC ghc-devs at haskell.org
Tue Apr 14 02:35:19 UTC 2015


#10297: Floating instance for Data.Fixed
-------------------------------------+-------------------------------------
              Reporter:  dmcclean    |             Owner:
                  Type:  feature     |            Status:  new
  request                            |         Milestone:
              Priority:  normal      |           Version:  7.10.1
             Component:              |  Operating System:  Unknown/Multiple
  libraries/base                     |   Type of failure:  None/Unknown
              Keywords:              |        Blocked By:
          Architecture:              |   Related Tickets:
  Unknown/Multiple                   |
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
 I'd like to contribute a Floating instance for Data.Fixed. I'm concerned
 that it may be undesirable for a reason that is not occurring to me; I'd
 be pleased to learn of any objections.

 In concept it's this, although I will investigate if there is an
 implementation with better performance:

 {{{
 lift :: (HasResolution a) => (Double -> Double) -> Fixed a -> Fixed a
 lift f = realToFrac . f . realToFrac

 instance (HasResolution a) => Floating (Fixed a) where
   pi = realToFrac pi
   sin = lift sin
   -- etc, similar lift2 function for (**), logBase
 }}}

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


More information about the ghc-tickets mailing list