git.iko.soy/haskell-servant/servant-elm
on master help sign in
toString for Maybe types
commit1adeaf0fe0d97b1a79447a16e696539439e341dc authorGergely Szabo <gege251@gmail.com> dateSun 8 Sep 2019, 17:07 (7 years ago) parent463c83c
1 file changed+5−4
src/Servant/Elm/Internal/Generate.hs+5−4
src/Servant/Elm/Internal/Generate.hs+5−4
@@ -626,10 +626,11 @@ elmListOfMaybes ds = "List.filterMap identity" <$> indent 4 (elmList ds)
626626
627627defaultElmToString :: EType -> Text
628628defaultElmToString argType =
629− case argType of
630− ETyCon (ETCon "Bool") -> "(\\value -> if value then \"1\" else \"0\")"
631− ETyCon (ETCon "Posix") -> "Time.posixToMillis >> String.fromInt)"
632− _ -> "String.fromInt"
629+ case argType of
630+ ETyCon (ETCon "Bool") -> "(\\value -> if value then \"1\" else \"0\")"
631+ ETyCon (ETCon "Posix") -> "Time.posixToMillis >> String.fromInt)"
632+ ETyApp (ETyCon (ETCon "Maybe")) v -> defaultElmToString v
633+ _ -> "String.fromInt"
633634
634635toString :: ElmOptions -> EType -> Doc
635636toString opts argType =