These are chat archives for scalajp/functional

1st
Apr 2015
Sanshiro Yoshida
@halcat0x15a
Apr 01 2015 23:25
Monoidになってますよね?
implicit def ordering[A] = new Monoid[Ordering[A]] {
  def empty = new Ordering[A] {
    def compare(a: A, b: A): Int = 0
  }
  def append(x: Ordering[A], y: Ordering[A]) = new Ordering[A] {
    def compare(a: A, b: A): Int =
      x.compare(a, b) match {
        case 0 => y.compare(a, b)
        case n => n
      }
  }
}
KAWACHI Takashi
@tkawachi
Apr 01 2015 23:42
なってそう