{"id":15736164,"url":"https://github.com/tristancacqueray/simple-haskell-minifier","last_synced_at":"2025-03-13T07:32:08.826Z","repository":{"id":138665648,"uuid":"606296336","full_name":"TristanCacqueray/simple-haskell-minifier","owner":"TristanCacqueray","description":"Simple Haskell Minifier","archived":false,"fork":false,"pushed_at":"2023-09-24T14:36:27.000Z","size":109,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-11T01:43:16.394Z","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/TristanCacqueray.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}},"created_at":"2023-02-25T04:08:37.000Z","updated_at":"2023-02-27T01:11:38.000Z","dependencies_parsed_at":"2024-10-04T01:31:25.613Z","dependency_job_id":null,"html_url":"https://github.com/TristanCacqueray/simple-haskell-minifier","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/TristanCacqueray%2Fsimple-haskell-minifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TristanCacqueray%2Fsimple-haskell-minifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TristanCacqueray%2Fsimple-haskell-minifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TristanCacqueray%2Fsimple-haskell-minifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TristanCacqueray","download_url":"https://codeload.github.com/TristanCacqueray/simple-haskell-minifier/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221349729,"owners_count":16802688,"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-04T01:21:22.035Z","updated_at":"2024-10-24T21:05:10.740Z","avatar_url":"https://github.com/TristanCacqueray.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# simple-haskell-minifier\n\nThis project implements a transpiler to minify a simple subset of the Haskell language.\n\n```mermaid\ngraph LR\n  I(Source) --\u003e G(GHCHaskell)\n  G --\u003e S(SimpleHaskell)\n  S --\u003e M(Minifier)\n  M --\u003e O(Source)\n```\n\n\n## Overview and scope\n\nThe project is composed of three modules:\n\n- [GHCHaskell](src/GHCHaskell.hs): parses and decodes Haskell source with [ghc-lib-parser][ghc-lib-parser].\n- [SimpleHaskell](src/SimpleHaskell.hs): defines a simple Expr data type.\n- [Minifier](src/Minifier.hs): transforms and renders the Expr.\n\nThe Minifier does the following transformation:\n\n- [x] Combine repeated names when possible.\n- [x] Rename binder to single letter name.\n- [x] Inline single-use variable.\n- [x] Remove unused space.\n- [ ] Pack the lines to fit a column limit.\n\n\n## Usage\n\n```ShellSession\n$ cabal run \u003c\u003c EOF\nmodule Demo where\n\nrender 0 = putStrLn \"game-over\"\nrender score\n    | score \u003e= 1, score \u003c= 2 = pure ()\n    | otherwise = putStrLn (\"score: \" ++ show score)\n\neval pos | pos \u003e 42 = True\n         | otherwise = False\n\nEOF\n```\n```haskell\na 0=d\"game-over\";\na e|e\u003e=1,e\u003c=2=pure()|c=d(\"score: \"++show e);\nb e|e\u003e42=c|c=False;\nc=True;\nd=putStrLn\n```\n\nCheckout the [examples](examples) for more minification demos.\n\n\n## Contribute\n\nContributions and bug reports are welcome!\nThe implementation works ok for the examples, and I'd be happy to integrate changes to support other usage.\n\nTo work on this project you need a Haskell toolchain: [get-started](https://www.haskell.org/get-started/).\nRun the `./bin/run-tests` script to validate a commit.\n\n[ghc-lib-parser]: https://hackage.haskell.org/package/ghc-lib-parser\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftristancacqueray%2Fsimple-haskell-minifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftristancacqueray%2Fsimple-haskell-minifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftristancacqueray%2Fsimple-haskell-minifier/lists"}