This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// getSingletonInstance は static メソッドになる? | |
class Module | |
{ | |
use TSingleton; | |
static $FUNC_NAME_SINGLETON = 'singleton'; | |
static function singleton() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
やったらすぐ終わるんだけど、優先度が高いタスクがすごい勢いで入ってきて、一向に終わらないというか始まらない。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type ActionCont[T] = EitherT[Future, UseCaseResult, A] | |
final class FindWarriorImpl[Ctx <: IOContext]( | |
ctx: Ctx, | |
repository: WarriorRepository[Future] | |
) extends FindWarrior { | |
def apply(id: WarriorId): ActionCont[Warrior] = EitherT { | |
repository.resolveBy(id) map { | |
case Some(w) => Right(w) | |
case None => Left(WarriorNotFound) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sealed trait Nat | |
trait Zero extends Nat | |
trait Succ[N <: Nat] extends Nat | |
type Nat1 = Succ[Zero] | |
type Nat2 = Succ[Nat1] | |
type Nat3 = Succ[Nat2] | |
type Nat4 = Succ[Nat3] | |
type Nat5 = Succ[Nat4] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Main { | |
trait Monad[F[_]] { | |
def pure[A](a: A): F[A] | |
def map[A, B](fa: F[A])(f: A => B): F[B] = flatMap(fa)(f andThen pure) | |
def flatMap[A, B](fa: F[A])(f: A => F[B]): F[B] | |
} | |
def (fa: F[A]) map[F[_], A, B](f: A => B) given Monad[F]: F[B] = the[Monad[F]].map(fa)(f) | |
def (fa: F[A]) flatMap[F[_], A, B](f: A => F[B]) given Monad[F]: F[B] = the[Monad[F]].flatMap(fa)(f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.compiletime._ | |
object Main { | |
type -[A <: Int, B <: Int] <: Int = B match { | |
case 0 => A | |
case S[b] => A match { | |
case S[a] => a - b | |
case _ => Nothing | |
} |