commit cb8458062aa5b3d5676d04bde299521b6bf11c38
parent f16cb0ad01080b16182c6b22ec728d140619a38e
Author: Jared Tobin <jared@jtobin.ca>
Date: Fri, 10 Apr 2015 18:58:16 +1200
Add smart constructors.
Diffstat:
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/Data/Sampling/Types.hs b/Data/Sampling/Types.hs
@@ -19,6 +19,18 @@ data Parameter =
| DiscreteVector [Int]
deriving (Eq, Show)
+discrete :: Int -> Parameter
+discrete = Discrete
+
+continuous :: Double -> Parameter
+continuous = Continuous
+
+continuousVector :: [Double] -> Parameter
+continuousVector = ContinuousVector
+
+discreteVector :: [Int] -> Parameter
+discreteVector = DiscreteVector
+
instance Num Parameter where
(Continuous a) + (Continuous b) = Continuous (a + b)
(Discrete a) + (Discrete b) = Discrete (a + b)
diff --git a/mcmc-types.cabal b/mcmc-types.cabal
@@ -1,5 +1,5 @@
name: mcmc-types
-version: 0.1.0.0
+version: 0.1.0.1
synopsis: Common types for sampling.
description: Common types for sampling.
homepage: http://github.com/jtobin/mcmc-types