Write multi-line statement on single line

跟風遠走 提交于 2019-12-12 13:09:10

问题


In Haskell I can write a multi-line statement on a single line, like

do {x<-[1,2];y<-[3,4];return (x,y)}

but in Purescript even a single-statement do-statement with curly braces will not compile. Is there different syntax to achieve this?


回答1:


No, PureScript has no syntax for doing this kind of thing. Aside from just not using do ;)

[1, 2] >>= \x -> [3, 4] >>= \y -> pure (Tuple x y)


来源:https://stackoverflow.com/questions/46461251/write-multi-line-statement-on-single-line

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!