base-orphans 0.3.1 → 0.3.2
raw patch · 3 files changed
+16/−8 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Data.Orphans: instance (Storable a, RealFloat a) => Storable (Complex a)
+ Data.Orphans: instance Storable a => Storable (Complex a)
Files
- CHANGES.markdown +4/−0
- base-orphans.cabal +1/−1
- src/Data/Orphans.hs +11/−7
CHANGES.markdown view
@@ -1,3 +1,7 @@+## Changes in 0.3.2+ - `Storable (Complex a)` instance no longer requires a `RealFloat a`+ constraint if using `base-4.4` or later+ ## Changes in 0.3.1 - `Functor`, `Applicative`, and `Monad` instances for `First` and `Last`
base-orphans.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack name: base-orphans-version: 0.3.1+version: 0.3.2 synopsis: Backwards-compatible orphan instances for base homepage: https://github.com/haskell-compat/base-orphans#readme bug-reports: https://github.com/haskell-compat/base-orphans/issues
src/Data/Orphans.hs view
@@ -93,7 +93,7 @@ #endif #if !(MIN_VERSION_base(4,8,0))-import Data.Complex (Complex(..), realPart)+import Data.Complex (Complex(..)) import Data.Version import Foreign.Ptr (castPtr) import GHC.Real (Ratio(..), (%))@@ -1161,12 +1161,16 @@ deriving instance Applicative Last deriving instance Monad Last --- The actual constraint in base-4.8.0.0 doesn't include RealFloat a, but it--- is needed in previous versions of base due to Complex having lots of--- RealFloat constraints in its functions' type signatures.-instance (Storable a, RealFloat a) => Storable (Complex a) where- sizeOf a = 2 * sizeOf (realPart a)- alignment a = alignment (realPart a)+-- In base-4.3 and earlier, pattern matching on a Complex value invokes a+-- RealFloat constraint due to the use of the DatatypeContexts extension.+# if MIN_VERSION_base(4,4,0)+instance Storable a+# else+instance (Storable a, RealFloat a)+# endif+ => Storable (Complex a) where+ sizeOf (a :+ _) = 2 * sizeOf a+ alignment (a :+ _) = alignment a peek p = do q <- return $ castPtr p r <- peek q