module AERN2.MPBallWithGlobalPrec
(
MPBallWithGlobalPrecP, pMPBallWGPrec
, wgprmName, wgprmId, wgprmSources, wgprmRename
, wgprmQuery, (?), wgprmQueryA, wgprmListQueryA
, MPBallWithGlobalPrecA, MPBallWithGlobalPrec
, newMPBallWGPrec, newMPBallWGPrecSimple
)
where
import MixedTypesNumPrelude
import Control.Arrow
import AERN2.MP
import AERN2.MP.Dyadic
import AERN2.QA.Protocol
import AERN2.Real
import AERN2.WithGlobalParam
type MPBallWithGlobalPrecP = WithGlobalParamP Precision MPBall
pMPBallWGPrec :: MPBallWithGlobalPrecP
pMPBallWGPrec = pWGParam Nothing (mpBall 0)
type MPBallWithGlobalPrecA to = WithGlobalParamA to Precision MPBall
type MPBallWithGlobalPrec = MPBallWithGlobalPrecA (->)
newMPBallWGPrec ::
(QAArrow to)
=>
String -> [AnyProtocolQA to] -> ((Maybe (QAId to), Maybe (QAId to)) -> Precision `to` MPBall) -> MPBallWithGlobalPrecA to
newMPBallWGPrec = newWGParam Nothing (mpBall 0)
newMPBallWGPrecSimple ::
(QAArrow to)
=>
((Maybe (QAId to), Maybe (QAId to)) -> Precision `to` MPBall) -> MPBallWithGlobalPrecA to
newMPBallWGPrecSimple = newMPBallWGPrec "simple" []
$(declForTypes
[[t| Integer |], [t| Int |], [t| Dyadic |], [t| Rational |], [t| CauchyReal |]]
(\ t -> [d|
instance
(QAArrow to)
=>
ConvertibleExactly $t (MPBallWithGlobalPrecA to)
where
safeConvertExactly x =
Right $ newMPBallWGPrec (show x) [] (\_src -> arr $ p2a)
where
p2a p = convertP p x
|]))