Remove bsToChars... helper functions
This commit is contained in:
parent
d9fb87b634
commit
0ee09c2ac5
@ -58,6 +58,7 @@ import Network.HTTP.Types (encodePath)
|
||||
import qualified Data.Text as TS
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Text.Encoding as TE
|
||||
import qualified Data.Text.Encoding.Error as TEE
|
||||
import Blaze.ByteString.Builder (Builder, toByteString)
|
||||
import Blaze.ByteString.Builder.Char.Utf8 (fromText)
|
||||
import Data.List (foldl')
|
||||
@ -333,7 +334,7 @@ applyLayout' title body = fmap chooseRep $ defaultLayout $ do
|
||||
defaultErrorHandler :: Yesod y => ErrorResponse -> GHandler sub y ChooseRep
|
||||
defaultErrorHandler NotFound = do
|
||||
r <- waiRequest
|
||||
let path' = bsToChars $ W.rawPathInfo r
|
||||
let path' = TE.decodeUtf8With TEE.lenientDecode $ W.rawPathInfo r
|
||||
applyLayout' "Not Found"
|
||||
#if GHC7
|
||||
[hamlet|
|
||||
|
||||
@ -23,10 +23,6 @@ module Yesod.Internal
|
||||
, locationToHamlet
|
||||
, runUniqueList
|
||||
, toUnique
|
||||
-- * UTF8 helpers
|
||||
, bsToChars
|
||||
, lbsToChars
|
||||
, charsToBs
|
||||
-- * Names
|
||||
, sessionName
|
||||
, nonceKey
|
||||
@ -38,16 +34,7 @@ import Text.Julius (Julius)
|
||||
import Data.Monoid (Monoid (..), Last)
|
||||
import Data.List (nub)
|
||||
|
||||
import qualified Data.ByteString as S
|
||||
import qualified Data.ByteString.Lazy as L
|
||||
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Text as T
|
||||
import qualified Data.Text.Encoding as T
|
||||
import qualified Data.Text.Encoding.Error as T
|
||||
|
||||
import qualified Data.Text.Lazy as LT
|
||||
import qualified Data.Text.Lazy.Encoding as LT
|
||||
|
||||
import Data.Typeable (Typeable)
|
||||
import Control.Exception (Exception)
|
||||
@ -102,9 +89,9 @@ runUniqueList (UniqueList x) = nub $ x []
|
||||
toUnique :: x -> UniqueList x
|
||||
toUnique = UniqueList . (:)
|
||||
|
||||
data Script url = Script { scriptLocation :: Location url, scriptAttributes :: [(T.Text, T.Text)] }
|
||||
data Script url = Script { scriptLocation :: Location url, scriptAttributes :: [(Text, Text)] }
|
||||
deriving (Show, Eq)
|
||||
data Stylesheet url = Stylesheet { styleLocation :: Location url, styleAttributes :: [(T.Text, T.Text)] }
|
||||
data Stylesheet url = Stylesheet { styleLocation :: Location url, styleAttributes :: [(Text, Text)] }
|
||||
deriving (Show, Eq)
|
||||
newtype Title = Title { unTitle :: Html }
|
||||
|
||||
@ -113,16 +100,6 @@ newtype Head url = Head (Hamlet url)
|
||||
newtype Body url = Body (Hamlet url)
|
||||
deriving Monoid
|
||||
|
||||
-- FIXME remove these functions
|
||||
lbsToChars :: L.ByteString -> String
|
||||
lbsToChars = LT.unpack . LT.decodeUtf8With T.lenientDecode
|
||||
|
||||
bsToChars :: S.ByteString -> String
|
||||
bsToChars = T.unpack . T.decodeUtf8With T.lenientDecode
|
||||
|
||||
charsToBs :: String -> S.ByteString
|
||||
charsToBs = T.encodeUtf8 . T.pack
|
||||
|
||||
nonceKey :: IsString a => a
|
||||
nonceKey = "_NONCE"
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user