Giter Club home page Giter Club logo

Comments (13)

chessai avatar chessai commented on August 22, 2024 1

this is released. thank you everyone

from semirings.

chessai avatar chessai commented on August 22, 2024

I've actually had the same thought, and wanted this several times.

I'll take a PR for this. If there isn't a PR by the time I take up a sudden obsessive interest for 20 minutes, I'll do this

from semirings.

chessai avatar chessai commented on August 22, 2024

A PR should consist of (in Data.Semiring or perhaps another module):

  • Adding the Field typeclass
  • Adding all instances for that typeclass
  • documenting the laws of the typeclass
  • useful functions acting on types which are instances of the typeclass

from semirings.

chessai avatar chessai commented on August 22, 2024

This is secondary, and not necessary work to be done in semirings, but I'd also like fieldLaws to be added to quickcheck-classes and hedgehog-classes. (I will do this)

from semirings.

chessai avatar chessai commented on August 22, 2024

Perhaps the name should not be called invert? I know it fits, but doesn't mesh well with the popular groups package? If there's no better name then I'll yield on that. Note that I'm not worried about name-clashing with the Prelude. Perhaps call it recip?

from semirings.

chessai avatar chessai commented on August 22, 2024

Some useful functions that can be defined in terms of recip:

a / b = a * recip b
fromRational r = fromInteger (numerator r) / fromInteger (denonimator r)

from semirings.

chessai avatar chessai commented on August 22, 2024

Also, not sure what other instances in base there are other than Float,Double,Ratio,Complex.

My strategy thus far has been to supply instances for all types in base that have relevant instances (here i think that would be Fractional). Though, this recently got me into trouble with windows users (see #34)

from semirings.

chessai avatar chessai commented on August 22, 2024

Also, we should probably only allow instances we know to be "traditional". To that end, ratios of functions form a commutative ring (field), so i wonder if we should provide a type/instance for that?

An example of a non-traditional instance would be for a non-field where the density of units is high, e.g. certain residue classes. This high density of units allows the instance to still be useful.

from semirings.

Bodigrim avatar Bodigrim commented on August 22, 2024

This corresponds to division/reciprocal numbers, and can be implemented for e.g. rational numbers and reals.

We already have Fractional for this. Are there any examples of Field (in base, containers, etc.), which are not Num? If there are none, I struggle to find a use case for a new type class.

from semirings.

Multramate avatar Multramate commented on August 22, 2024

Except for adding fieldLaws to quickcheck-classes and hedgehog-classes (and possibly instances for ratios of functions and non-fields), this issue should be completed with the latest pull request #48.

from semirings.

Multramate avatar Multramate commented on August 22, 2024

Will this be released on Hackage anytime soon?

from semirings.

chessai avatar chessai commented on August 22, 2024

Yes, tomorrow

from semirings.

Multramate avatar Multramate commented on August 22, 2024

Thanks!

from semirings.

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.