Skip to content

Commit

Permalink
v0.3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mstksg committed May 22, 2016
2 parents 9057801 + be806b9 commit 44e1de7
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 24 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/.log.log
/.stack-work
/.cabal-sandbox
/cabal.sandbox.config
/dist

21 changes: 16 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
Changelog
=========
Version 0.3.1.0
===============

<https://github.com/mstksg/uncertain/releases/tag/v0.3.1.0>

* Added support for *GHC 8.0* by providing pattern synonym type signatures in
the proper format.
* `(:+/-)` pattern synonym now exported as a "constructor" with `Uncert`
* Generalized the type signatures for `liftCX` functions to work for all `a`.
Restriction to `Fractional` now occurs only at exit points of the `CVar`
abstraction.
* Removed the redundant constraint on `Functor m` for the *MonteCarlo*
module's `liftUX` functions.

Version 0.3.0.0
---------------
===============

<https://github.com/mstksg/uncertain/releases/tag/v0.3.0.0>

* **(Breaking change)** Moved the top-level modules from `Data` to `Numeric`,
* **(Breaking change)** Moved the top-level modules from *Data* to *Numeric*,
to better reflect the nature of the library and to align with the
convention of other similar libraries.

Version 0.2.0.0
---------------
===============

<https://github.com/mstksg/uncertain/releases/tag/v0.2.0.0>

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Numeric.Uncertain
7.13 +/- 0.05
91800 +/- 100
12.5 `withVar` 0.36
'exact' 7.9512
exact 7.9512
81.42 `withPrecision` 4
7 :: Uncert Double
9.18 :: Uncert Double
Expand Down Expand Up @@ -138,7 +138,7 @@ For a clear example, take
91. +/- 7.
```

In a library like [interval], this would result in `91 +/- 10` (that is, a
In a library like [intervals][], this would result in `91 +/- 10` (that is, a
lower bound of 46 + 35 and an upper bound of 58 + 43). However, with
experimental data, errors in two independent samples tend to "cancel out", and
result in an overall aggregate uncertainty in the sum of approximately 7.
Expand Down
8 changes: 7 additions & 1 deletion src/Numeric/Uncertain.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@

module Numeric.Uncertain
( -- * 'Uncert'
#if __GLASGOW_HASKELL__ >= 810
Uncert((:+/-))
#else
Uncert
#if __GLASGOW_HASKELL__ >= 708
, pattern (:+/-)
#endif
#endif
-- ** Creating 'Uncert' values
, (+/-), exact, withPrecision, withPrecisionAtBase, withVar, fromSamples
Expand Down Expand Up @@ -205,7 +209,9 @@ withVar x vx = Un x (abs vx)
-- functionality (to allow use as a constructor) only supported on GHC
-- 7.10 and above.
--
#if __GLASGOW_HASKELL__ >= 710
#if __GLASGOW_HASKELL__ >= 800
pattern (:+/-) :: Floating a => a -> a -> Uncert a
#elif __GLASGOW_HASKELL__ >= 710
pattern (:+/-) :: () => Floating a => a -> a -> Uncert a
#endif
pattern x :+/- dx <- Un x (sqrt->dx)
Expand Down
19 changes: 7 additions & 12 deletions src/Numeric/Uncertain/Correlated/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ instance Functor (CorrF s a) where
-- y1 <- 'resolveUncert' $ sum (replicate 10 x)
-- y2 <- resolveUncert $ 10 * x
-- return (y1, y2)
-- (125 +/- 8, 125 +/- 8)
-- (125 +\/- 8, 125 +\/- 8)
--
-- ghci> 'evalCorr' $ do
-- xs <- replicateM 10 ('sampleUncert' (12.5 +/- 0.8))
Expand Down Expand Up @@ -208,7 +208,7 @@ corrToState = iterM go . corrFree
-- @
--
liftCF
:: (Functor f, Fractional a)
:: Functor f
=> (forall t. f (AD t (Sparse a)) -> AD t (Sparse a)) -- ^ Function on container of values to lift
-> f (CVar s a) -- ^ Container of 'CVar' samples to apply the function to
-> CVar s a
Expand Down Expand Up @@ -239,8 +239,7 @@ constC = CK
-- @
--
liftC
:: Fractional a
=> (forall t. AD t (Sparse a) -> AD t (Sparse a)) -- ^ Function on values to lift
:: (forall t. AD t (Sparse a) -> AD t (Sparse a)) -- ^ Function on values to lift
-> CVar s a -- ^ 'CVar' sample to apply the function to
-> CVar s a
liftC f = curryH1 $ liftCF (uncurryH1 f)
Expand All @@ -266,8 +265,7 @@ liftC f = curryH1 $ liftCF (uncurryH1 f)
-- @
--
liftC2
:: Fractional a
=> (forall t. AD t (Sparse a) -> AD t (Sparse a) -> AD t (Sparse a))
:: (forall t. AD t (Sparse a) -> AD t (Sparse a) -> AD t (Sparse a))
-> CVar s a
-> CVar s a
-> CVar s a
Expand All @@ -277,8 +275,7 @@ liftC2 f = curryH2 $ liftCF (uncurryH2 f)
-- | Lifts a three-argument (curried) function over the samples represented
-- by three 'CVar's. See 'liftC2' and 'liftCF' for more details.
liftC3
:: Fractional a
=> (forall t. AD t (Sparse a) -> AD t (Sparse a) -> AD t (Sparse a) -> AD t (Sparse a))
:: (forall t. AD t (Sparse a) -> AD t (Sparse a) -> AD t (Sparse a) -> AD t (Sparse a))
-> CVar s a
-> CVar s a
-> CVar s a
Expand All @@ -289,8 +286,7 @@ liftC3 f = curryH3 $ liftCF (uncurryH3 f)
-- | Lifts a four-argument (curried) function over the samples represented
-- by four 'CVar's. See 'liftC2' and 'liftCF' for more details.
liftC4
:: Fractional a
=> (forall t. AD t (Sparse a) -> AD t (Sparse a) -> AD t (Sparse a) -> AD t (Sparse a) -> AD t (Sparse a))
:: (forall t. AD t (Sparse a) -> AD t (Sparse a) -> AD t (Sparse a) -> AD t (Sparse a) -> AD t (Sparse a))
-> CVar s a
-> CVar s a
-> CVar s a
Expand All @@ -302,8 +298,7 @@ liftC4 f = curryH4 $ liftCF (uncurryH4 f)
-- | Lifts a five-argument (curried) function over the samples represented
-- by five 'CVar's. See 'liftC2' and 'liftCF' for more details.
liftC5
:: Fractional a
=> (forall t. AD t (Sparse a) -> AD t (Sparse a) -> AD t (Sparse a) -> AD t (Sparse a) -> AD t (Sparse a) -> AD t (Sparse a))
:: (forall t. AD t (Sparse a) -> AD t (Sparse a) -> AD t (Sparse a) -> AD t (Sparse a) -> AD t (Sparse a) -> AD t (Sparse a))
-> CVar s a
-> CVar s a
-> CVar s a
Expand Down
4 changes: 2 additions & 2 deletions src/Numeric/Uncertain/MonteCarlo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ import System.Random.MWC.Distributions
--
sampleUncert
#if __GLASGOW_HASKELL__ < 710
:: PrimMonad m
#else
:: (PrimMonad m, Functor m)
#else
:: PrimMonad m
#endif
=> Uncert Double
-> Gen (PrimState m)
Expand Down
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# resolver:
# name: custom-snapshot
# location: "./custom-snapshot.yaml"
resolver: lts-5.14
resolver: nightly-2015-05-21

# User packages to be built.
# Various formats can be used as shown in the example below.
Expand Down
2 changes: 1 addition & 1 deletion uncertain.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- documentation, see http://haskell.org/cabal/users-guide/

name: uncertain
version: 0.3.0.0
version: 0.3.1.0
synopsis: Manipulating numbers with inherent experimental/measurement uncertainty
description: See <https://github.com/mstksg/uncertain/blob/master/README.md README.md>.
.
Expand Down

0 comments on commit 44e1de7

Please sign in to comment.