Skip to content

Instantly share code, notes, and snippets.

View DmytroMitin's full-sized avatar
😎
everything is ok

Dmytro Mitin DmytroMitin

😎
everything is ok
View GitHub Profile
/*
* Copyright (c) 2013 midgardabc.com
*/
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.util.Random;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class Birds {
static int numberOfBirdTypes = 0;
static String[][] birds = new String[numberOfBirdTypes][4];
public static void main(String[] args) {
printBirdInfo(); // array is empty
addBirdType("Eagle"); // initializing
public class Doubles {
public Double parse(String s) {
if (isNumber(s)) {
return Double.valueOf(s);
} else {
return null;
}
}
import java.util.Collection;
import java.util.Iterator;
public class Main {
interface A {}
class B {
void add(A... a) {}
void add(Collection<A> c) {}
@ val Circle = "S" :: Type
Circle: Typ[Term] with Subs[Typ[Term]] = S : 𝒰 _0
@ val base = "base" :: Circle
base: Term with Subs[Term] = base : (S : 𝒰 _0)
@ val loop = "loop" :: (base =:= base)
loop: Term with Subs[Term] = loop : (base : (S : 𝒰 _0) = base : (S : 𝒰 _0))
@ val X = "X" :: Type
X: Typ[Term] with Subs[Typ[Term]] = X : 𝒰 _0
@ val a = "a" :: X
a: Term with Subs[Term] = a : (X : 𝒰 _0)
trait Search {
type T
}
trait WriterSearch extends Search {
override type T <: Writer
}
trait BookSearch extends Search {
override type T <: Book
object App {
trait Subtype[A, B] {
type C <: B
def apply(ev: A <:< B): (C =:= A, A =:= C)
}
object Subtype {
type Aux[A, B, C0 <: B] = Subtype[A, B] { type C = C0 }
def instance[A, B, C0 <: B](f: A <:< B => (C0 =:= A, A =:= C0)): Aux[A, B, C0] = new Subtype[A, B] {
override type C = C0
import shapeless.{::, HNil, Poly1, poly}
object App {
implicit object p extends Poly1 {
implicit val cse: Case.Aux[Int, String] = at(_.toString)
}
// implicit val p = new Poly1 {
// implicit val cse: Case.Aux[Int, String] = at(_.toString)
// }
object App {
trait MyTrait
object MyTrait {
def materialize[A <: MyTrait](implicit m: A): A = m
}
implicit val m/*: MyTrait*/ /*: (MyTrait {
/*implicit*/ val x: Int
})*/ = new MyTrait {
import Macros._
object App {
class A
class A1
class A2
class A3
@checkImplicits
def foo(implicit a: A = new A, a1: A1 = new A1, a2: A2 = new A2, a3: A3 = new A3): Unit = ()