module Graphics.Rendering.Chart.Utils(
isValidNumber,
maybeM,
) where
isValidNumber :: (RealFloat a) => a -> Bool
isValidNumber :: a -> Bool
isValidNumber a
v = Bool -> Bool
not (a -> Bool
forall a. RealFloat a => a -> Bool
isNaN a
v) Bool -> Bool -> Bool
&& Bool -> Bool
not (a -> Bool
forall a. RealFloat a => a -> Bool
isInfinite a
v)
maybeM :: (Monad m) => b -> (a -> m b) -> Maybe a -> m b
maybeM :: b -> (a -> m b) -> Maybe a -> m b
maybeM b
v = m b -> (a -> m b) -> Maybe a -> m b
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (b -> m b
forall (m :: * -> *) a. Monad m => a -> m a
return b
v)