Do statement under a where clause

前端 未结 4 471
南旧
南旧 2020-12-07 06:35

I\'m trying to convert IO [String] to [String] with <- binding; however, I need to use a do block to

4条回答
  •  猫巷女王i
    2020-12-07 06:59

    As a slightly different angle on AJFarmar's answer: The only things you can have in a where are declarations. do blocks aren't declarations, they are expressions. I.e. this is the same as if you tried to write where 2+5. If you want to declare block in a where, it must be

    where
      // can have other declarations, even mutually recursive
      block = ...
    

提交回复
热议问题