{"id":13531183,"url":"https://github.com/MonoidMusician/dhall-purescript","last_synced_at":"2025-04-01T19:31:43.196Z","repository":{"id":36515468,"uuid":"140974586","full_name":"MonoidMusician/dhall-purescript","owner":"MonoidMusician","description":"Dhall implementation in PureScript","archived":false,"fork":false,"pushed_at":"2023-02-04T12:41:34.000Z","size":4114,"stargazers_count":97,"open_issues_count":10,"forks_count":5,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-03-25T07:13:48.529Z","etag":null,"topics":["dhall","purescript","purescript-halogen"],"latest_commit_sha":null,"homepage":"https://monoidmusician.github.io/dhall-purescript/index.html","language":"PureScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MonoidMusician.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}},"created_at":"2018-07-14T20:04:06.000Z","updated_at":"2025-03-20T17:38:11.000Z","dependencies_parsed_at":"2024-04-17T11:35:46.705Z","dependency_job_id":"b71cd499-2a57-4295-a9c3-1a43e32e273d","html_url":"https://github.com/MonoidMusician/dhall-purescript","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MonoidMusician%2Fdhall-purescript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MonoidMusician%2Fdhall-purescript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MonoidMusician%2Fdhall-purescript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MonoidMusician%2Fdhall-purescript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MonoidMusician","download_url":"https://codeload.github.com/MonoidMusician/dhall-purescript/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246700426,"owners_count":20819871,"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":["dhall","purescript","purescript-halogen"],"created_at":"2024-08-01T07:01:00.737Z","updated_at":"2025-04-01T19:31:38.184Z","avatar_url":"https://github.com/MonoidMusician.png","language":"PureScript","readme":"# dhall-purescript\nThis project is an implementation of [Dhall](https://github.com/dhall-lang/dhall-lang) in PureScript. It covers the standard API for representing, parsing, importing, and verifying Dhall expressions.\n\nIt works both in the browser and on node.js. Or at least it should! File an issue if you run into problems.\n\nThe current weaknesses are lack of efficiency and some bugs/edge cases in parsing and pretty printing.\n\n## Installation\nJS dependencies use `npm`, see `package.json`:\n```sh\nnpm install --save @petamoriken/float16@^2.0.0\nnpm install --save big-integer@^1.6.48\nnpm install --save nearley@^2.20.1\nnpm install --save node-fetch@^2.6.1\nnpm install --save git://github.com/athanclark/sjcl.git#e6ca43fbcc85689f9e6b212cc88b85a53295a459\n```\n\nYou should probably use `spago` to install this!\n\nIf you want to use `bower`, it's in an ugly state since some dependencies are not updated (warning: solving dependencies will take a loooong time):\n```sh\nbower install --force-latest --save MonoidMusician/dhall-purescript#main\nrm -rf bower_components/purescript-generics-rep/ bower_components/purescript-proxy/\npulp build -I bower_components/dhall-purescript/src/\n```\n\nGenerate the grammar by calling `dhall-purescript/grammar.sh` from the root of your project:\n```\n./bower_components/dhall-purescript/grammar.sh || ./.spago/dhall-purescript/*/grammar.sh\n```\n(this ensures `grammar.js` ends up adjacent to `output`, so the FFI can find it)\n\nCopy or symlink the `cbor-js` library:\n\n```\nmkdir lib\ncd lib \nln -s ../.spago/dhall-purescript/main/lib/cbor-js cbor-js\n```\n\n## Why Dhall?\nBecause Dhall is awesome, relatively simple, and conceptually clean. It has an agreed-upon standard, with lots of tests, is under active development, continually improving.\n\n## Why PureScript?\nIt is in my experience one of the best (typed!) compile-to-JS languages out there, and it supports all the abstraction I need. (It even has PolyKinds!)\n\n## Dhall Implementation and API\nDhall-Purescript has 100% compliance with the test suite. Nevertheless there are some gaps in the API, particularly in the untested pretty printer, lack of consumer API, and incomplete CLI interface.\n\nIt implements the syntax, a parser, and all the judgments of the Dhall standard: import resolution, typechecking, alpha- and beta-normalization, and all the smaller judgments needed to support them. Additionally, there is a small and incomplete API for converting to PureScript types (like the Haskell implementation provides).\n\n### AST type\n\nThe main expression type is `Dhall.Core.AST.Types.Expr m a`. It is a newtype of the `Free` monad on top of `VariantF` (an extensible sum functor, although the extensibility is rarely used in this library). The first parameter `m :: Type -\u003e Type` is the functor used for records/unions; it is usually `Data.Map.Map String` (unordered) or `Dhall.Map.InsOrdStrMap` (ordered), see `Dhall.Core.AST.Operations` for functions to change it. The second parameter `a :: Type` represents the leaves (usually used for imports), it can be mapped over using the `Functor` instance (along with `Traversable` and even `Monad`, for substitution).\n\n### Public API\n\nA word of warning: most of the library is implemented in more generality than you should ever want or need. In particular, the algorithms are meant to work with various different types of trees, and some of them are very scary complicated, like `Ospr`. The public API works solely with the simple `Expr m a` tree, however.\n\n- `Dhall.Variables.alphaNormalize` implements alpha-normalization.\n- `Dhall.Normalize.normalize` implements beta-normalization. Note that this will **not** sort the tree, so use `Dhall.Core.AST.Operations.unordered` for that.\n- `Dhall.Imports.Hash.neutralize` will fully normalize an AST and `Dhall.Imports.Hash.hash` will calculate the sha256 value of it.\n- `Dhall.TypeCheck.typeOf` (and friends) implements typechecking, returning results in the error functor `Validation.These.Erroring` (which is bundled with this library), where the error parameter is an extensible variant. `Dhall.TypeCheck.Errors.explain` can be used to render those errors, or just use `Dhall.TypeCheck.oneStopShop`.\n- `Dhall.Imports.Resolve.resolveImports` implements import resolution, but it is agnostic to the retrieval mechanism used, some of which can be found in `Dhall.Imports.Retrieve` (for both node and browser). See those files for more docs, and the tests and CLI for example usage.\n- `Dhall.Parser.parse` implements parsing, using the external [`nearley.js`](https://nearley.js.org/) library. Sorry, there are no meaningful errors provided.\n- `Dhall.Printer.printAST` implements a basic pretty printer.\n- `Dhall.API.Conversions` implements conversions to/from PS types.\n\n### CLI\nYou can use the npm commands `cli` and `normalize` to access the basic command-line interface:\n```sh\nnpm run cli -- normalize-all -b \"dhall-lang/Prelude/Double/*.dhall\"\nnpm run normalize https://test.dhall-lang.org/Bool/package.dhall\n```\n\n### Running tests\nYou can run the tests with `npm run test -- --`. You can specify test categories (parser, normalization, alpha-normalization, semantic-hash, type-inference, import, and binary-decode) and individual tests (starting with `./dhall-lang/` but NOT including the suffix of `{A,B}.*`!!). You can also exclude test categories or tests by prepending a minus sign. The prelude doesn't complete without OOMing so I typically exclude it.\n```sh\nnpm run test -- parser\nnpm run test -- -type-inference -b -import\nnpm run test -- -./dhall-lang/tests/type-inference/success/prelude\n```\n","funding_links":[],"categories":["Binding"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMonoidMusician%2Fdhall-purescript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMonoidMusician%2Fdhall-purescript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMonoidMusician%2Fdhall-purescript/lists"}