module AirGQL.Types.Utils (
  encodeToText,
)
where

import Data.Aeson (ToJSON, encode)
import Data.ByteString.Lazy (toStrict)
import Data.Text.Encoding (decodeUtf8)
import Protolude (Text, (.))


encodeToText :: (ToJSON a) => a -> Text
encodeToText :: forall a. ToJSON a => a -> Text
encodeToText =
  ByteString -> Text
decodeUtf8 (ByteString -> Text) -> (a -> ByteString) -> a -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> ByteString
toStrict (ByteString -> ByteString) -> (a -> ByteString) -> a -> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> ByteString
forall a. ToJSON a => a -> ByteString
encode