Skip to content

Commit

Permalink
Fix functions returning Maybe string
Browse files Browse the repository at this point in the history
  • Loading branch information
hamishmack committed Jun 11, 2018
1 parent cf641a4 commit df2b83c
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions domconv-webkit-jsaddle.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1090,21 +1090,17 @@ returnType enums t ext Unsafe e =
(mkVar "maybe")
(H.HsParen (H.HsApp (mkVar "Prelude.error") (H.HsLit $ H.HsString "Nothing to return"))))
(mkVar "return"))
returnType _ (I.TyName "DOMString" Nothing) ext wrapType e
= H.HsInfixApp
(H.HsParen e)
(H.HsQVarOp (mkSymbol ">>="))
(mkVar "fromJSValUnchecked")
returnType _ (I.TyName "ByteString" Nothing) ext wrapType e
= H.HsInfixApp
(H.HsParen e)
(H.HsQVarOp (mkSymbol ">>="))
(mkVar "fromJSValUnchecked")
returnType _ (I.TyName "USVString" Nothing) ext wrapType e
= H.HsInfixApp
(H.HsParen e)
(H.HsQVarOp (mkSymbol ">>="))
(mkVar "fromJSValUnchecked")
returnType _ t ext wrapType e
| isOptionalStringType t && wrapType /= Unchecked =
H.HsInfixApp
(H.HsParen e)
(H.HsQVarOp (mkSymbol ">>="))
(mkVar "fromMaybeJSString")
| isStringType t =
H.HsInfixApp
(H.HsParen e)
(H.HsQVarOp (mkSymbol ">>="))
(mkVar "fromJSValUnchecked")
returnType _ (I.TyName "DOMTimeStamp" Nothing) _ _ e = H.HsApp (H.HsApp (mkVar "round") (mkVar "<$>")) (H.HsParen (
H.HsInfixApp
(H.HsParen e)
Expand Down

0 comments on commit df2b83c

Please sign in to comment.