ANNOUNCE: dimensional-0.9

I am pleased to announce version 0.9 of my dimensional library for arithmetic with statically checked physical dimensions. The differences from version is the specification of fixity for *~~ and /~~ and their generalization to operate on functors rather than lists. The lack of fixity specifications was a bug; I had always intended them to have the same fixity as the closely related *~ and /~ (and * and / for that matter).

For readers unfamiliar with the above operators they are used to relate numerical values with units in order to construct and deconstruct physical quantities. For example:

> import Numeric.Units.Dimensional.Prelude
> import qualified Prelude
> x :: Length Double  -- type Length = Quantity DLength
> x = 1 *~ meter
> y :: Double
> y = x /~ kilo meter -- 0.001

This convention for constructing and deconstructing quantities by multiplication and division respectively is motivated by the NIST Guide to the SI, section 7.1.

The *~~ and /~~ operators are analogous to *~ and /~ but operate on functors, e.g.:

> xs :: [Length Double]
> xs = [1..] *~~ meter
> ys :: [Double]
> ys = xs /~~ kilo meter

Finally an observation for the Haskell community: the Haskell package versioning policy does not address fixity changes, which I presume should force a major version change. Unless someone either objects or beats me to it I will update the wiki to reflect this.

Flattr this


ANNOUNCE: normaldistribution-1.1 – Minimum fuss normally distributed random values.

I’m pleased to announce the immediate availability of the normaldistribution library on hackage.

This purpose of this library is to have a simple API and no dependencies beyond Haskell 98 in order to let you produce normally distributed random values with a minimum of fuss. This library does not attempt to be blazingly fast nor to pass stringent tests of randomness. It attempts to be very easy to install and use while being “good enough” for many applications (simulations, games, etc.). The API builds upon and is largely analogous to that of the Haskell 98 Random module (more recently System.Random).


> (sample,g) = normal  myRandomGen  -- using a Random.RandomGen
> samples    = normals myRandomGen  -- infinite list
> samples2   = mkNormals 10831452   -- infinite list using a seed

In the IO monad:

> sample    <- normalIO
> samples   <- normalsIO  -- infinite list

With custom mean and standard deviation:

> (sample,g) = normal'    (mean,sigma) myRandomGen
> samples    = normals'   (mean,sigma) myRandomGen
> samples2   = mkNormals' (mean,sigma) 10831452
> sample    <- normalIO'  (mean,sigma)
> samples   <- normalsIO' (mean,sigma)

Internally the library uses the Box-Muller method to generate normally distributed values from uniformly distributed random values. If more than one sample is needed taking samples off an infinite list (created by e.g. normals) will be roughly twice as efficient as repetedly generating individual samples with e.g. normal.

Update 2011–04–09: Changed to reflect version 1.1.

Update 2011–04–22: Version released which builds with haskell98-1.1+ (GHC-7.0.1+). No code changes.

Flattr this