Skip to content

Latest commit

 

History

History
19 lines (14 loc) · 530 Bytes

File metadata and controls

19 lines (14 loc) · 530 Bytes

Functor is a means of lifting functions over structure so that we may transform only the contents, leaving the structure alone.

and

fmap lifts functions into a structure

let lms = [Just "Ave", Nothing, Just "woohoo"]
let replaceWithP = const 'p'

so ...

replaceWithP lms                      -> 'p'
fmap replaceWithP lms                 -> 'ppp'
(fmap.fmap) replaceWithP lms          -> [Just 'p',Nothing,Just 'p']
(fmap.fmap.fmap) replaceWithP lms     -> [Just 'ppp',Nothing, Just 'pppppp']