These are chat archives for ramda/ramda

11th
Sep 2018
Yazeed Bzadough
@yazeedb
Sep 11 2018 01:21
Hi guys. Is this point-free, despite the onTrue function showing a user?
ifElse(
  hasClearance,
  (user) => `Welcome, ${user.name}`,
  () => 'Nope'
)
Yazeed Bzadough
@yazeedb
Sep 11 2018 02:00
Got a great answer from Brian Londsorf, so if this helps anyone:
The ifElse function is point-free since it doesn't mention its input, but the onTrue isn't point-free. Pretty straightforward :grin:
Ben Briggs
@ben-eb
Sep 11 2018 09:41
@yazeedb Of course you can refactor to a pointfree version :)
ifElse(
  hasClearance,
  compose(concat('Welcome, '), prop('name')),
  always('Nope')
)
Mike Lambert
@lax4mike
Sep 11 2018 14:05
@yazeedb Writing functions in a point-free style is not the goal. The goal is write your functions in the most readable and expressive way possible. Sometimes, that's pointed, sometimes that's point-free.
Galileo Sanchez
@galileopy
Sep 11 2018 14:22
Is there a common name for a function with this signature?
// Result Promise Result a | e -> Promise Result a | e
Galileo Sanchez
@galileopy
Sep 11 2018 14:30
Are tagged unions the way to go when you have complex branching?