Floating instance for Data.Fixed
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
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.10.1 |
| Type | FeatureRequest |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | libraries/base |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | ekmett, hvr |
| Operating system | |
| Architecture |