{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE OverloadedStrings #-}

module Faker.Nation where

import qualified Data.ByteString as BS
import Data.Text
import qualified Data.Text.Encoding as TE
import qualified Data.Vector as V
import Faker
import Faker.Internal
import Faker.Provider.Nation
import Faker.TH

$(generateFakeField "nation" "nationality")

$(generateFakeField "nation" "language")

$(generateFakeField "nation" "capital_city")

flagEmoji :: Fake Text
flagEmoji :: Fake Text
flagEmoji =
  (FakerSettings -> IO Text) -> Fake Text
forall a. (FakerSettings -> IO a) -> Fake a
Fake
    (\FakerSettings
settings -> do
       Vector Word8
vecword <- (FakerSettings -> IO (Vector (Vector Word8)))
-> FakerSettings -> IO (Vector Word8)
forall (m :: * -> *) a.
(MonadThrow m, MonadIO m) =>
(FakerSettings -> m (Vector a)) -> FakerSettings -> m a
resolver FakerSettings -> IO (Vector (Vector Word8))
forall (m :: * -> *).
(MonadThrow m, MonadIO m) =>
FakerSettings -> m (Vector (Vector Word8))
nationFlagEmojiProvider FakerSettings
settings
       let lword :: [Word8]
lword = Vector Word8 -> [Word8]
forall a. Vector a -> [a]
V.toList Vector Word8
vecword
       Text -> IO Text
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Text -> IO Text) -> Text -> IO Text
forall a b. (a -> b) -> a -> b
$ ByteString -> Text
TE.decodeUtf8 (ByteString -> Text) -> ByteString -> Text
forall a b. (a -> b) -> a -> b
$ [Word8] -> ByteString
BS.pack [Word8]
lword)