monads

Is it possible to write join down for Arrows, not ArrowApply?

断了今生、忘了曾经 提交于 2020-08-19 07:29:36
问题 I tried writing down joinArr :: ??? a => a r (a r b) -> a r b . I came up with a solution which uses app , therefore narrowing the a down to ArrowApply 's: joinArr :: ArrowApply a => a r (a r b) -> a r b joinArr g = g &&& Control.Category.id >>> app Is it possible to have this function written down for arrows? My guess is no. Control.Monad.join could have been a good stand-in for >>= in the definition of the Monad type class: m >>= k = join $ k <$> m . Having joinArr :: Arrow a => a r (a r b)

String.IsNullOrEmpty Monad

岁酱吖の 提交于 2020-07-19 10:58:10
问题 I have lately been dipping my feet into the fascinating world of functional programming, largely due to gaining experience in FP platforms like React and reading up on blogs the likes of https://blog.ploeh.dk/. As a primarily imperative programmer, this has been an interesting transition, but I am still trying to get my wet feet under me. I am getting a little tired of using string.IsNullOrEmpty as such. So much of the time I find myself littering my code with expressions such as _ = string