Apply stylish-haskell, organize imports

This commit is contained in:
Arthur Fayzrakhmanov (Артур Файзрахманов) 2015-06-12 19:32:58 +05:00
parent dfd14ea16d
commit 2074915962
2 changed files with 54 additions and 51 deletions

View File

@ -1,9 +1,10 @@
{-# LANGUAGE ConstrainedClassMethods #-} {-# LANGUAGE ConstrainedClassMethods #-}
{-# LANGUAGE QuasiQuotes, TypeFamilies #-} {-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE PatternGuards #-}
{-# LANGUAGE PatternGuards #-} {-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE Rank2Types #-} {-# LANGUAGE Rank2Types #-}
{-# LANGUAGE TypeFamilies #-}
-- | A Yesod plugin for Authentication via e-mail -- | A Yesod plugin for Authentication via e-mail
-- --
-- This plugin works out of the box by only setting a few methods on the type class -- This plugin works out of the box by only setting a few methods on the type class
@ -49,25 +50,26 @@ module Yesod.Auth.Email
, defaultSetPasswordHandler , defaultSetPasswordHandler
) where ) where
import Yesod.Auth import Yesod.Auth
import qualified Data.Text as TS import qualified Yesod.Auth.Message as Msg
import qualified Data.Text as T import Yesod.Core
import qualified Data.Text.Encoding as TE import Yesod.Form
import qualified Crypto.Hash.MD5 as H import qualified Yesod.PasswordStore as PS
import qualified Crypto.Nonce as Nonce
import Data.ByteString.Base16 as B16 import Control.Applicative ((<$>), (<*>))
import Data.Text.Encoding (encodeUtf8, decodeUtf8With) import qualified Crypto.Hash.MD5 as H
import Data.Text.Encoding.Error (lenientDecode) import qualified Crypto.Nonce as Nonce
import Data.Text (Text) import Data.ByteString.Base16 as B16
import Yesod.Core import Data.Text (Text)
import qualified Yesod.PasswordStore as PS import qualified Data.Text as TS
import qualified Data.Text as T
import Data.Text.Encoding (decodeUtf8With, encodeUtf8)
import qualified Data.Text.Encoding as TE
import Data.Text.Encoding.Error (lenientDecode)
import Data.Time (addUTCTime, getCurrentTime)
import Safe (readMay)
import System.IO.Unsafe (unsafePerformIO)
import qualified Text.Email.Validate import qualified Text.Email.Validate
import qualified Yesod.Auth.Message as Msg
import Control.Applicative ((<$>), (<*>))
import Yesod.Form
import Data.Time (getCurrentTime, addUTCTime)
import Safe (readMay)
import System.IO.Unsafe (unsafePerformIO)
loginR, registerR, forgotPasswordR, setpassR :: AuthRoute loginR, registerR, forgotPasswordR, setpassR :: AuthRoute
@ -98,11 +100,11 @@ type Identifier = Text
-- | Data stored in a database for each e-mail address. -- | Data stored in a database for each e-mail address.
data EmailCreds site = EmailCreds data EmailCreds site = EmailCreds
{ emailCredsId :: AuthEmailId site { emailCredsId :: AuthEmailId site
, emailCredsAuthId :: Maybe (AuthId site) , emailCredsAuthId :: Maybe (AuthId site)
, emailCredsStatus :: VerStatus , emailCredsStatus :: VerStatus
, emailCredsVerkey :: Maybe VerKey , emailCredsVerkey :: Maybe VerKey
, emailCredsEmail :: Email , emailCredsEmail :: Email
} }
class ( YesodAuth site class ( YesodAuth site

View File

@ -1,5 +1,5 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE QuasiQuotes #-}
-- | Use an email address as an identifier via Google's login system. -- | Use an email address as an identifier via Google's login system.
-- --
@ -47,10 +47,24 @@ module Yesod.Auth.GoogleEmail2
, EmailType(..) , EmailType(..)
) where ) where
import Yesod.Auth (Auth, AuthPlugin (AuthPlugin),
AuthRoute, Creds (Creds),
Route (PluginR), YesodAuth,
authHttpManager, setCredsRedirect)
import qualified Yesod.Auth.Message as Msg
import Yesod.Core (HandlerSite, HandlerT, MonadHandler,
TypedContent, getRouteToParent,
getUrlRender, getYesod, invalidArgs,
lift, liftIO, lookupGetParam,
lookupSession, notFound, redirect,
setSession, whamlet, (.:))
import Blaze.ByteString.Builder (fromByteString, toByteString) import Blaze.ByteString.Builder (fromByteString, toByteString)
import Control.Applicative ((<$>), (<*>)) import Control.Applicative ((<$>), (<*>))
import Control.Arrow (second) import Control.Arrow (second)
import Control.Monad (liftM, unless, when) import Control.Monad (liftM, unless, when)
import qualified Crypto.Nonce as Nonce
import Data.Aeson ((.:?)) import Data.Aeson ((.:?))
import qualified Data.Aeson as A import qualified Data.Aeson as A
import qualified Data.Aeson.Encode as A import qualified Data.Aeson.Encode as A
@ -67,24 +81,11 @@ import qualified Data.Text as T
import Data.Text.Encoding (decodeUtf8, encodeUtf8) import Data.Text.Encoding (decodeUtf8, encodeUtf8)
import qualified Data.Text.Lazy as TL import qualified Data.Text.Lazy as TL
import qualified Data.Text.Lazy.Builder as TL import qualified Data.Text.Lazy.Builder as TL
import Network.HTTP.Client (parseUrl, requestHeaders, import Network.HTTP.Client (Manager, parseUrl, requestHeaders,
responseBody, urlEncodedBody, Manager) responseBody, urlEncodedBody)
import Network.HTTP.Conduit (http) import Network.HTTP.Conduit (http)
import Network.HTTP.Types (renderQueryText) import Network.HTTP.Types (renderQueryText)
import Yesod.Auth (Auth, AuthPlugin (AuthPlugin), import System.IO.Unsafe (unsafePerformIO)
AuthRoute, Creds (Creds),
Route (PluginR), YesodAuth,
authHttpManager, setCredsRedirect)
import qualified Yesod.Auth.Message as Msg
import Yesod.Core (HandlerSite, MonadHandler,
getRouteToParent, getUrlRender,
getYesod, invalidArgs, lift,
lookupGetParam,
lookupSession, notFound, redirect,
setSession, whamlet, (.:),
TypedContent, HandlerT, liftIO)
import qualified Crypto.Nonce as Nonce
import System.IO.Unsafe (unsafePerformIO)
pid :: Text pid :: Text
@ -315,10 +316,10 @@ instance FromJSON PersonURIType where
-- --
-- Since 1.4.3 -- Since 1.4.3
data Organization = data Organization =
Organization { orgName :: Maybe Text Organization { orgName :: Maybe Text
-- ^ The person's job title or role within the organization -- ^ The person's job title or role within the organization
, orgTitle :: Maybe Text , orgTitle :: Maybe Text
, orgType :: Maybe OrganizationType , orgType :: Maybe OrganizationType
-- ^ The date that the person joined this organization. -- ^ The date that the person joined this organization.
, orgStartDate :: Maybe Text , orgStartDate :: Maybe Text
-- ^ The date that the person left this organization. -- ^ The date that the person left this organization.
@ -357,7 +358,7 @@ instance FromJSON OrganizationType where
-- Since 1.4.3 -- Since 1.4.3
data Place = data Place =
Place { -- | A place where this person has lived. For example: "Seattle, WA", "Near Toronto". Place { -- | A place where this person has lived. For example: "Seattle, WA", "Near Toronto".
placeValue :: Maybe Text placeValue :: Maybe Text
-- | If @True@, this place of residence is this person's primary residence. -- | If @True@, this place of residence is this person's primary residence.
, placePrimary :: Maybe Bool , placePrimary :: Maybe Bool
} deriving (Show, Eq) } deriving (Show, Eq)
@ -371,13 +372,13 @@ instance FromJSON Place where
-- Since 1.4.3 -- Since 1.4.3
data Name = data Name =
Name { -- | The full name of this person, including middle names, suffixes, etc Name { -- | The full name of this person, including middle names, suffixes, etc
nameFormatted :: Maybe Text nameFormatted :: Maybe Text
-- | The family name (last name) of this person -- | The family name (last name) of this person
, nameFamily :: Maybe Text , nameFamily :: Maybe Text
-- | The given name (first name) of this person -- | The given name (first name) of this person
, nameGiven :: Maybe Text , nameGiven :: Maybe Text
-- | The middle name of this person. -- | The middle name of this person.
, nameMiddle :: Maybe Text , nameMiddle :: Maybe Text
-- | The honorific prefixes (such as "Dr." or "Mrs.") for this person -- | The honorific prefixes (such as "Dr." or "Mrs.") for this person
, nameHonorificPrefix :: Maybe Text , nameHonorificPrefix :: Maybe Text
-- | The honorific suffixes (such as "Jr.") for this person -- | The honorific suffixes (such as "Jr.") for this person
@ -445,7 +446,7 @@ resizePersonImage (PersonImage uri) size =
-- --
-- Since 1.4.3 -- Since 1.4.3
data Person = Person data Person = Person
{ personId :: Text { personId :: Text
-- | The name of this person, which is suitable for display -- | The name of this person, which is suitable for display
, personDisplayName :: Maybe Text , personDisplayName :: Maybe Text
, personName :: Maybe Name , personName :: Maybe Name