I wonder if pattern matching could be less verbose. Maybe this sounds weird, but here is example of what I mean:<br clear="all"><br>> type A = (Int, String)<br>><br>> f :: String -> A -> A<br>> f s (i,s') = (i, s ++ s')<br>
><br>> data B = B Int String deriving Show<br>><br>>g :: String -> B -> B<br>>g s (B i s') = B i $ s ++ s'<br><br>Types A/B and functions f/g are quite similar: (x :: A) or (x :: B) means that x contains some integer and string values, and f/g functions take some string and prepend it to the string part of x. The code for f and g has the same level of verbosity, but -- ta-dah! -- we can use arrows and define f in a highly laconic manner:<br>
<br>> import Control.Arrow<br>> f' :: String -> A -> A<br>> f' = second . (++)<br><br>So my queastion is how I could define (g' :: String -> B -> B) in the same way.<br>