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
, lens >= 4
, servant >= 0.2.1
, split
, text
hs-source-dirs: src
default-language: Haskell2010
ghc-options: -Wall

View file

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