Copyright | (c) Michal Konecny |
---|---|
License | BSD3 |
Maintainer | mikkonecny@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Type wrapper setting default precision.
Not suitable for use with MixedTypesNumPrelude since we need binary operators to enforce the same precision on both operands via the equality of their types.
Borrowed some tricks from https://github.com/ekmett/rounded/blob/master/src/Numeric/Rounded/Precision.hs
Synopsis
- newtype WithCurrentPrec t p = WithCurrentPrec {
- unWithCurrentPrec :: t
- runWithPrec :: Precision -> (forall n. KnownNat n => WithCurrentPrec t n) -> t
- class HasCurrentPrecision p where
- getCurrentPrecision :: proxy p -> Precision
- newtype WithAnyPrec t = WithAnyPrec (forall p. KnownNat p => WithCurrentPrec t p)
Documentation
newtype WithCurrentPrec t p Source #
Instances
runWithPrec :: Precision -> (forall n. KnownNat n => WithCurrentPrec t n) -> t Source #
class HasCurrentPrecision p where Source #
getCurrentPrecision :: proxy p -> Precision Source #
Instances
KnownNat n => HasCurrentPrecision (n :: Nat) Source # | |
Defined in AERN2.MP.WithCurrentPrec getCurrentPrecision :: proxy n -> Precision Source # |
newtype WithAnyPrec t Source #
An existential type wrapper for convenient conversions, eg using aern2-real:
_x :: KnownNat p => WithCurrentPrec (CN MPBall) p _x = undefined _r_x :: CReal _r_x = creal $ WithAnyPrec _x
WithAnyPrec (forall p. KnownNat p => WithCurrentPrec t p) |