haskell - Removing duplication (with Applicative ((->) t), perhaps?) -


i playing around simple function else's stack overflow question, , wrote expression:

f x ++ f y 

obviously best way write expression in real life, given have variables in scope anyway, saw duplication of f a, , thought "hey, maybe can remove applicative instance functions". wound with:

lifta2 (++) (flip f x) (flip f y) 

which awful. there nicer way remove duplication?obviously remove duplication binding f a in where clause, intended exercise in using built-in functions.

you do

((++) `on` f a) x y 

that doesn't use applicative, though (sorry).


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -