{-# OPTIONS_GHC -fno-warn-orphans #-} module Yesod.Auth.Simple.Instance.Persist.EmailText where import ClassyPrelude import Database.Persist.Sql import Yesod.Auth.Simple.Types instance PersistFieldSql Email where sqlType :: Proxy Email -> SqlType sqlType = SqlType -> Proxy Email -> SqlType forall a b. a -> b -> a const SqlType SqlString instance PersistField Email where toPersistValue :: Email -> PersistValue toPersistValue (Email Text e) = Text -> PersistValue forall a. PersistField a => a -> PersistValue toPersistValue Text e fromPersistValue :: PersistValue -> Either Text Email fromPersistValue (PersistText Text e) = Email -> Either Text Email forall a b. b -> Either a b Right (Email -> Either Text Email) -> Email -> Either Text Email forall a b. (a -> b) -> a -> b $ Text -> Email Email Text e fromPersistValue PersistValue e = Text -> Either Text Email forall a b. a -> Either a b Left (Text -> Either Text Email) -> Text -> Either Text Email forall a b. (a -> b) -> a -> b $ [Element Text] -> Text forall seq. IsSequence seq => [Element seq] -> seq pack [Char] [Element Text] "Not a PersistText: " Text -> Text -> Text forall a. Semigroup a => a -> a -> a <> PersistValue -> Text forall a. Show a => a -> Text tshow PersistValue e