Giter Club home page Giter Club logo

Comments (8)

erikerlandson avatar erikerlandson commented on July 3, 2024

The goal is to avoid direct dependency on spire so that it does not block port to Scala 3. Having it be %Test is not a total avoidance, but it would allow continued testing in Scala 2, and testing in Scala 3 could just use native numeric types to start, plus in-tree Rational

from coulomb.

erikerlandson avatar erikerlandson commented on July 3, 2024

One option would be to implement a sort of MVP rational that is not necessarily a direct port of spire Rational. As used by coulomb core, the Rational is compile-time only in the implicit system, so less-than-maximum efficiency is lower impact.

from coulomb.

cquiroz avatar cquiroz commented on July 3, 2024

I guess that is an option. I'm trying to get spire to run in dotty but I don't have an ETA

from coulomb.

erikerlandson avatar erikerlandson commented on July 3, 2024

The three main things coulomb currently consumes from spire are:

  1. Rational
  2. ConvertableTo and ConvertableFrom
  3. MultiplicativeGroup and friends

Rational would be easy to replace internally. MultiplicativeGroup and friends are being passed thru from typelevel algebra. I think the trickiest one to replace would be ConvertableTo and ConvertableFrom.

It would be feasible to define a coulomb typeclass for ConvertableTo and ConvertableFrom, and simply pass-thru the spire version whereever that was in scope.

My two main concerns with spire are that (1) it took a long time for spire to get onto scala-2.13, and I hope to not have it block coulomb for scala 3, and (2) spire defines an awful lot of stuff, and I'm only using a couple things.

Regardless of whether it is a hard dependency, I want coulomb to always integrate seamlessly with spire numeric types, for obvious reasons.

from coulomb.

erikerlandson avatar erikerlandson commented on July 3, 2024

side note: I'm also using shapeless for :: and HNil, which I'm getting transitively from spire but these types are purely implementation details, and they would be trivial to replace with my own version of :: and HNil internally

from coulomb.

erikerlandson avatar erikerlandson commented on July 3, 2024

cross-ref: over on my scala-3-POC I have an in-tree Rational and fractional exponents:

https://github.com/erikerlandson/poc-coulomb-scala3/blob/cbf290521792974b0f78767495a8caa09fdcc974/coulomb/src/coulomb/infra/meta.scala#L231

from coulomb.

erikerlandson avatar erikerlandson commented on July 3, 2024

my current design concept: coulomb-core will have no dependencies. It will come with coulomb.ops.standard and coulomb.ops.standard.truncating rules that cover operations, the new scala.Conversion and to / toUnit / toValue

There will be separate "tiers" for typelevel algebra, and then additionally spire numeric types.

see for example:
https://github.com/erikerlandson/poc-coulomb-scala3/blob/main/coulomb/src/coulomb/ops/standard.scala

from coulomb.

erikerlandson avatar erikerlandson commented on July 3, 2024

as of coulomb 0.6.0-M2 we have a separate coulomb-spire package, so I am going to close this

from coulomb.

Related Issues (20)

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.