servant-purescript 0.8.0.0 → 0.8.0.1
raw patch · 5 files changed
+16/−6 lines, 5 files
Files
- servant-purescript.cabal +1/−1
- src/Servant/PureScript/CodeGen.hs +3/−3
- src/Servant/PureScript/Internal.hs +10/−0
- src/Servant/PureScript/MakeRequests.hs +1/−1
- src/Servant/PureScript/Subscriber.hs +1/−1
servant-purescript.cabal view
@@ -1,5 +1,5 @@ name: servant-purescript-version: 0.8.0.0+version: 0.8.0.1 synopsis: Generate PureScript accessor functions for you servant API description: Please see README.md homepage: https://github.com/eskimor/servant-purescript#readme
src/Servant/PureScript/CodeGen.hs view
@@ -68,7 +68,7 @@ genFunction :: [PSParam] -> Req PSType -> Doc genFunction allRParams req = let rParamsSet = Set.fromList allRParams- fnName = req ^. reqFuncName ^. camelCaseL+ fnName = req ^. reqFuncName ^. jsCamelCaseL allParamsList = baseURLParam : reqToParams req allParams = Set.fromList allParamsList fnParams = filter (not . flip Set.member rParamsSet) allParamsList -- Use list not set, as we don't want to change order of parameters@@ -124,8 +124,8 @@ Just _ -> ", content =" <+> "toNullable <<< Just <<< stringify <<< encodeJson $ reqBody" </> "}" ) </> "affResp <- affjax affReq"- </> "getResult affReq decodeJson affResp" <> line- )+ </> "getResult affReq decodeJson affResp"+ ) <> line genBuildURL :: Url PSType -> Doc genBuildURL url = psVar baseURLId <+> "<>"
src/Servant/PureScript/Internal.hs view
@@ -28,6 +28,7 @@ import Servant.Foreign+import Servant.Foreign.Internal -- | Our language type is Paramized, so you can choose a custom 'TypeBridge' for your translation, by@@ -174,3 +175,12 @@ , _typeName = "a" , _typeParameters = [] }++-- use servant-foreign's camelCaseL legacy version+jsCamelCaseL :: Getter FunctionName Text+jsCamelCaseL = _FunctionName . to (convert . map (T.replace "-" ""))+ where+ convert [] = ""+ convert (p:ps) = mconcat $ p : map capitalize ps+ capitalize "" = ""+ capitalize name = toUpper (T.head name) `T.cons` T.tail name
src/Servant/PureScript/MakeRequests.hs view
@@ -74,7 +74,7 @@ genFunction :: [PSParam] -> Req PSType -> Doc genFunction allRParams req = let rParamsSet = Set.fromList allRParams- fnName = req ^. reqFuncName ^. camelCaseL+ fnName = req ^. reqFuncName ^. jsCamelCaseL allParamsList = baseURLParam : reqToParams req allParams = Set.fromList allParamsList fnParams = filter (not . flip Set.member rParamsSet) allParamsList -- Use list not set, as we don't want to change order of parameters
src/Servant/PureScript/Subscriber.hs view
@@ -57,7 +57,7 @@ genFunction :: [PSParam] -> Req PSType -> Doc genFunction allRParams req = let rParamsSet = Set.fromList allRParams- fnName = req ^. reqFuncName ^. camelCaseL+ fnName = req ^. reqFuncName ^. jsCamelCaseL responseType = case req ^. reqReturnType of Nothing -> psUnit Just t -> t