Giter Club home page Giter Club logo

curryhoward's Introduction

Chymyst - Declarative concurrency in Scala

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.

curryhoward's People

Contributors

dan-zheng avatar retronym avatar sethtisue avatar winitzki avatar xuwei-k avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

curryhoward's Issues

Bug with case classes having zero arguments

"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.

Insufficient heuristics

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

Generate identity functions for Unit values

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.

Failure to simplify tuple term

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.