{"id":19975476,"url":"https://github.com/innoave/bounded-number","last_synced_at":"2026-05-13T14:35:38.653Z","repository":{"id":62418569,"uuid":"191007333","full_name":"innoave/bounded-number","owner":"innoave","description":"A type representing a bounded number","archived":false,"fork":false,"pushed_at":"2019-06-10T04:27:31.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-24T04:18:28.182Z","etag":null,"topics":["bounds","datatype","immutable"],"latest_commit_sha":null,"homepage":null,"language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/innoave.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-09T13:04:25.000Z","updated_at":"2019-06-10T04:39:05.000Z","dependencies_parsed_at":"2022-11-01T16:31:48.539Z","dependency_job_id":null,"html_url":"https://github.com/innoave/bounded-number","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/innoave%2Fbounded-number","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/innoave%2Fbounded-number/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/innoave%2Fbounded-number/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/innoave%2Fbounded-number/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/innoave","download_url":"https://codeload.github.com/innoave/bounded-number/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241411480,"owners_count":19958746,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bounds","datatype","immutable"],"created_at":"2024-11-13T03:18:35.818Z","updated_at":"2025-11-25T14:04:03.317Z","avatar_url":"https://github.com/innoave.png","language":"Elm","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bounded Number\n\nThe type `Bounded number` represent a number bounded between a minimum and a maximum.\n\nOnce the bounds are set the value of a bounded number can not get greater than its max bound\nneither can it get lower than its min bound.\n\nFunctions that modify the value of a bound number come in two variants.\n\n1.  The normal variant clips the resulting value within the defined bounds. Functions of this\n    variant are `inc`, `dec`, `incBy`, `decBy`, `set` and `map`.\n    \n    ```elm\n    Bounded.between 0 10\n        --|\u003e Expect.equal 0 \u003c\u003c Bounded.value\n        |\u003e Bounded.incBy 2\n        --|\u003e Expect.equal 2 \u003c\u003c Bounded.value\n        |\u003e Bounded.incBy 9\n        --|\u003e Expect.equal 10 \u003c\u003c Bounded.value\n    ```\n\n2.  The trying variant explicitly states whether the result would overrun the defined bounds by\n    returning a `Maybe`. These are functions which names are prefixed with \"try\" like `tryInc`,\n    `tryDec`, `trySet`, `tryMap`.\n\n    ```elm\n    Bounded.between 0 10\n        --|\u003e Expect.equal 0 \u003c\u003c Bounded.value\n        |\u003e Bounded.tryIncBy 2\n        --|\u003e Expect.equal (Just 2) \u003c\u003c Bounded.value\n        |\u003e Bounded.tryIncBy 9\n        --|\u003e Expect.equal Nothing \u003c\u003c Bounded.value\n    ```\n\nThe value of a bounded number can be set directly by the `set` function and read using the `value`\nfunction.\n\n```elm\nBounded.between 0 10\n    |\u003e Bounded.set 4\n    |\u003e Bounded.value\n    --|\u003e Expect.equal 4\n``` \n\nThe functions `encode` and `decoder` support a default JSON representation of a bounded number.\n\nCheck out the documentation of the functions as well as the fairly complete\n[unit tests](tests/BoundedTest.elm). \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finnoave%2Fbounded-number","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finnoave%2Fbounded-number","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finnoave%2Fbounded-number/lists"}