From 8aa5ce504eb6266607982a600443a88417fc8a3a Mon Sep 17 00:00:00 2001 From: Geoffrey Roberts Date: Thu, 22 Jan 2015 11:33:19 +1100 Subject: [PATCH] Switched again to Text because it made more sense given the dependency structure --- servant-jquery.cabal | 2 +- src/Servant/JQuery/Internal.hs | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/servant-jquery.cabal b/servant-jquery.cabal index b2d77cad..de237791 100644 --- a/servant-jquery.cabal +++ b/servant-jquery.cabal @@ -35,7 +35,7 @@ library , charset , lens >= 4 , servant >= 0.2.1 - , split + , text hs-source-dirs: src default-language: Haskell2010 ghc-options: -Wall diff --git a/src/Servant/JQuery/Internal.hs b/src/Servant/JQuery/Internal.hs index 350bec56..c8f583ca 100644 --- a/src/Servant/JQuery/Internal.hs +++ b/src/Servant/JQuery/Internal.hs @@ -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