{"id":21064042,"url":"https://github.com/luochen1990/haskell-easy-mode","last_synced_at":"2026-01-18T10:01:29.429Z","repository":{"id":250695515,"uuid":"835178533","full_name":"luochen1990/haskell-easy-mode","owner":"luochen1990","description":"A Prelude alternative aims on Easy To Use","archived":false,"fork":false,"pushed_at":"2024-09-26T12:10:19.000Z","size":84,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-16T02:37:48.724Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Haskell","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/luochen1990.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2024-07-29T10:13:55.000Z","updated_at":"2024-09-26T12:10:23.000Z","dependencies_parsed_at":"2024-07-29T14:16:28.069Z","dependency_job_id":"4c0784a7-96cd-4113-a74e-d4e51a882508","html_url":"https://github.com/luochen1990/haskell-easy-mode","commit_stats":null,"previous_names":["luochen1990/haskell-easy-mode"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/luochen1990/haskell-easy-mode","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luochen1990%2Fhaskell-easy-mode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luochen1990%2Fhaskell-easy-mode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luochen1990%2Fhaskell-easy-mode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luochen1990%2Fhaskell-easy-mode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luochen1990","download_url":"https://codeload.github.com/luochen1990/haskell-easy-mode/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luochen1990%2Fhaskell-easy-mode/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28534203,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-19T17:48:07.264Z","updated_at":"2026-01-18T10:01:29.411Z","avatar_url":"https://github.com/luochen1990.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"EasyMode\n========\n\nA Prelude alternative aims on **easy to use**\n\nFeatures\n--------\n\n- Make it easy to Use `Text` instead of `String` by default, but you can still use both if you want.\n- Make it easy to Use `Integer` instead of `Int` by default, but you can still use both if you want.\n- Easy-to-use **type casting** tool functions (e.g. `toText`, `toPairs`, `toMap`), including Python-style functions (e.g. `int`, `float`, `chr`, `ord`).\n- There's NO need to consider the global uniqueness of **field names** anymore.\n- All Partial Functions are marked as `Partial =\u003e` so you will not miss the stack trace.\n- All functions follows the [**LISO**](./doc/LISO.md) (Loose Input and Strict Output) Principle.\n- Bounded Accountability Error Handling ([**BAEH**](./doc/BAEH.md)).\n\nUsage\n-----\n\n### REPL\n\n```shell\nnix run github:luochen1990/haskell-easy-mode\n```\n\n### Coding\n\nEasyMode depends on several language extensions, see the doc about [preparation](./doc/prepare.md).\n\nNow we start coding.\n\n```haskell\n\n-- First, you need to import EasyMode instead of Prelude\nimport EasyMode\n\n-- You can freely define field names without considering their global uniqueness\ndata Student = Student { name :: Text, score :: Integer } deriving (Show, Eq, Ord)\ndata School = School { name :: Text, student_number :: Integer } deriving (Show, Eq, Ord)\n\n-- Most of the Haskell syntax you are familiar with is supported here\ninc = (+ 1)\ndouble = (* 2)\n\ns1 = Student \"alice\" 90\nsc1 = School \"school1\" 100\n\n-- Except for `.` which is now used for field access\nmain = do\n    print s1.name\n    print s1.score\n\n    print sc1.name\n    print sc1.student_number\n\n-- And `.` is also used as alias of `\u0026`, which is very similar to field access, but with extra space\n-- this makes the code looks like chaining calls in other languages\n    print (1 . inc)\n    print (1 . double . inc)\n    print (double 1 . inc)\n    print (1 . inc . double)\n\n-- Ofcourse you still want `.`, please use `\u003c\u003c\u003c` instead, and `\u003e\u003e\u003e` is the flipped version\n    print (1 . (inc \u003e\u003e\u003e double))\n    print (1 . (double \u003c\u003c\u003c inc))\n    print (1 . ((+ 1) \u003e\u003e\u003e (* 2)))\n\n-- there is no special handling here because a function is also an instance of Arrow.\n\n-- And there are also handy tool functions like `groupBy` and `toPairs`\n    let students = [s1, Student \"bob\" 60, s1{score = 99}]\n    print (students . groupBy (.name) . toPairs . map (second length))\n\n    let schools = [sc1, School \"school2\" 100, sc1{student_number = 50}]\n    print (schools . groupBy (.name) . toPairs . map (second (sum \u003c\u003c\u003c map (.student_number))))\n\n-- Type casting is easy here, just use `as*` to constraint type of literal and `to*` to cast it to what you want\n    print (\"1\" . asText . toInteger + 2 . asInteger)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluochen1990%2Fhaskell-easy-mode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluochen1990%2Fhaskell-easy-mode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluochen1990%2Fhaskell-easy-mode/lists"}