The Chymyst
project is an application framework and library for developing general concurrent applications in Scala.
This project uses the Chymyst Core
library, which implements the chemical machine paradigm of concurrency.
Automatic code generation for Scala functions and expressions via the Curry-Howard isomorphism
License: Apache License 2.0
The Chymyst
project is an application framework and library for developing general concurrent applications in Scala.
This project uses the Chymyst Core
library, which implements the chemical machine paradigm of concurrency.
"Invalid head type in application" error. It seems that some function arguments are mixed up when using case classes with zero arguments.
Two examples where that happens:
sealed trait JohnsCoupons[A]
final case class John0[A]() extends JohnsCoupons[A]
final case class John1[A](c1: A) extends JohnsCoupons[A]
final case class John2[A](c1: A, c2: A) extends JohnsCoupons[A]
final case class John3[A](c1: A, c2: A, c3: A) extends JohnsCoupons[A]
sealed trait JillsCoupons[A]
final case class Jill0[A]() extends JillsCoupons[A]
final case class Jill1[A](c1: A) extends JillsCoupons[A]
final case class Jill2[A](c1: A, c2: A) extends JillsCoupons[A]
type Coupons[A] = (JohnsCoupons[A], JillsCoupons[A])
def fmap[A, B]: (A ⇒ B) ⇒ Coupons[A] ⇒ Coupons[B] = implement
// Internal error: Invalid head type in application
and a simpler example,
sealed trait F[Z, A]
final case class Empty[Z, A]() extends F[Z, A]
final case class HaveZ[Z, A](z: Z) extends F[Z, A]
def map[A, B](fa: F[Z, A])(f: A ⇒ B): F[Z, B] = implement
Using a case object
instead of a case class Empty()
seems to work.
E.g. Either and List have different accessor names. The fix: make tests insensitive to these names.
ofType[ Future[Seq[Try[Int]]] => Future[Seq[Try[Int]]] ]
should generate an identity function, but currently does not compile. Most likely because the ConstructorT
is not instantiated with correct type parameters.
Examples where curryhoward
's present heuristics do not generate the expected code:
type P[T] = (Option[T], Option[T])
def fmap[A, B](f: A => B): P[A] => P[B] = implement
def flatten[A]: P[Option[A]] => P[A] = implement
When generating a function such as Option[A] => Option[A]
, the preferred implementation would be x => x
. Sometimes code such as this is generated:
Warning:(141, 89) type (A ⇒ Option[B]{None.type + Some[B]}) ⇒ (B ⇒ Option[C]{None.type + Some[C]}) ⇒ A ⇒ Option[C]{None.type + Some[C]} has 2 implementations (laws need checking?):
a ⇒ b ⇒ c ⇒ a c match { d ⇒ (None() + 0); e ⇒ b e.value } [score: (0,0.5,0.0,0,0)];
a ⇒ b ⇒ c ⇒ (None() + 0) [score: (3,0.0,0.0,0,0)].
def kleisliOptCompose[A, B, C](f: A ⇒ Option[B], g: B ⇒ Option[C]): A ⇒ Option[C] = implement
It is better to generate code such as x match { d => d }; ...
instead of x match { d => None() + 0 }; ...
when d
is itself already None()
. This code would have a lower information loss score.
The term a ⇒ Tuple2(a._1._1, a._1._2)
of type "Tuple2[Tuple2[A,A],Tuple2[A,A]] ⇒ Tuple2[A,A]"
is identical to the term a ⇒ a._1
of the same type, but the simplifier does not notice.
This leads to
type Pair[A] = (A, A)
def flatten[A] = anyOfType[Pair[Pair[A]] ⇒ Pair[A]]().map(_.lambdaTerm)
flatten[Int].length == 18 // should be 16
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.