|
Scala example source code file (EnumSyntax.scala)
The EnumSyntax.scala Scala example source code
package scalaz
package syntax
/** Wraps a value `self` and provides methods related to `Enum` */
final class EnumOps[F] private[syntax](val self: F)(implicit val F: Enum[F]) extends Ops[F] {
////
final def succ: F =
F succ self
final def -+-(n: Int): F =
F.succn(n, self)
final def succx: Option[F] =
F.succx.apply(self)
final def pred: F =
F pred self
final def ---(n: Int): F =
F.predn(n, self)
final def predx: Option[F] =
F.predx.apply(self)
final def from: EphemeralStream[F] =
F.from(self)
final def fromStep(step: Int): EphemeralStream[F] =
F.fromStep(step, self)
final def |=>(to: F): EphemeralStream[F] =
F.fromTo(self, to)
final def |->(to: F): List[F] =
F.fromToL(self, to)
final def |==>(step: Int, to: F): EphemeralStream[F] =
F.fromStepTo(step, self, to)
final def |-->(step: Int, to: F): List[F] =
F.fromStepToL(step, self, to)
////
}
trait ToEnumOps extends ToOrderOps {
implicit def ToEnumOps[F](v: F)(implicit F0: Enum[F]) =
new EnumOps[F](v)
////
////
}
trait EnumSyntax[F] extends OrderSyntax[F] {
implicit def ToEnumOps(v: F): EnumOps[F] = new EnumOps[F](v)(EnumSyntax.this.F)
def F: Enum[F]
////
////
}
Other Scala examples (source code examples)Here is a short list of links related to this Scala EnumSyntax.scala source code file: |
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.