{-# LANGUAGE TemplateHaskell #-}
module Axel.Utils.String where
import qualified Data.Text as T (pack, replace, unpack)
import GHC.Exts (IsString(fromString))
import Language.Haskell.TH.Quote (QuasiQuoter(QuasiQuoter))
replace :: String -> String -> String -> String
replace needle replacement haystack =
T.unpack $ T.replace (T.pack needle) (T.pack replacement) (T.pack haystack)
s :: QuasiQuoter
s =
QuasiQuoter
((\a -> [|fromString a|]) . filter (/= '\r'))
(error "Cannot use s as a pattern")
(error "Cannot use s as a type")
(error "Cannot use s as a dec")