git.iko.soy/haskell-servant/servant-elm
on master help sign in
apply elmTypeAlterations in ops in Generate.mkRequest (#64)
efd6c551inguini
src/Servant/Elm/Internal/Generate.hs+2−2
@@ -496,14 +496,14 @@ mkRequest opts request =
496 expect =
496 expect =
497 case request ^. F.reqReturnType of
497 case request ^. F.reqReturnType of
498 Just elmTypeExpr
498 Just elmTypeExpr
499− | isEmptyType opts elmTypeExpr
499+ | isEmptyType opts $ (elmTypeAlterations opts) elmTypeExpr
500 -- let elmConstructor = T.pack (renderElm elmTypeExpr)
500 -- let elmConstructor = T.pack (renderElm elmTypeExpr)
501 ->
501 ->
502 "Http.expectString " <> line <+> indent i "(\\x -> case x of" <> line <+>
502 "Http.expectString " <> line <+> indent i "(\\x -> case x of" <> line <+>
503 indent i "Err e -> toMsg (Err e)" <> line <+>
503 indent i "Err e -> toMsg (Err e)" <> line <+>
504 indent i "Ok _ -> toMsg (Ok ()))"
504 indent i "Ok _ -> toMsg (Ok ()))"
505 Just elmTypeExpr ->
505 Just elmTypeExpr ->
506− "Http.expectJson toMsg" <+> renderDecoderName elmTypeExpr
506+ "Http.expectJson toMsg" <+> renderDecoderName ((elmTypeAlterations opts) elmTypeExpr)
507 Nothing -> error "mkHttpRequest: no reqReturnType?"
507 Nothing -> error "mkHttpRequest: no reqReturnType?"
508 -- case request ^. F.reqReturnType of
508 -- case request ^. F.reqReturnType of
509 -- Just elmTypeExpr | isEmptyType opts elmTypeExpr ->
509 -- Just elmTypeExpr | isEmptyType opts elmTypeExpr ->