Skip to content

Commit

Permalink
Allow modifying the JSON parser
Browse files Browse the repository at this point in the history
  • Loading branch information
sandydoo authored and domenkozar committed Jan 12, 2024
1 parent b76a11f commit 52acb31
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Servant/Elm/Internal/Generate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ data ElmOptions = ElmOptions
-- ^ Types that represent an empty Http response.
, stringElmTypes :: [EType]
-- ^ Types that represent a String.
, expectJsonMethod :: Text
}


Expand Down Expand Up @@ -101,6 +102,7 @@ defElmOptions = ElmOptions
[ toElmType (Proxy :: Proxy String)
, toElmType (Proxy :: Proxy T.Text)
]
, expectJsonMethod = "Http.expectJson"
}


Expand Down Expand Up @@ -505,7 +507,7 @@ mkRequest opts request =
indent i "Err e -> toMsg (Err e)" <> line <+>
indent i "Ok _ -> toMsg (Ok ()))"
Just elmTypeExpr ->
"Http.expectJson toMsg" <+> renderDecoderName ((elmTypeAlterations opts) elmTypeExpr)
stext (expectJsonMethod opts) <+> " toMsg" <+> renderDecoderName ((elmTypeAlterations opts) elmTypeExpr)
Nothing -> error "mkHttpRequest: no reqReturnType?"
-- case request ^. F.reqReturnType of
-- Just elmTypeExpr | isEmptyType opts elmTypeExpr ->
Expand Down

0 comments on commit 52acb31

Please sign in to comment.