Switched again to Text because it made more sense given the dependency structure

This commit is contained in:
Geoffrey Roberts 2015-01-22 11:33:19 +11:00
parent 21e9c9f5c9
commit 8aa5ce504e
2 changed files with 6 additions and 4 deletions

View File

@ -35,7 +35,7 @@ library
, charset , charset
, lens >= 4 , lens >= 4
, servant >= 0.2.1 , servant >= 0.2.1
, split , text
hs-source-dirs: src hs-source-dirs: src
default-language: Haskell2010 default-language: Haskell2010
ghc-options: -Wall ghc-options: -Wall

View File

@ -12,9 +12,9 @@ import Data.Char (toLower)
import qualified Data.CharSet as Set import qualified Data.CharSet as Set
import qualified Data.CharSet.Unicode.Category as Set import qualified Data.CharSet.Unicode.Category as Set
import Data.List import Data.List
import Data.List.Split
import Data.Monoid import Data.Monoid
import Data.Proxy import Data.Proxy
import qualified Data.Text as T
import GHC.TypeLits import GHC.TypeLits
import Servant.API import Servant.API
@ -77,8 +77,10 @@ instance Show HeaderArg where
pv = toValidFunctionName ("header" <> n) pv = toValidFunctionName ("header" <> n)
pn = "{" <> n <> "}" pn = "{" <> n <> "}"
rp = replace pn "" p rp = replace pn "" p
-- Nicked from Data.String.Utils, works on lists -- Use replace method from Data.Text
replace old new l = intercalate new . splitOn old $ l replace old new = T.unpack .
T.replace (T.pack old) (T.pack new) .
T.pack
-- | Attempts to reduce the function name provided to that allowed by JS. -- | Attempts to reduce the function name provided to that allowed by JS.
-- https://mathiasbynens.be/notes/javascript-identifiers -- https://mathiasbynens.be/notes/javascript-identifiers