module SAML2.Bindings.Internal where import Control.Applicative ((<|>)) import Data.Proxy (Proxy) import Data.String (IsString) import qualified SAML2.Core.Protocols as SAMLP import SAML2.Bindings.General lookupProtocolParameter :: (SAMLP.SAMLProtocol m, IsString p) => Proxy m -> (p -> Maybe a) -> Maybe a lookupProtocolParameter :: forall m p a. (SAMLProtocol m, IsString p) => Proxy m -> (p -> Maybe a) -> Maybe a lookupProtocolParameter Proxy m p p -> Maybe a f = case Proxy m -> Maybe Bool forall a. SAMLProtocol a => Proxy a -> Maybe Bool SAMLP.isSAMLResponse_ Proxy m p of Just Bool r -> p -> Maybe a f (Bool -> p forall a. IsString a => Bool -> a protocolParameter Bool r) Maybe Bool Nothing -> p -> Maybe a f (Bool -> p forall a. IsString a => Bool -> a protocolParameter Bool False) Maybe a -> Maybe a -> Maybe a forall a. Maybe a -> Maybe a -> Maybe a forall (f :: * -> *) a. Alternative f => f a -> f a -> f a <|> p -> Maybe a f (Bool -> p forall a. IsString a => Bool -> a protocolParameter Bool True)