This commit is contained in:
Matthias Fischmann 2015-11-21 16:37:17 +01:00
parent 589f8757f9
commit 3b0a076c3f
2 changed files with 6 additions and 6 deletions

View file

@ -7,3 +7,4 @@ import "hint" HLint.Dollar
import "hint" HLint.Generalise
ignore "Redundant bracket" = Domains.Rest.Client
ignore "Use mappend"

View file

@ -57,7 +57,7 @@ generatePSModule'
-> ST -- ^ Name of PureScript module
-> [F.Req] -- ^ List of AJAX requests to render in module
-> ST -- ^ Rendered PureScript module
generatePSModule' settings mname reqs = T.unlines $
generatePSModule' settings mname reqs = T.unlines
[ "module " <> mname <> " where"
, ""
, "import Prelude"
@ -84,7 +84,7 @@ generatePS settings req = ajaxRequest
args = captures <> queryArgs <> body <> fmap (fst . snd) headerArgs
captures :: [ST]
captures = fmap (F.captureArg) . filter F.isCapture $ req ^. F.reqUrl . F.path
captures = fmap F.captureArg . filter F.isCapture $ req ^. F.reqUrl . F.path
queryArgs :: [ST]
queryArgs = fmap ((<>) "query" . view F.argName) queryParams
@ -109,9 +109,9 @@ generatePS settings req = ajaxRequest
wrapHeaders :: [(T.Text, T.Text)] -> [(T.Text, (T.Text, F.HeaderArg))] -> ST
wrapHeaders ihs hs =
"[" <>
(T.intercalate ", " (concat $
T.intercalate ", " (concat $
[wrapImplicitHeader <$> ihs | not $ null ihs] ++
[wrapHeader <$> hs | not $ null hs])) <>
[wrapHeader <$> hs | not $ null hs]) <>
"]"
wrapHeader :: (T.Text, (T.Text, F.HeaderArg)) -> ST
@ -134,8 +134,7 @@ generatePS settings req = ajaxRequest
(" , url = " <> urlString) :
(" , headers = " <> wrapHeaders implicitHeaderArgs headerArgs) :
[" , content = Just body" | req ^. F.reqBody] ++
" }" :
[]
[" }"]
where
typeSig :: ST
typeSig = T.concat