GithubHelp home page GithubHelp logo

typechecked / alphabet-soup Goto Github PK

View Code? Open in Web Editor NEW
40.0 6.0 2.0 387 KB

Type calculations at compile time

Home Page: https://alphabet-soup.typechecked.io

License: Apache License 2.0

Scala 99.88% Dockerfile 0.12%
scala typelevel-programming functional-programming shapeless alphabet-soup typelevel

alphabet-soup's Introduction

Alphabet soup

CircleCI Maven Central (Releases) License

This library is intended to give a seamless way to manipulate scala structures into one another, mixing the types intelligently as required

For a whistle-stop tour of the underlying algorithm, see here

Documentation

Please see the documentation site for information on this library

alphabet-soup's People

Contributors

jbwheatley avatar jdrphillips avatar mcgizzle 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

alphabet-soup's Issues

Mixer's for non-primitive types

The following will not compile

  @Atomic class A
  @Atomic class B
  implicitly[Mixer[(A,B), B]]

However if we swap the the classes for traits or primitives (String, Int, ect) it works fine.

See PR #20 for tests demonstrating the issue

Resolve Atom+Molecule conflict

I as a user define implicit val atomF: Atom[F[Foo]] = Atom[F[Foo]], which will compile.
If I happen to have a molecule in scope - implicit def m[A]: Molecule[F, A]... the failure point for the algorithm will be in SelectFromAtomised. It would be more informative to the user if the point of failure was the creation of the atom atomF (much like done for DefaultAtom).

Further, you cannot use atoms in mixing of type Atom[Option[Foo]] or Atom[List[Foo]] at all due to the automatic pick up the molecules in the Molecule companion, and again the compilation error obfuscates the fact that atoms and molecules can't exists side-by-side.

Feature Request: Atom Mapping

Atom Mapping

When atom selecting fails on a type parameter Target, the algorithm will search for an implicitly supplied conversion between an available Source and the desired Target.

If you have a type A which can be uniquely mapped to a type B and atom-selection fails to find a B in the source, it should search for an A and a canonical conversion from A => B.

Isomorphism typeclass

Iso[A, B] <=> Mixer[A, B] && Mixer[B, A]

trait Iso[A, B] {
  def forwards(a: A): B
  def backwards(b: B): A
}

Name to be determined.

Should probably be built by traversing the atomised structure of A and B at the same time to make it more efficient.

Should be used in SelectFromAtomised, one implicit of which currently takes aMixer in both directions

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.