Looking at the PureScript Prelude source , I'd say so:
instance functorFn :: Functor ((->) r) where
map = compose -- point-free!
Your example in http://try.purescript.org/?session=3538ae1c-eece-8f50-ad0c-e1504846a793 :
foldr f z Nil = z
foldr f z (x:xs) = f x (subfold xs)
where subfold = foldr f z
sum = foldr (+) 0
main = trace $ show $ sum (1:2:3:4:Nil) -- prints: 10
(needed to define foldr myself because I could not import any modules)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.