import qualified Text as TS -> as T
This commit is contained in:
parent
6fdb6d38b2
commit
c0ab2e6178
@ -59,7 +59,7 @@ import Web.Cookie (parseCookies)
|
|||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
import Data.Time
|
import Data.Time
|
||||||
import Network.HTTP.Types (encodePath)
|
import Network.HTTP.Types (encodePath)
|
||||||
import qualified Data.Text as TS
|
import qualified Data.Text as T
|
||||||
import Data.Text (Text)
|
import Data.Text (Text)
|
||||||
import qualified Data.Text.Encoding as TE
|
import qualified Data.Text.Encoding as TE
|
||||||
import qualified Data.Text.Encoding.Error as TEE
|
import qualified Data.Text.Encoding.Error as TEE
|
||||||
@ -214,15 +214,15 @@ class RenderRoute (Route a) => Yesod a where
|
|||||||
then Right s
|
then Right s
|
||||||
else Left corrected
|
else Left corrected
|
||||||
where
|
where
|
||||||
corrected = filter (not . TS.null) s
|
corrected = filter (not . T.null) s
|
||||||
|
|
||||||
-- | Builds an absolute URL by concatenating the application root with the
|
-- | Builds an absolute URL by concatenating the application root with the
|
||||||
-- pieces of a path and a query string, if any.
|
-- pieces of a path and a query string, if any.
|
||||||
-- Note that the pieces of the path have been previously cleaned up by 'cleanPath'.
|
-- Note that the pieces of the path have been previously cleaned up by 'cleanPath'.
|
||||||
joinPath :: a
|
joinPath :: a
|
||||||
-> TS.Text -- ^ application root
|
-> T.Text -- ^ application root
|
||||||
-> [TS.Text] -- ^ path pieces
|
-> [T.Text] -- ^ path pieces
|
||||||
-> [(TS.Text, TS.Text)] -- ^ query string
|
-> [(T.Text, T.Text)] -- ^ query string
|
||||||
-> Builder
|
-> Builder
|
||||||
joinPath _ ar pieces' qs' = fromText ar `mappend` encodePath pieces qs
|
joinPath _ ar pieces' qs' = fromText ar `mappend` encodePath pieces qs
|
||||||
where
|
where
|
||||||
@ -261,7 +261,7 @@ class RenderRoute (Route a) => Yesod a where
|
|||||||
maximumContentLength :: a -> Maybe (Route a) -> Int
|
maximumContentLength :: a -> Maybe (Route a) -> Int
|
||||||
maximumContentLength _ _ = 2 * 1024 * 1024 -- 2 megabytes
|
maximumContentLength _ _ = 2 * 1024 * 1024 -- 2 megabytes
|
||||||
|
|
||||||
-- | Send a message to the log. By default, prints to stderr.
|
-- | Send a message to the log. By default, prints to stdout.
|
||||||
messageLogger :: a
|
messageLogger :: a
|
||||||
-> Loc -- ^ position in source code
|
-> Loc -- ^ position in source code
|
||||||
-> LogLevel
|
-> LogLevel
|
||||||
@ -294,7 +294,7 @@ instance Lift LogLevel where
|
|||||||
lift LevelInfo = [|LevelInfo|]
|
lift LevelInfo = [|LevelInfo|]
|
||||||
lift LevelWarn = [|LevelWarn|]
|
lift LevelWarn = [|LevelWarn|]
|
||||||
lift LevelError = [|LevelError|]
|
lift LevelError = [|LevelError|]
|
||||||
lift (LevelOther x) = [|LevelOther $ TS.pack $(lift $ TS.unpack x)|]
|
lift (LevelOther x) = [|LevelOther $ T.pack $(lift $ T.unpack x)|]
|
||||||
|
|
||||||
formatLogMessage :: Loc
|
formatLogMessage :: Loc
|
||||||
-> LogLevel
|
-> LogLevel
|
||||||
@ -303,13 +303,13 @@ formatLogMessage :: Loc
|
|||||||
formatLogMessage loc level msg = do
|
formatLogMessage loc level msg = do
|
||||||
now <- getCurrentTime
|
now <- getCurrentTime
|
||||||
return $ TB.toLazyText $
|
return $ TB.toLazyText $
|
||||||
TB.fromText (TS.pack $ show now)
|
TB.fromText (T.pack $ show now)
|
||||||
`mappend` TB.fromText " ["
|
`mappend` TB.fromText " ["
|
||||||
`mappend` TB.fromText (TS.pack $ drop 5 $ show level)
|
`mappend` TB.fromText (T.pack $ drop 5 $ show level)
|
||||||
`mappend` TB.fromText "] "
|
`mappend` TB.fromText "] "
|
||||||
`mappend` TB.fromText msg
|
`mappend` TB.fromText msg
|
||||||
`mappend` TB.fromText " @("
|
`mappend` TB.fromText " @("
|
||||||
`mappend` TB.fromText (TS.pack $ fileLocationToString loc)
|
`mappend` TB.fromText (T.pack $ fileLocationToString loc)
|
||||||
`mappend` TB.fromText ") "
|
`mappend` TB.fromText ") "
|
||||||
|
|
||||||
-- taken from file-location package
|
-- taken from file-location package
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user