{"id":20828829,"url":"https://github.com/perty/elm-shopping","last_synced_at":"2026-04-17T19:31:13.971Z","repository":{"id":137743712,"uuid":"246552628","full_name":"perty/elm-shopping","owner":"perty","description":"A little example in Elm. Inspired by the \"Grokking Simplicity\" book.","archived":false,"fork":false,"pushed_at":"2020-03-12T12:39:25.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-12T07:44:35.378Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/perty.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-11T11:25:52.000Z","updated_at":"2020-03-12T12:41:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"0f989903-bdaa-4f7e-9da1-e8cb81bde206","html_url":"https://github.com/perty/elm-shopping","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/perty/elm-shopping","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perty%2Felm-shopping","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perty%2Felm-shopping/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perty%2Felm-shopping/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perty%2Felm-shopping/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/perty","download_url":"https://codeload.github.com/perty/elm-shopping/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perty%2Felm-shopping/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31943168,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T17:29:20.459Z","status":"ssl_error","status_checked_at":"2026-04-17T17:28:47.801Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-11-17T23:18:33.070Z","updated_at":"2026-04-17T19:31:13.954Z","avatar_url":"https://github.com/perty.png","language":"Elm","funding_links":[],"categories":[],"sub_categories":[],"readme":"# elm-shopping\nA little example in Elm. Inspired by the [\"Grokking Simplicity\"](https://www.manning.com/books/grokking-simplicity) book. \n\nSo the Javascript in the book had some horrible things like \"find in DOM\" and imperatives such as \"update icons\".\n\nIn Elm, the view is simply a calculation (pure function) of the data (application state). So no need to find things in the DOM\nto manipulate. With modules, it is possible to put calculations related to a shopping cart in a separate module.\n\nNote how the current design has items that are in the product catalog `CatalogItem`and items in the cart `ShoppingCartItem`. \nThey are similar but different. The `addItem` function accepts anything with an id, description and a price. \n\nHence the `SomeItem` type alias internally.\n\n`type alias SomeItem a =\n    { a\n        | id : Int\n        , description : String\n        , price : Money\n    }`\n    \n## Money    \nThe representation of money is designed for run-time handling of different currencies. \nThis is a bit unlike I would do it and I started out with a design with phantom types to represent money. But then\nthe shopping cart would need to know its currency at compile-time. Deciding the currency in run-time is flexible \nbut does not gurantee as much as compile-time. What if we add items with prices in different currencies?\n\n## Business rules\nAll business rules are collected in the `Business` directory. Currently, there is only one\nrule, the threshold for free shipping as of chapter 4 in the book.\n\nBy doing this, any rule usage can be found instead of being sprinkled throughout the\ncode.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperty%2Felm-shopping","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperty%2Felm-shopping","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperty%2Felm-shopping/lists"}