News for hackers. Stuff that matters.
Re:Demystifying Differentiable Programming (2018) by edflsafoiewq on Monday February 17, 2020 @12:52PM (#22349269)
In your notation it would be something like

  final case class Mon[A](v: A, m: M) {
    def flatMap[B](f: A => Mon[B]): Mon[B] =
      Mon(f(this.v).v, f(this.v).m * this.m)  // * is M's binary operation
  }
  object Mon {
    def pure(v: A): Mon[A] =
      Mon(v, M.unit)  // M.unit is M's identity element
  }

There are no comments on this comment yet.