
#12683: Monad laws in terms of fishes (>=>) -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: feature | Status: new request | Priority: normal | Milestone: Component: Documentation | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: #12672 Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Present monad laws with Kleisli composition (fish operator) {{{#!hs return >=> g = g g >=> return = g (f >=> g) >=> h = f >=> (g >=> h) }}} instead of bind: {{{#!hs return a >>= k = k a m >>= return = m m >>= (\x -> k x >>= h) = (m >>= k) >>= h }}} Even though `>>=` is a method of `Monad` this is so much clearer that I think it's worth it, started as ticket:12672#comment:4 ---- Fun mention: [http://www.cse.chalmers.se/~jomoa/papers/quickspec2016.pdf QuickSpec] doesn't generate lambda terms so it will not discover `(xs >>= f) >>= g` = `xs >>= (\x -> f x >>= g)` so it needs to be in terms of `>=>`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12683 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler