module Jsonifier.Write where

import qualified Jsonifier.Poke as Poke
import Jsonifier.Prelude
import PtrPoker.Write

{-# INLINE scientificString #-}
scientificString :: Scientific -> Write
scientificString :: Scientific -> Write
scientificString =
  Write -> Write
stringBody (Write -> Write) -> (Scientific -> Write) -> Scientific -> Write
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Scientific -> Write
scientificAsciiDec

{-# INLINE stringBody #-}
stringBody :: Write -> Write
stringBody :: Write -> Write
stringBody (Write Int
size Poke
poke) =
  Int -> Poke -> Write
Write (Int
size Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
2) (Poke
Poke.doubleQuote Poke -> Poke -> Poke
forall a. Semigroup a => a -> a -> a
<> Poke
poke Poke -> Poke -> Poke
forall a. Semigroup a => a -> a -> a
<> Poke
Poke.doubleQuote)