Flipped / reversed fmap (<$>)?

前端 未结 5 1382
忘掉有多难
忘掉有多难 2020-12-13 19:04

I found defining the following

(%)  = flip fmap

I can write code like this:

readFile \"/etc/passwd\" % lines % filter (not          


        
5条回答
  •  鱼传尺愫
    2020-12-13 19:37

    -- (.) is to (<$>) as flip (.) is to your (%).  
    

    I usually define (&) = flip (.) and it's just like your example, you can apply function composition backwords. Allows for easier to understand points-free code in my opinion.

提交回复
热议问题