Representing Bool values as 'true' and 'false' in query params
commitd9c27de2dd13675dc541af5adf7d468569e3882f
authorGergely Szabo <gege251@gmail.com>
dateMon 9 Sep 2019, 10:48 (7 years ago)
parent86a896f
src/Servant/Elm/Internal/Generate.hs+1−1
@@ -620,7 +620,7 @@ elmListOfMaybes ds = "List.filterMap identity" <$> indent 4 (elmList ds)
620620defaultElmToString :: EType -> Text
621621defaultElmToString argType =
622622 case argType of
623− ETyCon (ETCon "Bool") -> "(\\value -> if value then \"1\" else \"0\")"
623+ ETyCon (ETCon "Bool") -> "(\\value -> if value then \"true\" else \"false\")"
624624 ETyCon (ETCon "Float") -> "String.fromFloat"
625625 ETyCon (ETCon "Char") -> "String.fromChar"
626626 ETyApp (ETyCon (ETCon "Maybe")) v -> "(Maybe.map " <> defaultElmToString v <> " >> Maybe.withDefault \"\")"
test/elm-sources/getBooksSource.elm+1−1
@@ -27,7 +27,7 @@ getBooks query_published query_sort query_year query_category query_filters toMs
2727 , [ Just query_category
2828 |> Maybe.map (Url.Builder.string "category") ]
2929 , query_filters
30− |> List.map ((Maybe.map (\value -> if value then "1" else "0") >> Maybe.withDefault "")
30+ |> List.map ((Maybe.map (\value -> if value then "true" else "false") >> Maybe.withDefault "")
3131 >> Url.Builder.string "filters[]"
3232 >> Just)
3333 ])