Skip to content

Instantly share code, notes, and snippets.

@sir-wabbit
Last active March 30, 2017 06:52
Show Gist options
  • Select an option

  • Save sir-wabbit/0a4af0baeb6ff49a850fe6e9a9765c8a to your computer and use it in GitHub Desktop.

Select an option

Save sir-wabbit/0a4af0baeb6ff49a850fe6e9a9765c8a to your computer and use it in GitHub Desktop.
object Main {
type Nat
object Nat {
type Z <: Nat
type S[N <: Nat] <: Nat
}
object Church {
object List {
type Nil
= [K, nil <: K, cons[_, _ <: K] <: K] => nil
type Cons[A, H <: A, T[B <: A, K, nil <: K, cons[_ <: B, _ <: K] <: K] <: K]
= [K, nil <: K, cons[_ <: A, _ <: K] <: K] => cons[H, T[A, K, nil, cons]]
type Cata[L[K, nil <: K, cons[_, _ <: K] <: K] <: K,
K, nil <: K, cons[_, _ <: K] <: K]
= L[K, nil, cons]
}
}
def main(args: Array[String]): Unit = {
import Nat._
import Church.List._
type L = Cons[Nat, S[Z], Cons[Nat, Z, Cons[Nat, S[Z], Nil]]]
}
}
exception occurred while typechecking tests/alex/test.scala
exception occurred while compiling tests/alex/test.scala
Exception in thread "main" java.util.NoSuchElementException: head of empty list
at scala.collection.immutable.Nil$.head(List.scala:420)
at scala.collection.immutable.Nil$.head(List.scala:417)
at dotty.tools.dotc.core.Decorators$ListDecorator$.zipWithConserve$extension(Decorators.scala:108)
at dotty.tools.dotc.core.Decorators$ListDecorator$.zipWithConserve$extension(Decorators.scala:109)
at dotty.tools.dotc.core.Decorators$ListDecorator$.zipWithConserve$extension(Decorators.scala:109)
at dotty.tools.dotc.core.Decorators$ListDecorator$.zipWithConserve$extension(Decorators.scala:109)
at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:3509)
at dotty.tools.dotc.core.Substituters$class.subst(Substituters.scala:25)
at dotty.tools.dotc.core.Contexts$Context.subst(Contexts.scala:57)
at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:241)
at dotty.tools.dotc.core.Types$TypeMap.dotty$tools$dotc$core$Types$TypeMap$$mapArg$1(Types.scala:3505)
at dotty.tools.dotc.core.Types$TypeMap$$anonfun$mapOver$2.apply(Types.scala:3509)
at dotty.tools.dotc.core.Types$TypeMap$$anonfun$mapOver$2.apply(Types.scala:3509)
at dotty.tools.dotc.core.Decorators$ListDecorator$.zipWithConserve$extension(Decorators.scala:108)
at dotty.tools.dotc.core.Decorators$ListDecorator$.zipWithConserve$extension(Decorators.scala:109)
at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:3509)
at dotty.tools.dotc.core.Substituters$class.subst(Substituters.scala:25)
at dotty.tools.dotc.core.Contexts$Context.subst(Contexts.scala:57)
at dotty.tools.dotc.core.Types$Type.subst(Types.scala:1187)
at dotty.tools.dotc.core.Types$PolyType$$anonfun$newLikeThis$2.apply(Types.scala:2616)
at dotty.tools.dotc.core.Types$PolyType$$anonfun$newLikeThis$2.apply(Types.scala:2616)
at dotty.tools.dotc.core.Types$PolyType.<init>(Types.scala:2584)
at dotty.tools.dotc.core.Types$PolyType$.apply(Types.scala:2681)
at dotty.tools.dotc.core.Types$PolyType.newLikeThis(Types.scala:2614)
at dotty.tools.dotc.core.Types$PolyType.derivedPolyType(Types.scala:2622)
at dotty.tools.dotc.core.Types$TypeMap.derivedPolyType(Types.scala:3434)
at dotty.tools.dotc.core.Types$TypeMap.mapOverPoly$1(Types.scala:3481)
at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:3483)
at dotty.tools.dotc.core.Substituters$class.substParams(Substituters.scala:232)
at dotty.tools.dotc.core.Contexts$Context.substParams(Contexts.scala:57)
at dotty.tools.dotc.core.Types$Type.substParams(Types.scala:1207)
at dotty.tools.dotc.core.Types$PolyType.instantiate(Types.scala:2607)
at dotty.tools.dotc.core.TypeApplications$$anonfun$appliedTo$extension0$1.tryReduce$1(TypeApplications.scala:421)
at dotty.tools.dotc.core.TypeApplications$$anonfun$appliedTo$extension0$1.apply(TypeApplications.scala:437)
at dotty.tools.dotc.core.TypeApplications$$anonfun$appliedTo$extension0$1.apply(TypeApplications.scala:391)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.core.TypeApplications$.appliedTo$extension0(TypeApplications.scala:391)
at dotty.tools.dotc.core.TypeApplications$.applyIfParameterized$extension(TypeApplications.scala:461)
at dotty.tools.dotc.core.Types$HKApply.superType(Types.scala:2722)
at dotty.tools.dotc.core.TypeApplications$$anonfun$typeParams$extension$1.apply(TypeApplications.scala:232)
at dotty.tools.dotc.core.TypeApplications$$anonfun$typeParams$extension$1.apply(TypeApplications.scala:213)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.core.TypeApplications$.typeParams$extension(TypeApplications.scala:212)
at dotty.tools.dotc.core.TypeApplications$.typeParamSymbols$extension(TypeApplications.scala:243)
at dotty.tools.dotc.typer.Typer.adaptType$1(Typer.scala:2047)
at dotty.tools.dotc.typer.Typer.adaptInterpolated(Typer.scala:2100)
at dotty.tools.dotc.typer.Typer$$anonfun$adapt$1$$anonfun$apply$36.apply(Typer.scala:1746)
at dotty.tools.dotc.typer.Typer$$anonfun$adapt$1$$anonfun$apply$36.apply(Typer.scala:1742)
at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:136)
at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
at dotty.tools.dotc.typer.Typer$$anonfun$adapt$1.apply(Typer.scala:1742)
at dotty.tools.dotc.typer.Typer$$anonfun$adapt$1.apply(Typer.scala:1742)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:1741)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1596)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1594)
at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:136)
at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1594)
at dotty.tools.dotc.typer.Typer$$anonfun$typedAppliedTypeTree$1.dotty$tools$dotc$typer$Typer$$anonfun$$typedArg$1(Typer.scala:1090)
at dotty.tools.dotc.typer.Typer$$anonfun$typedAppliedTypeTree$1$$anonfun$20.apply(Typer.scala:1092)
at dotty.tools.dotc.typer.Typer$$anonfun$typedAppliedTypeTree$1$$anonfun$20.apply(Typer.scala:1092)
at dotty.tools.dotc.core.Decorators$ListDecorator$.zipWithConserve$extension(Decorators.scala:108)
at dotty.tools.dotc.core.Decorators$ListDecorator$.zipWithConserve$extension(Decorators.scala:109)
at dotty.tools.dotc.core.Decorators$ListDecorator$.zipWithConserve$extension(Decorators.scala:109)
at dotty.tools.dotc.typer.Typer$$anonfun$typedAppliedTypeTree$1.apply(Typer.scala:1092)
at dotty.tools.dotc.typer.Typer$$anonfun$typedAppliedTypeTree$1.apply(Typer.scala:1063)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.typer.Typer.typedAppliedTypeTree(Typer.scala:1063)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1557)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1578)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1596)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1594)
at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:136)
at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1594)
at dotty.tools.dotc.typer.Typer$$anonfun$typedAppliedTypeTree$1.dotty$tools$dotc$typer$Typer$$anonfun$$typedArg$1(Typer.scala:1090)
at dotty.tools.dotc.typer.Typer$$anonfun$typedAppliedTypeTree$1$$anonfun$20.apply(Typer.scala:1092)
at dotty.tools.dotc.typer.Typer$$anonfun$typedAppliedTypeTree$1$$anonfun$20.apply(Typer.scala:1092)
at dotty.tools.dotc.core.Decorators$ListDecorator$.zipWithConserve$extension(Decorators.scala:108)
at dotty.tools.dotc.core.Decorators$ListDecorator$.zipWithConserve$extension(Decorators.scala:109)
at dotty.tools.dotc.core.Decorators$ListDecorator$.zipWithConserve$extension(Decorators.scala:109)
at dotty.tools.dotc.typer.Typer$$anonfun$typedAppliedTypeTree$1.apply(Typer.scala:1092)
at dotty.tools.dotc.typer.Typer$$anonfun$typedAppliedTypeTree$1.apply(Typer.scala:1063)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.typer.Typer.typedAppliedTypeTree(Typer.scala:1063)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1557)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1578)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1596)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1594)
at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:136)
at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1594)
at dotty.tools.dotc.typer.Namer$$anonfun$typedAheadType$1.apply(Namer.scala:923)
at dotty.tools.dotc.typer.Namer$$anonfun$typedAheadType$1.apply(Namer.scala:923)
at dotty.tools.dotc.typer.Namer.typedAheadImpl(Namer.scala:916)
at dotty.tools.dotc.typer.Namer.typedAheadType(Namer.scala:923)
at dotty.tools.dotc.typer.Namer.typeDefSig(Namer.scala:1165)
at dotty.tools.dotc.typer.Namer$TypeDefCompleter.typeSig(Namer.scala:799)
at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:770)
at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:748)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:214)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.info(SymDenotations.scala:192)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:331)
at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:1485)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1510)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1577)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1596)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1594)
at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:136)
at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1594)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1618)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1638)
at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:608)
at dotty.tools.dotc.typer.Typer$$anonfun$typedBlock$1.apply(Typer.scala:611)
at dotty.tools.dotc.typer.Typer$$anonfun$typedBlock$1.apply(Typer.scala:610)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:610)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1539)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1578)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1596)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1594)
at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:136)
at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1594)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1650)
at dotty.tools.dotc.typer.Typer$$anonfun$typedBlock$1.apply(Typer.scala:618)
at dotty.tools.dotc.typer.Typer$$anonfun$typedBlock$1.apply(Typer.scala:610)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:610)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1539)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1578)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1596)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1594)
at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:136)
at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1594)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1650)
at dotty.tools.dotc.typer.Typer$$anonfun$typedDefDef$1.apply(Typer.scala:1245)
at dotty.tools.dotc.typer.Typer$$anonfun$typedDefDef$1.apply(Typer.scala:1227)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:1227)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1520)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1577)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1596)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1594)
at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:136)
at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1594)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1618)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1638)
at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:1329)
at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:1275)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1275)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1523)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1577)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1596)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1594)
at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:136)
at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1594)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1618)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1638)
at dotty.tools.dotc.typer.Typer$$anonfun$typedPackageDef$1.apply(Typer.scala:1438)
at dotty.tools.dotc.typer.Typer$$anonfun$typedPackageDef$1.apply(Typer.scala:1425)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1425)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1562)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1578)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1596)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1594)
at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:136)
at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1594)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1650)
at dotty.tools.dotc.typer.FrontEnd$$anonfun$typeCheck$1.apply$mcV$sp(FrontEnd.scala:64)
at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:32)
at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:62)
at dotty.tools.dotc.typer.FrontEnd$$anonfun$runOn$3.apply(FrontEnd.scala:93)
at dotty.tools.dotc.typer.FrontEnd$$anonfun$runOn$3.apply(FrontEnd.scala:93)
at scala.collection.immutable.List.foreach(List.scala:381)
at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:93)
at dotty.tools.dotc.Run$$anonfun$compileUnits$1$$anonfun$apply$mcV$sp$1.apply(Run.scala:76)
at dotty.tools.dotc.Run$$anonfun$compileUnits$1$$anonfun$apply$mcV$sp$1.apply(Run.scala:73)
at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply$mcV$sp(Run.scala:73)
at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply(Run.scala:67)
at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply(Run.scala:67)
at dotty.tools.dotc.util.Stats$.monitorHeartBeat(Stats.scala:76)
at dotty.tools.dotc.Run.compileUnits(Run.scala:67)
at dotty.tools.dotc.Run.compileSources(Run.scala:64)
at dotty.tools.dotc.Run.compile(Run.scala:48)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:26)
at dotty.tools.dotc.Driver.process(Driver.scala:124)
at dotty.tools.dotc.Driver.process(Driver.scala:93)
at dotty.tools.dotc.Driver.process(Driver.scala:105)
at dotty.tools.dotc.Driver.main(Driver.scala:132)
at dotty.tools.dotc.Main.main(Main.scala)
java.lang.RuntimeException: Nonzero exit code returned from runner: 1
at scala.sys.package$.error(package.scala:27)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment