    {-# LANGUAGE CPP #-}
    {-# OPTIONS_GHC -Wno-orphans #-}

    module IsomorphismClass.Relations.LazyTextBuilderAndStrictTextBuilder where

    #if MIN_VERSION_text(2,0,2)

    import qualified Data.Text.Encoding
    import qualified Data.Text.Lazy
    import qualified Data.Text.Lazy.Builder
    import IsomorphismClass.Classes
    import IsomorphismClass.Prelude

    instance IsomorphicTo Data.Text.Lazy.Builder.Builder Data.Text.Encoding.StrictBuilder where
      to :: StrictBuilder -> Builder
    to = Text -> Builder
    Data.Text.Lazy.Builder.fromText (Text -> Builder)
    -> (StrictBuilder -> Text) -> StrictBuilder -> Builder
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
    Category cat =>
    cat b c -> cat a b -> cat a c
    . StrictBuilder -> Text
    Data.Text.Encoding.strictBuilderToText

    instance IsomorphicTo Data.Text.Encoding.StrictBuilder Data.Text.Lazy.Builder.Builder where
      to :: Builder -> StrictBuilder
    to = Text -> StrictBuilder
    Data.Text.Encoding.textToStrictBuilder (Text -> StrictBuilder)
    -> (Builder -> Text) -> Builder -> StrictBuilder
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
    Category cat =>
    cat b c -> cat a b -> cat a c
    . LazyText -> Text
    Data.Text.Lazy.toStrict (LazyText -> Text) -> (Builder -> LazyText) -> Builder -> Text
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
    Category cat =>
    cat b c -> cat a b -> cat a c
    . Builder -> LazyText
    Data.Text.Lazy.Builder.toLazyText

    #endif