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
package cats | |
import cats.macros.ImplicitResolutionSpec | |
import cats.functor._ | |
final class ImplicitResolutionTests extends ImplicitResolutionSpec { | |
canResolve[String, Monoid] { | |
import cats.implicits._ |
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
Expr(Block(List(Import(Select(Ident(cats), cats.implicits), List(ImportSelector(termNames.WILDCARD, 941, null, -1))), ValDef(Modifiers(IMPLICIT), TermName("F"), TypeTree().setOriginal(AppliedTypeTree(Ident(cats.MonadCombine), List(TypeTree().setOriginal(Ident(cats.tests.ListWrapper))))), Select(Ident(cats.tests.ListWrapper), TermName("monadCombine"))), ValDef(Modifiers(IMPLICIT), TermName("L"), TypeTree().setOriginal(AppliedTypeTree(Select(Select(This(TypeName("cats")), cats.package), TypeName("Monoid")), List(TypeTree().setOriginal(AppliedTypeTree(Ident(cats.tests.ListWrapper), List(TypeTree().setOriginal(Select(Ident(scala), scala.Int)))))))), TypeApply(Select(Ident(cats.tests.ListWrapper), TermName("monoid")), List(TypeTree().setOriginal(Select(Ident(scala), scala.Int))))), ValDef(Modifiers(IMPLICIT), TermName("F"), AppliedTypeTree(Ident(TypeName("MonadCombine")), List(Ident(TypeName("ListWrapper")))), Select(Ident(TermName("ListWrapper")), TermName("monadCombine"))), ValDef(Modifiers(IMPLICIT), TermName(" |
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
val show: Algebra[SExp, Option[String] => String] = { | |
case True => _ => "t" | |
case Symbol(s) => _ => s"'$s" | |
case Keyword(k) => _ => s":$k" | |
case Char(c) => _ => s"?$c" | |
case Int(v) => _ => v.toString | |
case Nil => { | |
case None => "nil" | |
case Some(p) => s"$p)" | |
} |
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
def tree[F[_[_]]](implicit T: BirecursiveT[F]): Algebra[SExp, F[RTree[String, ?]]] = { | |
case Nil => RTree.Node(List.empty[F[RTree[String, ?]]]).embed | |
case True => RTree.Leaf("t").narrow[F[RTree[String, ?]]].embed | |
case Int(v) => RTree.Leaf(v.toString).narrow[F[RTree[String, ?]]].embed | |
case Keyword(k) => RTree.Leaf(s":$k").narrow[F[RTree[String, ?]]].embed | |
case Symbol(s) => RTree.Leaf(s"'$s").narrow[F[RTree[String, ?]]].embed | |
case Char(c) => RTree.Leaf(s"?$c").narrow[F[RTree[String, ?]]].embed | |
case Pair(l, r) => r.project match { | |
case RTree.Node(t) => RTree.Node(l :: t).embed |
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
#[derive(Debug)] | |
struct Tone { | |
position: isize | |
} | |
impl cubeb::StreamCallback for Tone { | |
type Frame = cubeb::MonoFrame<i16>; | |
fn data_callback(&mut self, input: &[cubeb::MonoFrame<i16>], _: &mut [cubeb::MonoFrame<i16>]) -> isize { | |
self.position += 1; |
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 Example { | |
def failsHorribly[T1 <: Tuple, T2 <: Tuple](f: () => Either[Unit, Tuple.Concat[T1, T2]])(using size: Tuple.Size[T1]): () => Either[Unit, T2] = { | |
() => { | |
f() match { | |
case Left(_) => Left(()) | |
case Right(item) => Right(item.drop(size).asInstanceOf[T2]) | |
} | |
} | |
} |
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
;; -*- lexical-binding: t; -*- | |
(require 'rx) | |
(defvar rackunit-runner "raco") | |
(defun rackunit-goto () | |
(interactive) | |
(let | |
((marker |
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.quoted.* | |
trait Bar { | |
type X | |
} | |
object Foo { | |
def makeImpl[A : Type](a: Expr[A])(using Quotes): Expr[Any] = { | |
import quotes.reflect.* | |
val tree = TypeSelect(a.asTerm, "A").tpe.asType match { |
OlderNewer