These are chat archives for ramda/ramda

8th
May 2018
Waqas Noor
@waqasnoor
May 08 2018 06:57
lift is realy confusing for me. it has been months for me since i am using ramda and functional programming still could not understand it . Please anyone can if explain or provide any resources ?
Brad Compton (he/him)
@Bradcomp
May 08 2018 17:35
@waqasnoor The best place to get a deeper knowledge is probably the Mostly Adequate Guide but it helps to see how it operates on various inputs:
lift(add)([1, 2, 3], [1, 2, 3]) // [1 + 1, 1 + 2, 1 + 3, 2 + 1, 2 + 2, ...]-> [2, 3, 4, 3, 4, 5, 4, 5, 6]

lift(add)(Just(1), Just(2)) //Just(1 + 2) -> Just(3)

lift(add)(inc, dec)(2) // add(inc(2), dec(2)) -> add(3, 1) -> 4
So it takes a simple function and lifts it up to operate on values within a context using ap and map behind the scenes.