{-# OPTIONS_GHC -fno-warn-orphans #-}
module BishBosh.Data.Integral(
stringToUnsignedDecimal
) where
import qualified Data.Char
import qualified Data.Int
import qualified Data.List
import qualified Data.Word
import qualified Text.XML.HXT.Arrow.Pickle as HXT
instance HXT.XmlPickler Data.Int.Int8 where
xpickle :: PU Int8
xpickle = PU Int8
forall a. (Read a, Show a) => PU a
HXT.xpPrim
instance HXT.XmlPickler Data.Int.Int16 where
xpickle :: PU Int16
xpickle = PU Int16
forall a. (Read a, Show a) => PU a
HXT.xpPrim
instance HXT.XmlPickler Data.Int.Int32 where
xpickle :: PU Int32
xpickle = PU Int32
forall a. (Read a, Show a) => PU a
HXT.xpPrim
instance HXT.XmlPickler Data.Word.Word8 where
xpickle :: PU Word8
xpickle = PU Word8
forall a. (Read a, Show a) => PU a
HXT.xpPrim
instance HXT.XmlPickler Data.Word.Word16 where
xpickle :: PU Word16
xpickle = PU Word16
forall a. (Read a, Show a) => PU a
HXT.xpPrim
instance HXT.XmlPickler Data.Word.Word32 where
xpickle :: PU Word32
xpickle = PU Word32
forall a. (Read a, Show a) => PU a
HXT.xpPrim
instance HXT.XmlPickler Data.Word.Word where
xpickle :: PU Word
xpickle = PU Word
forall a. (Read a, Show a) => PU a
HXT.xpPrim
stringToUnsignedDecimal :: Num i => String -> i
stringToUnsignedDecimal :: String -> i
stringToUnsignedDecimal = Int -> i
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> i) -> (String -> Int) -> String -> i
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> Char -> Int) -> Int -> String -> Int
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
Data.List.foldl' (\Int
i -> (Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
10 Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
i) (Int -> Int) -> (Char -> Int) -> Char -> Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Int
Data.Char.digitToInt) Int
0