我无法理解teaser in the HaskellWiki arrows tutorial:
中的代码main :: IO ()
main = do
let
prepend x = arr (x ++)
append x = arr (++ x)
withId t = returnA <+> t
xform = (withId $ prepend "<") >>>
(withId $ append ">") >>>
(withId $ ((prepend "!") >>> (append "!")))
xs = ["test", "foobar"] >>= (runKleisli xform)
mapM_ putStrLn xs
,其中
(withId f) >>> (withId g) =
(returnA <+> f) >>> (returnA <+> g) =
((arr id) <+> f) >>> ((arr id) <+> g)
和
((id . id) x) ++ ((id . f) x) ++ ((id . g) x) ++ ((g . f) x) =
x ++ (f x) ++ (g x) ++ ((g . f) x)
在最后两行中,我无法弄清楚组成(。)的分配属性究竟来自何处