Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Applicative style for infix operators?

Is there a way to make applicative uses of <$> and <*> look nice when dealing with infix operators? I think that

((++) <$> a <*> ((++) <$> b <*> c ))

looks much more cluttered then

a ++ b ++ c

so I wonder if there is a nicer way.

like image 997
hugomg Avatar asked Oct 02 '12 02:10

hugomg


1 Answers

(<++>) = liftA2 (++)
a <++> b <++> c

or

liftA2 (++) a $ liftA2 (++) b c
like image 103
singpolyma Avatar answered Oct 04 '22 03:10

singpolyma