package moe.kageru.spektacles import arrow.Kind import arrow.typeclasses.Functor import java.time.Month fun ParsedLines.heatMapByHour(): SortedCounter = heatMapBy { it.time.hour } fun ParsedLines.heatMapByMinute(): SortedCounter = heatMapBy { it.time.hour * 100 + it.time.minute } fun ParsedLines.heatMapByMonth(): SortedCounter = heatMapBy { it.time.month } private fun >ParsedLines.heatMapBy(op: (ParsedLine) -> T): SortedCounter { return this.map(op) .asIterable() .toSortedCounter() } inline fun Kind>.deepMap(noinline op: (A) -> R, AP: Functor): Kind> = AP.run { this@deepMap.map { nested: Kind -> nested.map(op) } }