module Argo.Type.Boolean where import Control.Applicative ((<|>)) import qualified Argo.Decoder as Decoder import qualified Argo.Literal as Literal import qualified Control.DeepSeq as DeepSeq import qualified Data.ByteString.Builder as Builder newtype Boolean = Boolean Bool deriving (Boolean -> Boolean -> Bool (Boolean -> Boolean -> Bool) -> (Boolean -> Boolean -> Bool) -> Eq Boolean forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: Boolean -> Boolean -> Bool $c/= :: Boolean -> Boolean -> Bool == :: Boolean -> Boolean -> Bool $c== :: Boolean -> Boolean -> Bool Eq, Int -> Boolean -> ShowS [Boolean] -> ShowS Boolean -> String (Int -> Boolean -> ShowS) -> (Boolean -> String) -> ([Boolean] -> ShowS) -> Show Boolean forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [Boolean] -> ShowS $cshowList :: [Boolean] -> ShowS show :: Boolean -> String $cshow :: Boolean -> String showsPrec :: Int -> Boolean -> ShowS $cshowsPrec :: Int -> Boolean -> ShowS Show) instance DeepSeq.NFData Boolean where rnf :: Boolean -> () rnf (Boolean Bool x) = Bool -> () forall a. NFData a => a -> () DeepSeq.rnf Bool x encode :: Boolean -> Builder.Builder encode :: Boolean -> Builder encode (Boolean Bool x) = ByteString -> Builder Builder.byteString (ByteString -> Builder) -> ByteString -> Builder forall a b. (a -> b) -> a -> b $ if Bool x then ByteString Literal.true else ByteString Literal.false decode :: Decoder.Decoder Boolean decode :: Decoder Boolean decode = Decoder Boolean decodeFalse Decoder Boolean -> Decoder Boolean -> Decoder Boolean forall (f :: * -> *) a. Alternative f => f a -> f a -> f a <|> Decoder Boolean decodeTrue decodeFalse :: Decoder.Decoder Boolean decodeFalse :: Decoder Boolean decodeFalse = Bool -> Boolean Boolean Bool False Boolean -> Decoder () -> Decoder Boolean forall (f :: * -> *) a b. Functor f => a -> f b -> f a <$ ByteString -> Decoder () Decoder.byteString ByteString Literal.false Decoder Boolean -> Decoder () -> Decoder Boolean forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a <* Decoder () Decoder.spaces decodeTrue :: Decoder.Decoder Boolean decodeTrue :: Decoder Boolean decodeTrue = Bool -> Boolean Boolean Bool True Boolean -> Decoder () -> Decoder Boolean forall (f :: * -> *) a b. Functor f => a -> f b -> f a <$ ByteString -> Decoder () Decoder.byteString ByteString Literal.true Decoder Boolean -> Decoder () -> Decoder Boolean forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a <* Decoder () Decoder.spaces