exact-pi 0.4.1.3 → 0.4.1.4
raw patch · 3 files changed
+22/−19 lines, 3 filesdep ~basedep ~semigroupsPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, semigroups
API changes (from Hackage documentation)
- Data.ExactPi: instance Data.Semigroup.Semigroup Data.ExactPi.ExactPi
+ Data.ExactPi: instance GHC.Base.Semigroup Data.ExactPi.ExactPi
Files
- changelog.md +4/−0
- exact-pi.cabal +8/−13
- src/Data/ExactPi/TypeLevel.hs +10/−6
changelog.md view
@@ -1,3 +1,7 @@+0.4.1.4+-------+* Comply with NoStarIsType pragma.+ 0.4.1.3 ------- * Add Semigroup ExactPi instance.
exact-pi.cabal view
@@ -1,8 +1,5 @@--- Initial exact-pi.cabal generated by cabal init. For further --- documentation, see http://haskell.org/cabal/users-guide/- name: exact-pi-version: 0.4.1.3+version: 0.4.1.4 synopsis: Exact rational multiples of pi (and integer powers of pi) description: Provides an exact representation for rational multiples of pi alongside an approximate representation of all reals. Useful for storing and computing with conversion factors between physical units.@@ -12,27 +9,25 @@ license-file: LICENSE author: Douglas McClean maintainer: douglas.mcclean@gmail.com--- copyright: category: Data build-type: Simple extra-source-files: README.md, changelog.md cabal-version: >=1.10 tested-with: GHC == 7.8.4,- GHC == 7.10.1,- GHC == 8.0.1,+ GHC == 7.10.3, GHC == 8.0.2,- GHC == 8.2.1, GHC == 8.2.2,- GHC == 8.4.1+ GHC == 8.4.3,+ GHC == 8.6.1 library exposed-modules: Data.ExactPi, Data.ExactPi.TypeLevel- -- other-modules: - -- other-extensions: build-depends: base >=4.7 && <5,- numtype-dk >= 0.5,- semigroups >= 0.9 && < 1.0+ numtype-dk >= 0.5+ if impl(ghc <8.0)+ build-depends:+ semigroups >=0.8 ghc-options: -Wall hs-source-dirs: src default-language: Haskell2010
src/Data/ExactPi/TypeLevel.hs view
@@ -1,6 +1,7 @@ {-# OPTIONS_HADDOCK show-extensions #-} {-# LANGUAGE ConstraintKinds #-}+{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE KindSignatures #-}@@ -8,6 +9,10 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} +#if __GLASGOW_HASKELL__ > 805+{-# LANGUAGE NoStarIsType #-}+#endif+ {-| Module : Data.ExactPi.TypeLevel Description : Exact non-negative rational multiples of powers of pi at the type level@@ -16,7 +21,7 @@ Stability : experimental This kind is sufficient to exactly express the closure of Q⁺ ∪ {π} under multiplication and division.-As a result it is useful for representing conversion factors between physical units. +As a result it is useful for representing conversion factors between physical units. -} module Data.ExactPi.TypeLevel (@@ -37,7 +42,6 @@ import Data.Maybe (fromJust) import Data.Proxy import Data.Ratio-import GHC.Exts (Constraint) import GHC.TypeLits hiding (type (*), type (^)) import qualified GHC.TypeLits as N import Numeric.NumType.DK.Integers hiding (type (*), type (/))@@ -69,7 +73,7 @@ -- | Determines the minimum context required for a numeric type to hold the value -- associated with a specific 'ExactPi'' type.-type family MinCtxt' (v :: ExactPi') :: * -> Constraint where+type family MinCtxt' (v :: ExactPi') where MinCtxt' ('ExactPi' 'Zero p 1) = Num MinCtxt' ('ExactPi' 'Zero p q) = Fractional MinCtxt' ('ExactPi' z p q) = Floating@@ -78,9 +82,9 @@ -- | A KnownMinCtxt is a contraint on values sufficient to allow us to inject certain -- 'ExactPi' values into types that satisfy the constraint.-class KnownMinCtxt (c :: * -> Constraint) where+class KnownMinCtxt c where -- | Injects an 'ExactPi' value into a specified type satisfying this constraint.- -- + -- -- The injection is permitted to fail if type constraint does not entail the 'MinCtxt' -- required by the 'ExactPi'' representation of the supplied 'ExactPi' value. inj :: c a => Proxy c -- ^ A proxy for identifying the required constraint.@@ -97,7 +101,7 @@ inj _ = approximateValue -- | Converts an 'ExactPi'' type to a numeric value with the minimum required context.--- +-- -- When the value is known to be an integer, it can be returned as any instance of 'Num'. Similarly, -- rationals require 'Fractional', and values that involve 'pi' require 'Floating'. injMin :: forall v a.(MinCtxt v a) => Proxy v -> a