code: function when(pred, f) {
    if(!isPredOrFunc(pred)) {
      throw new TypeError(
        'when: Pred or predicate function required for first argument'
      )
    }
  
    if(!isFunction(f)) {
      throw new TypeError(
        'when: Function required for second argument'
      )
    }
  
    return x =>
      predOrFunc(pred, x) ? f(x) : x
  }
docs: when : (a -> Boolean) | Pred -> (a -> b) -> a -> b | a