haskell / haskell/statistics

Add newtype wrappers to fix scale/rate confusion

Open
#73 1 comment 0 reactions 0 assignees View on GitHub
design-shed
Dominant language
Haskell
Stars
309
Forks
76
PR merge metrics
No merged PRs in 30d

Description

We have several functions which could take either scale or rate parameter. For example exponential distribution. I can never remember which should be used. I think we shold use type system to encode which kind of parameter should be used. It's also conveninent to be able to pass either rate or scale parameter. So I propose following design:

``` .haskell
newtype Rate = Rate Double
newtype Scale = Scale Double

class RateOrScale a where
toRateParameter :: a → Double
toScaleParameter :: a → Double
```

Name of type class is hmm... not ideal.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.