Copyright | (c) Michal Konecny |
---|---|
License | BSD3 |
Maintainer | mikkonecny@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- type CanAdd t1 t2 = (CanAddAsymmetric t1 t2, CanAddAsymmetric t2 t1, AddType t1 t2 ~ AddType t2 t1)
- class CanAddAsymmetric t1 t2 where
- type CanAddThis t1 t2 = (CanAdd t1 t2, AddType t1 t2 ~ t1)
- type CanAddSameType t = CanAddThis t t
- (+) :: CanAddAsymmetric t1 t2 => t1 -> t2 -> AddType t1 t2
- sum :: (CanAddSameType t, ConvertibleExactly Integer t) => [t] -> t
- specCanAdd :: _ => T t1 -> T t2 -> T t3 -> Spec
- specCanAddNotMixed :: _ => T t -> Spec
- specCanAddSameType :: (ConvertibleExactly Integer t, Show t, HasEqCertainly t t, CanAddSameType t) => T t -> Spec
- class CanSub t1 t2 where
- type CanSubThis t1 t2 = (CanSub t1 t2, SubType t1 t2 ~ t1)
- type CanSubSameType t = CanSubThis t t
- (-) :: CanSub t1 t2 => t1 -> t2 -> SubType t1 t2
- specCanSub :: _ => T t1 -> T t2 -> Spec
- specCanSubNotMixed :: _ => T t -> Spec
Addition
type CanAdd t1 t2 = (CanAddAsymmetric t1 t2, CanAddAsymmetric t2 t1, AddType t1 t2 ~ AddType t2 t1) Source #
class CanAddAsymmetric t1 t2 where Source #
A replacement for Prelude's +
. If t1 = t2
and Num t1
,
then one can use the default implementation to mirror Prelude's +
.
Nothing
Instances
type CanAddThis t1 t2 = (CanAdd t1 t2, AddType t1 t2 ~ t1) Source #
type CanAddSameType t = CanAddThis t t Source #
(+) :: CanAddAsymmetric t1 t2 => t1 -> t2 -> AddType t1 t2 infixl 6 Source #
sum :: (CanAddSameType t, ConvertibleExactly Integer t) => [t] -> t Source #
Tests
specCanAdd :: _ => T t1 -> T t2 -> T t3 -> Spec Source #
HSpec properties that each implementation of CanAdd should satisfy.
specCanAddNotMixed :: _ => T t -> Spec Source #
HSpec properties that each implementation of CanAdd should satisfy.
specCanAddSameType :: (ConvertibleExactly Integer t, Show t, HasEqCertainly t t, CanAddSameType t) => T t -> Spec Source #
HSpec properties that each implementation of CanAddSameType should satisfy.
Subtraction
class CanSub t1 t2 where Source #
A replacement for Prelude's binary -
.
If CanNeg t2
and CanAdd t1 (NegType t2)
,
then one can use the default implementation
via a-b = a + (-b)
.
Nothing
Instances
type CanSubThis t1 t2 = (CanSub t1 t2, SubType t1 t2 ~ t1) Source #
type CanSubSameType t = CanSubThis t t Source #
Tests
specCanSub :: _ => T t1 -> T t2 -> Spec Source #
HSpec properties that each implementation of CanSub should satisfy.
specCanSubNotMixed :: _ => T t -> Spec Source #
HSpec properties that each implementation of CanSub should satisfy.