data -> newtype for Identifier
This commit is contained in:
parent
9fe332dc33
commit
e60354ebe1
@ -23,14 +23,14 @@ import Network.HTTP.Wget
|
|||||||
import Text.HTML.TagSoup
|
import Text.HTML.TagSoup
|
||||||
import Numeric (showHex)
|
import Numeric (showHex)
|
||||||
import Control.Monad.Trans
|
import Control.Monad.Trans
|
||||||
import Control.Monad.Attempt.Class
|
|
||||||
import qualified Data.Attempt.Helper as A
|
import qualified Data.Attempt.Helper as A
|
||||||
import Data.Generics
|
import Data.Generics
|
||||||
import Data.Attempt
|
import Data.Attempt
|
||||||
import Control.Exception
|
import Control.Exception
|
||||||
|
|
||||||
-- | An openid identifier (ie, a URL).
|
-- | An openid identifier (ie, a URL).
|
||||||
data Identifier = Identifier { identifier :: String }
|
newtype Identifier = Identifier { identifier :: String }
|
||||||
|
deriving (Eq, Show)
|
||||||
|
|
||||||
data Error v = Error String | Ok v
|
data Error v = Error String | Ok v
|
||||||
instance Monad Error where
|
instance Monad Error where
|
||||||
@ -77,7 +77,7 @@ constructUrl url args = url ++ "?" ++ queryString args
|
|||||||
|
|
||||||
-- | Handle a redirect from an OpenID provider and check that the user
|
-- | Handle a redirect from an OpenID provider and check that the user
|
||||||
-- logged in properly. If it was successfully, 'return's the openid.
|
-- logged in properly. If it was successfully, 'return's the openid.
|
||||||
-- Otherwise, 'fail's an explanation.
|
-- Otherwise, 'failure's an explanation.
|
||||||
authenticate :: (MonadIO m, MonadAttempt m)
|
authenticate :: (MonadIO m, MonadAttempt m)
|
||||||
=> [(String, String)]
|
=> [(String, String)]
|
||||||
-> m Identifier
|
-> m Identifier
|
||||||
|
|||||||
@ -8,7 +8,7 @@ synopsis: Authentication methods for Haskell web applications.
|
|||||||
description: Focus is on remote authentication methods, such as OpenID,
|
description: Focus is on remote authentication methods, such as OpenID,
|
||||||
rpxnow and Google.
|
rpxnow and Google.
|
||||||
category: Web
|
category: Web
|
||||||
stability: unstable
|
stability: Stable
|
||||||
cabal-version: >= 1.2
|
cabal-version: >= 1.2
|
||||||
build-type: Simple
|
build-type: Simple
|
||||||
homepage: http://github.com/snoyberg/authenticate/tree/master
|
homepage: http://github.com/snoyberg/authenticate/tree/master
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user