Some cases:
- you started a bugfix out of develop, but it should be applied to a release branch
- you started on a branch and want to rebase it on some colleague's changes
package OptionValueAccessor | |
import scala.language.experimental.macros | |
import scala.reflect.macros.whitebox.Context | |
object OptionValueAccessor { | |
implicit class OptValue[A, B](val self: Option[A])(implicit ev: A <:< {def value: B}) { | |
def ? : Option[B] = macro Impl.optValImpl[A, B] | |
} |
[Background] | |
Color=40,40,40 | |
[BackgroundIntense] | |
Color=40,40,40 | |
[Color0] | |
Color=73,72,62 | |
[Color0Intense] |
#!/usr/bin/env runhaskell | |
-- cabal depedencies: | |
-- | |
-- * containers | |
-- * pandoc-types | |
-- * uu-parsinglib | |
-- | |
{-# LANGUAGE RankNTypes #-} |
scala> trait Assoc[K] { type V ; val value: V } | |
defined trait Assoc | |
scala> def mkAssoc[V0](k: String, v: V0): Assoc[k.type] { type V = V0 } = | |
| new Assoc[k.type] { type V = V0 ; val value = v } | |
mkAssoc: [V0](k: String, v: V0)Assoc[k.type]{type V = V0} | |
scala> implicit def nameAssoc = mkAssoc("Name", "Mary") | |
nameAssoc: Assoc[String("Name")]{type V = String} |
realm=Sonatype Nexus Repository Manager | |
host=nexus.company.com | |
user=admin | |
password=admin123 |
trait Collections { | |
type CC[+X] // the overarching container type (in scala: any covariant collection, e.g. List, Vector) | |
type Min[+X] // the minimum type constructor which can be reconstituted to CC[X] (in scala: GenTraversableOnce) | |
type Opt[+X] // the container type for optional results (in scala: Option) | |
type CCPair[+X] // some representation of a divided CC[A] (at simplest, (CC[A], CC[A])) | |
type ~>[-V1, +V2] // some means of composing operations (at simplest, Function1) | |
type Iso[A] = CC[A] ~> CC[A] // e.g. filter, take, drop, reverse, etc. | |
type Map[-A, +B] = CC[A] ~> CC[B] // e.g. map, collect | |
type FlatMap[-A, +B] = CC[A] ~> Min[B] // e.g. flatMap |
/* | |
Copyright 2018 Viktor Klang | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software |
sealed trait Piece | |
case class Place(p: String) extends Piece | |
case class Name(n: String) extends Piece | |
case class LocatedPieces(located: Seq[(String, Piece, (Int, Int))]) | |
object S2 extends ReflectionUtils { | |
import scala.language.experimental.macros | |
import scala.language.reflectiveCalls | |
import scala.reflect.macros.Context |