Skip to content

Instantly share code, notes, and snippets.

@vigoo
Created November 22, 2019 17:17
Show Gist options
  • Save vigoo/e24a49ac013c30baf92e318dca2d1cac to your computer and use it in GitHub Desktop.
Save vigoo/e24a49ac013c30baf92e318dca2d1cac to your computer and use it in GitHub Desktop.
prox 3/11
trait ContextOf[PN] {
type Context[_]
}
object ContextOf {
type Aux[PN, F[_]] = ContextOf[PN] {
type Context[_] = F[_]
}
def apply[PN <: ProcessNode[_, _, _, _, _], F[_]](implicit contextOf: ContextOf.Aux[PN, F]): Aux[PN, F] = contextOf
implicit def contextOfProcess[F[_], Out, Err, OutResult, ErrResult, IRS <: RedirectionState, ORS <: RedirectionState, ERS <: RedirectionState]:
Aux[Process[F, Out, Err, OutResult, ErrResult, IRS, ORS, ERS], F] =
new ContextOf[Process[F, Out, Err, OutResult, ErrResult, IRS, ORS, ERS]] {
override type Context[_] = F[_]
}
implicit def contextOfPipedProcess[
F[_],
Out, Err,
PN1 <: ProcessNode[_, _, _, _, _],
PN2 <: ProcessNode[_, _, _, _, _],
IRS <: RedirectionState, ORS <: RedirectionState, ERS <: RedirectionState]:
Aux[PipedProcess[F, Out, Err, Byte, PN1, PN2, IRS, ORS, ERS], F] =
new ContextOf[PipedProcess[F, Out, Err, Byte, PN1, PN2, IRS, ORS, ERS]] {
override type Context[_] = F[_]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment