Giter Site home page Giter Site logo

lue-bird / elm-number-safe Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 34 KB

number types that aren't opaque

Home Page: https://dark.elm.dmy.fr/packages/lue-bird/elm-numbers-safe/latest/

License: MIT License

Elm 100.00%
elm number percentage type-safe

elm-number-safe's Introduction

  • have types to represent percentages in the intervals [0;1], [0;1), (0;1], (0;1)
  • replace operations like
    divide : Number -> Number -> Maybe Number
    with
    operation : Number -> NumberNot0 -> Number
  • have a common base type for 0-able, non-0, negatable and unsigned numbers so that operations can allow both
  • have transparent definitions, aka have "parsed, not validated" data
    • no internal operation is "unsafe", in fact there are no real internal operations
    • users can safely create arbitrary numbers

TODO

  • Rational rounding, toFloat, toAtLeast
  • Integer toAtLeast, divideBy, remainderBy
  • complete Percentage including 1
  • add more arithmetic operations
  • change Percentage to base 2
  • remove module Decimal (alternative: to base 2, add toRational)

elm-number-safe's People

Contributors

lue-bird avatar

Watchers

 avatar

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.