{-# LANGUAGE CPP #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE DeriveDataTypeable #-}
module Text.JSON.Canonical.Types
( JSValue(..)
, Int54(..)
, JSString
, toJSString
, fromJSString
) where
import Control.Arrow (first)
import Control.DeepSeq (NFData(..))
import Data.Bits (Bits)
#if MIN_VERSION_base(4,7,0)
import Data.Bits (FiniteBits)
#endif
import Data.Data (Data)
import Data.Int (Int64)
import Data.Ix (Ix)
#if !MIN_VERSION_base(4,8,0)
import Data.Monoid (Monoid)
#endif
#if (MIN_VERSION_base(4,9,0) && !MIN_VERSION_base(4,13,0))
import Data.Semigroup (Semigroup)
#endif
import Data.Typeable (Typeable)
import Foreign.Storable (Storable)
#if MIN_VERSION_base(4,7,0)
import Text.Printf (PrintfArg(..))
import qualified Text.Printf as Printf
#else
import Text.Printf (PrintfArg)
#endif
import Data.String (IsString)
import Data.ByteString.Short (ShortByteString)
import qualified Data.ByteString.Short as BS
data JSValue
= JSNull
| JSBool !Bool
| JSNum !Int54
| JSString !JSString
| JSArray [JSValue]
| JSObject [(JSString, JSValue)]
deriving (Int -> JSValue -> ShowS
[JSValue] -> ShowS
JSValue -> String
(Int -> JSValue -> ShowS)
-> (JSValue -> String) -> ([JSValue] -> ShowS) -> Show JSValue
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JSValue] -> ShowS
$cshowList :: [JSValue] -> ShowS
show :: JSValue -> String
$cshow :: JSValue -> String
showsPrec :: Int -> JSValue -> ShowS
$cshowsPrec :: Int -> JSValue -> ShowS
Show, ReadPrec [JSValue]
ReadPrec JSValue
Int -> ReadS JSValue
ReadS [JSValue]
(Int -> ReadS JSValue)
-> ReadS [JSValue]
-> ReadPrec JSValue
-> ReadPrec [JSValue]
-> Read JSValue
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JSValue]
$creadListPrec :: ReadPrec [JSValue]
readPrec :: ReadPrec JSValue
$creadPrec :: ReadPrec JSValue
readList :: ReadS [JSValue]
$creadList :: ReadS [JSValue]
readsPrec :: Int -> ReadS JSValue
$creadsPrec :: Int -> ReadS JSValue
Read, JSValue -> JSValue -> Bool
(JSValue -> JSValue -> Bool)
-> (JSValue -> JSValue -> Bool) -> Eq JSValue
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JSValue -> JSValue -> Bool
$c/= :: JSValue -> JSValue -> Bool
== :: JSValue -> JSValue -> Bool
$c== :: JSValue -> JSValue -> Bool
Eq, Eq JSValue
Eq JSValue
-> (JSValue -> JSValue -> Ordering)
-> (JSValue -> JSValue -> Bool)
-> (JSValue -> JSValue -> Bool)
-> (JSValue -> JSValue -> Bool)
-> (JSValue -> JSValue -> Bool)
-> (JSValue -> JSValue -> JSValue)
-> (JSValue -> JSValue -> JSValue)
-> Ord JSValue
JSValue -> JSValue -> Bool
JSValue -> JSValue -> Ordering
JSValue -> JSValue -> JSValue
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: JSValue -> JSValue -> JSValue
$cmin :: JSValue -> JSValue -> JSValue
max :: JSValue -> JSValue -> JSValue
$cmax :: JSValue -> JSValue -> JSValue
>= :: JSValue -> JSValue -> Bool
$c>= :: JSValue -> JSValue -> Bool
> :: JSValue -> JSValue -> Bool
$c> :: JSValue -> JSValue -> Bool
<= :: JSValue -> JSValue -> Bool
$c<= :: JSValue -> JSValue -> Bool
< :: JSValue -> JSValue -> Bool
$c< :: JSValue -> JSValue -> Bool
compare :: JSValue -> JSValue -> Ordering
$ccompare :: JSValue -> JSValue -> Ordering
$cp1Ord :: Eq JSValue
Ord)
instance NFData JSValue where
rnf :: JSValue -> ()
rnf JSValue
JSNull = ()
rnf JSBool{} = ()
rnf JSNum{} = ()
rnf JSString{} = ()
rnf (JSArray [JSValue]
vs) = [JSValue] -> ()
forall a. NFData a => a -> ()
rnf [JSValue]
vs
rnf (JSObject [(JSString, JSValue)]
vs) = [(JSString, JSValue)] -> ()
forall a. NFData a => a -> ()
rnf [(JSString, JSValue)]
vs
newtype JSString = JStr ShortByteString
deriving (JSString -> JSString -> Bool
(JSString -> JSString -> Bool)
-> (JSString -> JSString -> Bool) -> Eq JSString
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JSString -> JSString -> Bool
$c/= :: JSString -> JSString -> Bool
== :: JSString -> JSString -> Bool
$c== :: JSString -> JSString -> Bool
Eq, Eq JSString
Eq JSString
-> (JSString -> JSString -> Ordering)
-> (JSString -> JSString -> Bool)
-> (JSString -> JSString -> Bool)
-> (JSString -> JSString -> Bool)
-> (JSString -> JSString -> Bool)
-> (JSString -> JSString -> JSString)
-> (JSString -> JSString -> JSString)
-> Ord JSString
JSString -> JSString -> Bool
JSString -> JSString -> Ordering
JSString -> JSString -> JSString
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: JSString -> JSString -> JSString
$cmin :: JSString -> JSString -> JSString
max :: JSString -> JSString -> JSString
$cmax :: JSString -> JSString -> JSString
>= :: JSString -> JSString -> Bool
$c>= :: JSString -> JSString -> Bool
> :: JSString -> JSString -> Bool
$c> :: JSString -> JSString -> Bool
<= :: JSString -> JSString -> Bool
$c<= :: JSString -> JSString -> Bool
< :: JSString -> JSString -> Bool
$c< :: JSString -> JSString -> Bool
compare :: JSString -> JSString -> Ordering
$ccompare :: JSString -> JSString -> Ordering
$cp1Ord :: Eq JSString
Ord, String -> JSString
(String -> JSString) -> IsString JSString
forall a. (String -> a) -> IsString a
fromString :: String -> JSString
$cfromString :: String -> JSString
IsString,
#if MIN_VERSION_base(4,9,0)
b -> JSString -> JSString
NonEmpty JSString -> JSString
JSString -> JSString -> JSString
(JSString -> JSString -> JSString)
-> (NonEmpty JSString -> JSString)
-> (forall b. Integral b => b -> JSString -> JSString)
-> Semigroup JSString
forall b. Integral b => b -> JSString -> JSString
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
stimes :: b -> JSString -> JSString
$cstimes :: forall b. Integral b => b -> JSString -> JSString
sconcat :: NonEmpty JSString -> JSString
$csconcat :: NonEmpty JSString -> JSString
<> :: JSString -> JSString -> JSString
$c<> :: JSString -> JSString -> JSString
Semigroup,
#endif
Semigroup JSString
JSString
Semigroup JSString
-> JSString
-> (JSString -> JSString -> JSString)
-> ([JSString] -> JSString)
-> Monoid JSString
[JSString] -> JSString
JSString -> JSString -> JSString
forall a.
Semigroup a -> a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
mconcat :: [JSString] -> JSString
$cmconcat :: [JSString] -> JSString
mappend :: JSString -> JSString -> JSString
$cmappend :: JSString -> JSString -> JSString
mempty :: JSString
$cmempty :: JSString
$cp1Monoid :: Semigroup JSString
Monoid)
instance NFData JSString where
rnf :: JSString -> ()
rnf JStr{} = ()
instance Show JSString where
showsPrec :: Int -> JSString -> ShowS
showsPrec Int
n (JStr ShortByteString
bs) = Int -> ShortByteString -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec Int
n ShortByteString
bs
instance Read JSString where
readsPrec :: Int -> ReadS JSString
readsPrec Int
p = ((ShortByteString, String) -> (JSString, String))
-> [(ShortByteString, String)] -> [(JSString, String)]
forall a b. (a -> b) -> [a] -> [b]
map ((ShortByteString -> JSString)
-> (ShortByteString, String) -> (JSString, String)
forall (a :: * -> * -> *) b c d.
Arrow a =>
a b c -> a (b, d) (c, d)
first ShortByteString -> JSString
JStr) ([(ShortByteString, String)] -> [(JSString, String)])
-> (String -> [(ShortByteString, String)]) -> ReadS JSString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> String -> [(ShortByteString, String)]
forall a. Read a => Int -> ReadS a
readsPrec Int
p
#if MIN_VERSION_base(4,7,0)
instance PrintfArg JSString where
formatArg :: JSString -> FieldFormatter
formatArg = String -> FieldFormatter
forall a. IsChar a => [a] -> FieldFormatter
Printf.formatString (String -> FieldFormatter)
-> (JSString -> String) -> JSString -> FieldFormatter
forall b c a. (b -> c) -> (a -> b) -> a -> c
. JSString -> String
fromJSString
#endif
toJSString :: String -> JSString
toJSString :: String -> JSString
toJSString String
str
| (Char -> Bool) -> String -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all (Char -> Char -> Bool
forall a. Ord a => a -> a -> Bool
<= Char
'\255') String
str = ShortByteString -> JSString
JStr (ShortByteString -> JSString)
-> (String -> ShortByteString) -> String -> JSString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Word8] -> ShortByteString
BS.pack ([Word8] -> ShortByteString)
-> (String -> [Word8]) -> String -> ShortByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Word8) -> String -> [Word8]
forall a b. (a -> b) -> [a] -> [b]
map (Int -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word8) -> (Char -> Int) -> Char -> Word8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Int
forall a. Enum a => a -> Int
fromEnum) (String -> JSString) -> String -> JSString
forall a b. (a -> b) -> a -> b
$ String
str
| Bool
otherwise = String -> JSString
forall a. HasCallStack => String -> a
error String
"toJSString: cannot use non-ASCII chars"
fromJSString :: JSString -> String
fromJSString :: JSString -> String
fromJSString = (Word8 -> Char) -> [Word8] -> String
forall a b. (a -> b) -> [a] -> [b]
map (Int -> Char
forall a. Enum a => Int -> a
toEnum (Int -> Char) -> (Word8 -> Int) -> Word8 -> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word8 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) ([Word8] -> String) -> (JSString -> [Word8]) -> JSString -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShortByteString -> [Word8]
BS.unpack (ShortByteString -> [Word8])
-> (JSString -> ShortByteString) -> JSString -> [Word8]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (\(JStr ShortByteString
bs) -> ShortByteString
bs)
newtype Int54 = Int54 { Int54 -> Int64
int54ToInt64 :: Int64 }
deriving ( Int -> Int54
Int54 -> Int
Int54 -> [Int54]
Int54 -> Int54
Int54 -> Int54 -> [Int54]
Int54 -> Int54 -> Int54 -> [Int54]
(Int54 -> Int54)
-> (Int54 -> Int54)
-> (Int -> Int54)
-> (Int54 -> Int)
-> (Int54 -> [Int54])
-> (Int54 -> Int54 -> [Int54])
-> (Int54 -> Int54 -> [Int54])
-> (Int54 -> Int54 -> Int54 -> [Int54])
-> Enum Int54
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: Int54 -> Int54 -> Int54 -> [Int54]
$cenumFromThenTo :: Int54 -> Int54 -> Int54 -> [Int54]
enumFromTo :: Int54 -> Int54 -> [Int54]
$cenumFromTo :: Int54 -> Int54 -> [Int54]
enumFromThen :: Int54 -> Int54 -> [Int54]
$cenumFromThen :: Int54 -> Int54 -> [Int54]
enumFrom :: Int54 -> [Int54]
$cenumFrom :: Int54 -> [Int54]
fromEnum :: Int54 -> Int
$cfromEnum :: Int54 -> Int
toEnum :: Int -> Int54
$ctoEnum :: Int -> Int54
pred :: Int54 -> Int54
$cpred :: Int54 -> Int54
succ :: Int54 -> Int54
$csucc :: Int54 -> Int54
Enum
, Int54 -> Int54 -> Bool
(Int54 -> Int54 -> Bool) -> (Int54 -> Int54 -> Bool) -> Eq Int54
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Int54 -> Int54 -> Bool
$c/= :: Int54 -> Int54 -> Bool
== :: Int54 -> Int54 -> Bool
$c== :: Int54 -> Int54 -> Bool
Eq
, Enum Int54
Real Int54
Real Int54
-> Enum Int54
-> (Int54 -> Int54 -> Int54)
-> (Int54 -> Int54 -> Int54)
-> (Int54 -> Int54 -> Int54)
-> (Int54 -> Int54 -> Int54)
-> (Int54 -> Int54 -> (Int54, Int54))
-> (Int54 -> Int54 -> (Int54, Int54))
-> (Int54 -> Integer)
-> Integral Int54
Int54 -> Integer
Int54 -> Int54 -> (Int54, Int54)
Int54 -> Int54 -> Int54
forall a.
Real a
-> Enum a
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> (a, a))
-> (a -> a -> (a, a))
-> (a -> Integer)
-> Integral a
toInteger :: Int54 -> Integer
$ctoInteger :: Int54 -> Integer
divMod :: Int54 -> Int54 -> (Int54, Int54)
$cdivMod :: Int54 -> Int54 -> (Int54, Int54)
quotRem :: Int54 -> Int54 -> (Int54, Int54)
$cquotRem :: Int54 -> Int54 -> (Int54, Int54)
mod :: Int54 -> Int54 -> Int54
$cmod :: Int54 -> Int54 -> Int54
div :: Int54 -> Int54 -> Int54
$cdiv :: Int54 -> Int54 -> Int54
rem :: Int54 -> Int54 -> Int54
$crem :: Int54 -> Int54 -> Int54
quot :: Int54 -> Int54 -> Int54
$cquot :: Int54 -> Int54 -> Int54
$cp2Integral :: Enum Int54
$cp1Integral :: Real Int54
Integral
, Typeable Int54
DataType
Constr
Typeable Int54
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Int54 -> c Int54)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Int54)
-> (Int54 -> Constr)
-> (Int54 -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Int54))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Int54))
-> ((forall b. Data b => b -> b) -> Int54 -> Int54)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Int54 -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Int54 -> r)
-> (forall u. (forall d. Data d => d -> u) -> Int54 -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Int54 -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Int54 -> m Int54)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Int54 -> m Int54)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Int54 -> m Int54)
-> Data Int54
Int54 -> DataType
Int54 -> Constr
(forall b. Data b => b -> b) -> Int54 -> Int54
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Int54 -> c Int54
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Int54
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Int54 -> u
forall u. (forall d. Data d => d -> u) -> Int54 -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Int54 -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Int54 -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Int54 -> m Int54
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Int54 -> m Int54
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Int54
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Int54 -> c Int54
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Int54)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Int54)
$cInt54 :: Constr
$tInt54 :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Int54 -> m Int54
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Int54 -> m Int54
gmapMp :: (forall d. Data d => d -> m d) -> Int54 -> m Int54
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Int54 -> m Int54
gmapM :: (forall d. Data d => d -> m d) -> Int54 -> m Int54
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Int54 -> m Int54
gmapQi :: Int -> (forall d. Data d => d -> u) -> Int54 -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Int54 -> u
gmapQ :: (forall d. Data d => d -> u) -> Int54 -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Int54 -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Int54 -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Int54 -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Int54 -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Int54 -> r
gmapT :: (forall b. Data b => b -> b) -> Int54 -> Int54
$cgmapT :: (forall b. Data b => b -> b) -> Int54 -> Int54
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Int54)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Int54)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Int54)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Int54)
dataTypeOf :: Int54 -> DataType
$cdataTypeOf :: Int54 -> DataType
toConstr :: Int54 -> Constr
$ctoConstr :: Int54 -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Int54
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Int54
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Int54 -> c Int54
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Int54 -> c Int54
$cp1Data :: Typeable Int54
Data
, Integer -> Int54
Int54 -> Int54
Int54 -> Int54 -> Int54
(Int54 -> Int54 -> Int54)
-> (Int54 -> Int54 -> Int54)
-> (Int54 -> Int54 -> Int54)
-> (Int54 -> Int54)
-> (Int54 -> Int54)
-> (Int54 -> Int54)
-> (Integer -> Int54)
-> Num Int54
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
fromInteger :: Integer -> Int54
$cfromInteger :: Integer -> Int54
signum :: Int54 -> Int54
$csignum :: Int54 -> Int54
abs :: Int54 -> Int54
$cabs :: Int54 -> Int54
negate :: Int54 -> Int54
$cnegate :: Int54 -> Int54
* :: Int54 -> Int54 -> Int54
$c* :: Int54 -> Int54 -> Int54
- :: Int54 -> Int54 -> Int54
$c- :: Int54 -> Int54 -> Int54
+ :: Int54 -> Int54 -> Int54
$c+ :: Int54 -> Int54 -> Int54
Num
, Eq Int54
Eq Int54
-> (Int54 -> Int54 -> Ordering)
-> (Int54 -> Int54 -> Bool)
-> (Int54 -> Int54 -> Bool)
-> (Int54 -> Int54 -> Bool)
-> (Int54 -> Int54 -> Bool)
-> (Int54 -> Int54 -> Int54)
-> (Int54 -> Int54 -> Int54)
-> Ord Int54
Int54 -> Int54 -> Bool
Int54 -> Int54 -> Ordering
Int54 -> Int54 -> Int54
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Int54 -> Int54 -> Int54
$cmin :: Int54 -> Int54 -> Int54
max :: Int54 -> Int54 -> Int54
$cmax :: Int54 -> Int54 -> Int54
>= :: Int54 -> Int54 -> Bool
$c>= :: Int54 -> Int54 -> Bool
> :: Int54 -> Int54 -> Bool
$c> :: Int54 -> Int54 -> Bool
<= :: Int54 -> Int54 -> Bool
$c<= :: Int54 -> Int54 -> Bool
< :: Int54 -> Int54 -> Bool
$c< :: Int54 -> Int54 -> Bool
compare :: Int54 -> Int54 -> Ordering
$ccompare :: Int54 -> Int54 -> Ordering
$cp1Ord :: Eq Int54
Ord
, Num Int54
Ord Int54
Num Int54 -> Ord Int54 -> (Int54 -> Rational) -> Real Int54
Int54 -> Rational
forall a. Num a -> Ord a -> (a -> Rational) -> Real a
toRational :: Int54 -> Rational
$ctoRational :: Int54 -> Rational
$cp2Real :: Ord Int54
$cp1Real :: Num Int54
Real
, Ord Int54
Ord Int54
-> ((Int54, Int54) -> [Int54])
-> ((Int54, Int54) -> Int54 -> Int)
-> ((Int54, Int54) -> Int54 -> Int)
-> ((Int54, Int54) -> Int54 -> Bool)
-> ((Int54, Int54) -> Int)
-> ((Int54, Int54) -> Int)
-> Ix Int54
(Int54, Int54) -> Int
(Int54, Int54) -> [Int54]
(Int54, Int54) -> Int54 -> Bool
(Int54, Int54) -> Int54 -> Int
forall a.
Ord a
-> ((a, a) -> [a])
-> ((a, a) -> a -> Int)
-> ((a, a) -> a -> Int)
-> ((a, a) -> a -> Bool)
-> ((a, a) -> Int)
-> ((a, a) -> Int)
-> Ix a
unsafeRangeSize :: (Int54, Int54) -> Int
$cunsafeRangeSize :: (Int54, Int54) -> Int
rangeSize :: (Int54, Int54) -> Int
$crangeSize :: (Int54, Int54) -> Int
inRange :: (Int54, Int54) -> Int54 -> Bool
$cinRange :: (Int54, Int54) -> Int54 -> Bool
unsafeIndex :: (Int54, Int54) -> Int54 -> Int
$cunsafeIndex :: (Int54, Int54) -> Int54 -> Int
index :: (Int54, Int54) -> Int54 -> Int
$cindex :: (Int54, Int54) -> Int54 -> Int
range :: (Int54, Int54) -> [Int54]
$crange :: (Int54, Int54) -> [Int54]
$cp1Ix :: Ord Int54
Ix
#if MIN_VERSION_base(4,7,0)
, Bits Int54
Bits Int54
-> (Int54 -> Int)
-> (Int54 -> Int)
-> (Int54 -> Int)
-> FiniteBits Int54
Int54 -> Int
forall b.
Bits b -> (b -> Int) -> (b -> Int) -> (b -> Int) -> FiniteBits b
countTrailingZeros :: Int54 -> Int
$ccountTrailingZeros :: Int54 -> Int
countLeadingZeros :: Int54 -> Int
$ccountLeadingZeros :: Int54 -> Int
finiteBitSize :: Int54 -> Int
$cfiniteBitSize :: Int54 -> Int
$cp1FiniteBits :: Bits Int54
FiniteBits
#endif
, Eq Int54
Int54
Eq Int54
-> (Int54 -> Int54 -> Int54)
-> (Int54 -> Int54 -> Int54)
-> (Int54 -> Int54 -> Int54)
-> (Int54 -> Int54)
-> (Int54 -> Int -> Int54)
-> (Int54 -> Int -> Int54)
-> Int54
-> (Int -> Int54)
-> (Int54 -> Int -> Int54)
-> (Int54 -> Int -> Int54)
-> (Int54 -> Int -> Int54)
-> (Int54 -> Int -> Bool)
-> (Int54 -> Maybe Int)
-> (Int54 -> Int)
-> (Int54 -> Bool)
-> (Int54 -> Int -> Int54)
-> (Int54 -> Int -> Int54)
-> (Int54 -> Int -> Int54)
-> (Int54 -> Int -> Int54)
-> (Int54 -> Int -> Int54)
-> (Int54 -> Int -> Int54)
-> (Int54 -> Int)
-> Bits Int54
Int -> Int54
Int54 -> Bool
Int54 -> Int
Int54 -> Maybe Int
Int54 -> Int54
Int54 -> Int -> Bool
Int54 -> Int -> Int54
Int54 -> Int54 -> Int54
forall a.
Eq a
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> a
-> (Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> Bool)
-> (a -> Maybe Int)
-> (a -> Int)
-> (a -> Bool)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int)
-> Bits a
popCount :: Int54 -> Int
$cpopCount :: Int54 -> Int
rotateR :: Int54 -> Int -> Int54
$crotateR :: Int54 -> Int -> Int54
rotateL :: Int54 -> Int -> Int54
$crotateL :: Int54 -> Int -> Int54
unsafeShiftR :: Int54 -> Int -> Int54
$cunsafeShiftR :: Int54 -> Int -> Int54
shiftR :: Int54 -> Int -> Int54
$cshiftR :: Int54 -> Int -> Int54
unsafeShiftL :: Int54 -> Int -> Int54
$cunsafeShiftL :: Int54 -> Int -> Int54
shiftL :: Int54 -> Int -> Int54
$cshiftL :: Int54 -> Int -> Int54
isSigned :: Int54 -> Bool
$cisSigned :: Int54 -> Bool
bitSize :: Int54 -> Int
$cbitSize :: Int54 -> Int
bitSizeMaybe :: Int54 -> Maybe Int
$cbitSizeMaybe :: Int54 -> Maybe Int
testBit :: Int54 -> Int -> Bool
$ctestBit :: Int54 -> Int -> Bool
complementBit :: Int54 -> Int -> Int54
$ccomplementBit :: Int54 -> Int -> Int54
clearBit :: Int54 -> Int -> Int54
$cclearBit :: Int54 -> Int -> Int54
setBit :: Int54 -> Int -> Int54
$csetBit :: Int54 -> Int -> Int54
bit :: Int -> Int54
$cbit :: Int -> Int54
zeroBits :: Int54
$czeroBits :: Int54
rotate :: Int54 -> Int -> Int54
$crotate :: Int54 -> Int -> Int54
shift :: Int54 -> Int -> Int54
$cshift :: Int54 -> Int -> Int54
complement :: Int54 -> Int54
$ccomplement :: Int54 -> Int54
xor :: Int54 -> Int54 -> Int54
$cxor :: Int54 -> Int54 -> Int54
.|. :: Int54 -> Int54 -> Int54
$c.|. :: Int54 -> Int54 -> Int54
.&. :: Int54 -> Int54 -> Int54
$c.&. :: Int54 -> Int54 -> Int54
$cp1Bits :: Eq Int54
Bits
, Ptr b -> Int -> IO Int54
Ptr b -> Int -> Int54 -> IO ()
Ptr Int54 -> IO Int54
Ptr Int54 -> Int -> IO Int54
Ptr Int54 -> Int -> Int54 -> IO ()
Ptr Int54 -> Int54 -> IO ()
Int54 -> Int
(Int54 -> Int)
-> (Int54 -> Int)
-> (Ptr Int54 -> Int -> IO Int54)
-> (Ptr Int54 -> Int -> Int54 -> IO ())
-> (forall b. Ptr b -> Int -> IO Int54)
-> (forall b. Ptr b -> Int -> Int54 -> IO ())
-> (Ptr Int54 -> IO Int54)
-> (Ptr Int54 -> Int54 -> IO ())
-> Storable Int54
forall b. Ptr b -> Int -> IO Int54
forall b. Ptr b -> Int -> Int54 -> IO ()
forall a.
(a -> Int)
-> (a -> Int)
-> (Ptr a -> Int -> IO a)
-> (Ptr a -> Int -> a -> IO ())
-> (forall b. Ptr b -> Int -> IO a)
-> (forall b. Ptr b -> Int -> a -> IO ())
-> (Ptr a -> IO a)
-> (Ptr a -> a -> IO ())
-> Storable a
poke :: Ptr Int54 -> Int54 -> IO ()
$cpoke :: Ptr Int54 -> Int54 -> IO ()
peek :: Ptr Int54 -> IO Int54
$cpeek :: Ptr Int54 -> IO Int54
pokeByteOff :: Ptr b -> Int -> Int54 -> IO ()
$cpokeByteOff :: forall b. Ptr b -> Int -> Int54 -> IO ()
peekByteOff :: Ptr b -> Int -> IO Int54
$cpeekByteOff :: forall b. Ptr b -> Int -> IO Int54
pokeElemOff :: Ptr Int54 -> Int -> Int54 -> IO ()
$cpokeElemOff :: Ptr Int54 -> Int -> Int54 -> IO ()
peekElemOff :: Ptr Int54 -> Int -> IO Int54
$cpeekElemOff :: Ptr Int54 -> Int -> IO Int54
alignment :: Int54 -> Int
$calignment :: Int54 -> Int
sizeOf :: Int54 -> Int
$csizeOf :: Int54 -> Int
Storable
, Int54 -> ModifierParser
Int54 -> FieldFormatter
(Int54 -> FieldFormatter)
-> (Int54 -> ModifierParser) -> PrintfArg Int54
forall a.
(a -> FieldFormatter) -> (a -> ModifierParser) -> PrintfArg a
parseFormat :: Int54 -> ModifierParser
$cparseFormat :: Int54 -> ModifierParser
formatArg :: Int54 -> FieldFormatter
$cformatArg :: Int54 -> FieldFormatter
PrintfArg
, Typeable
)
instance Bounded Int54 where
maxBound :: Int54
maxBound = Int64 -> Int54
Int54 ( Int64
2Int64 -> Int -> Int64
forall a b. (Num a, Integral b) => a -> b -> a
^(Int
53 :: Int) Int64 -> Int64 -> Int64
forall a. Num a => a -> a -> a
- Int64
1)
minBound :: Int54
minBound = Int64 -> Int54
Int54 (-(Int64
2Int64 -> Int -> Int64
forall a b. (Num a, Integral b) => a -> b -> a
^(Int
53 :: Int) Int64 -> Int64 -> Int64
forall a. Num a => a -> a -> a
- Int64
1))
instance Show Int54 where
show :: Int54 -> String
show = Int64 -> String
forall a. Show a => a -> String
show (Int64 -> String) -> (Int54 -> Int64) -> Int54 -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int54 -> Int64
int54ToInt64
instance Read Int54 where
readsPrec :: Int -> ReadS Int54
readsPrec Int
p = ((Int64, String) -> (Int54, String))
-> [(Int64, String)] -> [(Int54, String)]
forall a b. (a -> b) -> [a] -> [b]
map ((Int64 -> Int54) -> (Int64, String) -> (Int54, String)
forall (a :: * -> * -> *) b c d.
Arrow a =>
a b c -> a (b, d) (c, d)
first Int64 -> Int54
Int54) ([(Int64, String)] -> [(Int54, String)])
-> (String -> [(Int64, String)]) -> ReadS Int54
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> String -> [(Int64, String)]
forall a. Read a => Int -> ReadS a
readsPrec Int
p