Discussion on: Basic monads in Javascript

yurakostin profile image
Yuri Kostin

It seems to looks better with Ramda, isn't it:

const data = [
  { wrongName: 'Jason', level: 7, cool: true },
  { wrongName: 'Blanche', level: 8, cool: false }

  .map(filter(propEq('cool', true)))
    Just: console.log
    Nothing: () => console.log('No data available')

PS: thanks a lot for the article

Thread Thread
rametta profile image
Jason Author

This isn't exactly the same because Ramdas prop() does not return a Maybe, so if that prop did not exist then ramda would return an undefined, which will cause problems down the line. Same with head()

Thread Thread
yurakostin profile image
Yuri Kostin

You are totally right. Sorry for my mistake.