{"id":17176325,"url":"https://github.com/evhub/coconut-prelude","last_synced_at":"2025-06-19T04:39:38.242Z","repository":{"id":61787038,"uuid":"122925683","full_name":"evhub/coconut-prelude","owner":"evhub","description":"An implementation of Haskell's Prelude in Python using Coconut.","archived":false,"fork":false,"pushed_at":"2024-07-26T09:15:58.000Z","size":1392,"stargazers_count":21,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-14T15:05:31.482Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/evhub.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-02-26T06:44:58.000Z","updated_at":"2024-07-26T09:16:02.000Z","dependencies_parsed_at":"2024-03-23T05:28:16.121Z","dependency_job_id":"454b990a-fc0b-4628-89cc-b3fa353baedb","html_url":"https://github.com/evhub/coconut-prelude","commit_stats":{"total_commits":78,"total_committers":1,"mean_commits":78.0,"dds":0.0,"last_synced_commit":"ad0d18dd42613ae222127a1bb6894e0d8b4ad6e1"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/evhub/coconut-prelude","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evhub%2Fcoconut-prelude","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evhub%2Fcoconut-prelude/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evhub%2Fcoconut-prelude/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evhub%2Fcoconut-prelude/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evhub","download_url":"https://codeload.github.com/evhub/coconut-prelude/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evhub%2Fcoconut-prelude/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260689856,"owners_count":23047048,"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":[],"created_at":"2024-10-14T23:59:55.167Z","updated_at":"2025-06-19T04:39:33.224Z","avatar_url":"https://github.com/evhub.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# coconut-prelude\n\nAn implementation of [Haskell's Prelude](https://hackage.haskell.org/package/base-4.10.1.0/docs/Prelude.html) in Python 3.8+ using [Coconut](http://coconut-lang.org).\n\n## Installation\n\n```\npip install coconut-prelude\n```\n\n## Usage\n\nTo use `coconut-prelude`, just\n```python\nfrom prelude import *\n```\nwhich should make all the standard Haskell built-ins available to you. The only exceptions are Haskell operators and Haskell built-ins that use reserved names in Python, which have been given the following names:\n```haskell\nfmapConst = (\u003c$)\nap = (\u003c*\u003e)\nseqAr = (*\u003e)\nseqAl = (\u003c*)\nbind = (\u003e\u003e\u003e=)\nseqM = (\u003e\u003e\u003e)\nbindFrom = (=\u003c\u003c\u003c)\ndot = (.)\napply = ($)\ncbv = ($!)\ncons = (:)\nchain = (++)\nat = (!!)\nnot_ = not\nreturn_ = return\nand_ = and\nor_ = or\nbreak_ = break\n\nimport Data.Ratio\nover = (%)\n```\n\nFurthermore, the following special functions are made available to mimic certain Haskell syntaxes, with information on each accessible via `help(func)`:\n```python\nof\ndo\nasIO\nunIO\nderivingOrd\nderivingBoundedEnum\ndefinesBind\ndefinesReturn\n```\n\nAdditionally, it is highly recommended, though fully optional, that `coconut-prelude` be used with [MyPy](https://mypy.readthedocs.io/en/stable/) to enable static type-checking and [Coconut](http://coconut-lang.org) to enable easier usage of functional programming constructs, such as those used to define the prelude in the first place.\n\nEven if not using Coconut, however, to get MyPy working with `coconut-prelude` will require you to follow the instructions [here](https://coconut.readthedocs.io/en/master/DOCS.html#mypy-integration) to generate the necessary stub files and add them to your `MYPYPATH`.\n\nIf you are using Coconut, you can also get access to actual custom Haskell operators with the code:\n```python\nfrom prelude import operator $$  # apply ($)\nfrom prelude import operator %%  # over (%)\nfrom prelude import operator \u003c$  # fmapConst\nfrom prelude import operator \u003c*\u003e  # ap\nfrom prelude import operator *\u003e  # seqAr\nfrom prelude import operator \u003c*  # seqAl\nfrom prelude import operator \u003e\u003e\u003e=  # bind (\u003e\u003e=)\nfrom prelude import operator \u003e\u003e\u003e  # seqM (\u003e\u003e)\nfrom prelude import operator =\u003c\u003c\u003c  # bindFrom (=\u003c\u003c)\nfrom prelude import operator ++  # chain\nfrom prelude import operator !!  # at\n```\n\nFor additional documentation, either [read the source code](https://github.com/evhub/coconut-prelude/blob/master/prelude-source/main.coco) or view the [auto-generated documentation](https://refined-github-html-preview.kidonng.workers.dev/evhub/coconut-prelude/raw/master/prelude.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevhub%2Fcoconut-prelude","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevhub%2Fcoconut-prelude","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevhub%2Fcoconut-prelude/lists"}