Copyright | (c) Michal Konecny |
---|---|
License | BSD3 |
Maintainer | mikkonecny@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
AERN2.MP.WithCurrentPrec
Description
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 #
Constructors
WithCurrentPrec | |
Fields
|
Instances
runWithPrec :: Precision -> (forall n. KnownNat n => WithCurrentPrec t n) -> t Source #
class HasCurrentPrecision p where Source #
Methods
getCurrentPrecision :: proxy p -> Precision Source #
Instances
KnownNat n => HasCurrentPrecision (n :: Nat) Source # | |
Defined in AERN2.MP.WithCurrentPrec Methods 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
Constructors
WithAnyPrec (forall p. KnownNat p => WithCurrentPrec t p) |