{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE FlexibleContexts #-}
module Data.TypedEncoding.Internal.Combinators where
import Data.TypedEncoding.Internal.Types
import Data.TypedEncoding.Internal.Class.IsStringR ()
import Data.TypedEncoding.Internal.Class.Recreate
import Data.TypedEncoding.Internal.Class.Util (SymbolList)
import GHC.TypeLits
verifyUncheckedEnc :: forall (xs :: [Symbol]) f c str . (
RecreateFAll f xs c str
, RecreateErr f
, Applicative f
, SymbolList xs
)
=>
UncheckedEnc c str
-> Maybe (f (Enc xs c str))
verifyUncheckedEnc x =
case verifyAnn @xs x of
Left err -> Nothing
Right (MkUncheckedEnc _ c str) -> Just $ recreateFAll . toEncoding c $ str
verifyUncheckedEnc' :: forall (xs :: [Symbol]) c str . (
RecreateFAll (Either RecreateEx) xs c str
, SymbolList xs
)
=>
UncheckedEnc c str
-> Maybe (Either RecreateEx (Enc xs c str))
verifyUncheckedEnc' = verifyUncheckedEnc