Point-free style and using $

前端 未结 5 1729
生来不讨喜
生来不讨喜 2021-01-11 19:10

How does one combine using $ and point-free style?

A clear example is the following utility function:

times :: Int -> [a] -> [a]
t         


        
5条回答
  •  无人及你
    2021-01-11 19:56

    You can use this combinator: (The colon hints that two arguments follow)

    (.:) :: (c -> d) -> (a -> b -> c) -> a -> b -> d
    (.:) = (.) . (.)
    

    It allows you to get rid of the n:

    time = concat .: replicate
    

提交回复
热议问题