    module Data.Aeson.Parser.Time (
        run,
        FT.parseDay,
        FT.parseMonth,
        FT.parseQuarter,
        FT.parseQuarterOfYear,
        FT.parseLocalTime,
        FT.parseTimeOfDay,
        FT.parseUTCTime,
        FT.parseZonedTime,
    ) where

    import Data.Text (Text)

    import qualified Data.Aeson.Types.Internal as Aeson
    import qualified Data.Time.FromText as FT

    type Parser a = Text -> Either String a

    -- | Run a @text-iso8601@ parser as an aeson parser.
    run :: Parser a -> Text -> Aeson.Parser a
    run :: forall a. Parser a -> Text -> Parser a
    run Parser a
    f Text
    t = case Parser a
    f Text
    t of
        Left String
    err -> String -> Parser a
    forall a. String -> Parser a
    forall (m :: * -> *) a. MonadFail m => String -> m a
    fail (String -> Parser a) -> String -> Parser a
    forall a b. (a -> b) -> a -> b
    $ String
    "could not parse date: " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    err
        Right a
    r  -> a -> Parser a
    forall a. a -> Parser a
    forall (m :: * -> *) a. Monad m => a -> m a
    return a
    r
    {-# INLINE run #-}