git.iko.soy/rowtype-yoga/typeapp
on main help sign in
feat: add TypeApp, Data.Reflectable, Data.Symbol, Option and Record
commit540c06bd8f2913c9ea56dfcad14f7d7444c3a088 authorWalker Leite <walkerleite490@gmail.com> dateThu 22 May 2025, 19:52 (1 year ago) parent4d6b0ba
14 files changed+710−2
.github/dependabot.yml+6 .github/workflows/test.yml+17 .github/workflows/todo.yml+14 .github/workflows/update-flake-lock.yml+30 .gitignore+13 README.md+66−2 flake.lock+418 flake.nix+78 src/Data/Reflectable/TypeApp.purs+8 src/Data/Symbol/TypeApp.purs+8 src/Option/TypeApp.purs+12 src/Record/Builder/TypeApp.purs+12 src/Record/TypeApp.purs+19 src/TypeApp.purs+9
.github/dependabot.ymlnew file+6
@@ -0,0 +1,6 @@
1+version: 2
2+updates:
3+ - package-ecosystem: "github-actions"
4+ directory: "/"
5+ schedule:
6+ interval: "weekly"
.github/workflows/test.ymlnew file+17
@@ -0,0 +1,17 @@
1+name: "Test"
2+on:
3+ pull_request:
4+jobs:
5+ tests:
6+ runs-on: ubuntu-latest
7+ steps:
8+ - uses: actions/checkout@v4
9+ - uses: cachix/install-nix-action@V27
10+ with:
11+ extra_nix_config: |
12+ access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
13+ - uses: cachix/cachix-action@v15
14+ with:
15+ name: klarkc
16+ authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
17+ - run: nix flake check
.github/workflows/todo.ymlnew file+14
@@ -0,0 +1,14 @@
1+name: "Run TODO to Issue"
2+on:
3+ push:
4+ branches:
5+ - main
6+jobs:
7+ build:
8+ runs-on: "ubuntu-latest"
9+ steps:
10+ - uses: "actions/checkout@v4"
11+ - name: "TODO to Issue"
12+ uses: "alstr/todo-to-issue-action@v4"
13+ with:
14+ IDENTIFIERS: '[{"name": "TODO", "labels": ["help wanted"]}, {"name": "FIXME", "labels": ["bug"]}]'
.github/workflows/update-flake-lock.ymlnew file+30
@@ -0,0 +1,30 @@
1+name: update-flake-lock
2+on:
3+ workflow_dispatch: # allows manual triggering
4+ schedule:
5+ - cron: '0 0 * * 0' # runs weekly on Sunday at 00:00
6+
7+jobs:
8+ lockfile:
9+ runs-on: ubuntu-latest
10+ steps:
11+ - name: Checkout repository
12+ uses: actions/checkout@v4
13+ - name: Install Nix
14+ uses: cachix/install-nix-action@V27
15+ with:
16+ extra_nix_config: |
17+ access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
18+ - uses: cachix/cachix-action@v15
19+ with:
20+ name: klarkc
21+ authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
22+ - name: Update flake.lock
23+ uses: DeterminateSystems/update-flake-lock@v23
24+ with:
25+ commit-msg: "build(deps): Bump flake.lock dependencies"
26+ pr-title: "Update flake.lock"
27+ pr-labels: |
28+ dependencies
29+ automated
30+ token: ${{ secrets.PAT_TOKEN }}
.gitignorenew file+13
@@ -0,0 +1,13 @@
1+/bower_components/
2+/node_modules/
3+/.pulp-cache/
4+/output/
5+/generated-docs/
6+/.psc-package/
7+/.psc*
8+/.purs*
9+/.psa*
10+/.spago
11+/result
12+/dist
13+/.pre-commit-config.yaml
README.md+66−2
@@ -1,2 +1,66 @@
1−# typeapp
2−A simple type application wrapper for common libraries
1+# TypeApp
2+
3+*A minimal helper library for ergonomic type applications in PureScript.*
4+
5+## Overview
6+
7+The `TypeApp` library is a small utility that allows you to use **type application syntax** with existing functions that take `Proxy` arguments, improving readability and ergonomics without breaking existing APIs.
8+
9+PureScript's type application feature lets you write clearer and more concise code, but many core libraries still require passing `Proxy` values explicitly. This library provides a lightweight bridge by allowing you to wrap such functions using the `@TypeApplications` syntax.
10+
11+```purescript
12+-- Instead of:
13+reflectSymbol (Proxy :: Proxy "someSymbol")
14+
15+-- You can now write:
16+reflectSymbol @"someSymbol"
17+```
18+
19+## Installation
20+
21+TODO
22+
23+## Modules
24+
25+### `TypeApp`
26+
27+```purescript
28+module TypeApp (p, vta) where
29+
30+import Type.Proxy (Proxy(..))
31+
32+-- Convenient alias to construct a Proxy at the type level
33+p :: forall k (@a :: k). Proxy a
34+p = Proxy
35+
36+-- Apply a function that expects a Proxy argument using type application
37+vta :: forall @a r. (Proxy a -> r) -> r
38+vta f = f p
39+```
40+
41+## Example usage
42+
43+### With `Data.Symbol.reflectSymbol`
44+
45+```purescript
46+import Data.Symbol.TypeApp (reflectSymbol)
47+
48+-- Instead of reflectSymbol (Proxy :: Proxy "label")
49+reflectSymbol @"label"
50+```
51+
52+## Why this library?
53+
54+While type applications are supported in the compiler, much of the ecosystem still relies on explicit `Proxy` usage. Large-scale migrations are costly and disruptive. This library offers:
55+
56+* **Opt-in type application usage**
57+* **No breaking changes to dependencies**
58+* **Better readability** in application code
59+
60+## Naming
61+
62+We chose `vta` ("via type application") over `wrap` to avoid clashing with common function names from libraries like `Newtype`.
63+
64+## Contributing
65+
66+Have a commonly used function you’d like to see in type application style? Open a PR or issue! We're open to extending the library with opt-in wrappers for major libraries (e.g., `Record`, `Data.Symbol`, `Type.Data`, etc.).
flake.locknew file+418
@@ -0,0 +1,418 @@
1+{
2+ "nodes": {
3+ "docs-search": {
4+ "flake": false,
5+ "locked": {
6+ "lastModified": 1675992564,
7+ "narHash": "sha256-Tk9VSogFHXtXe9O9vuCEfM/PV/S7plMIO0I++fCZn7U=",
8+ "owner": "purs-nix",
9+ "repo": "purescript-docs-search",
10+ "rev": "35822b1d6ce65b1a07f80dd9e2caf15c3ee83e2c",
11+ "type": "github"
12+ },
13+ "original": {
14+ "owner": "purs-nix",
15+ "repo": "purescript-docs-search",
16+ "type": "github"
17+ }
18+ },
19+ "flake-compat": {
20+ "flake": false,
21+ "locked": {
22+ "lastModified": 1696426674,
23+ "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
24+ "owner": "edolstra",
25+ "repo": "flake-compat",
26+ "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
27+ "type": "github"
28+ },
29+ "original": {
30+ "owner": "edolstra",
31+ "repo": "flake-compat",
32+ "type": "github"
33+ }
34+ },
35+ "flake-utils": {
36+ "locked": {
37+ "lastModified": 1644229661,
38+ "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
39+ "owner": "numtide",
40+ "repo": "flake-utils",
41+ "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
42+ "type": "github"
43+ },
44+ "original": {
45+ "owner": "numtide",
46+ "repo": "flake-utils",
47+ "type": "github"
48+ }
49+ },
50+ "flake-utils_2": {
51+ "locked": {
52+ "lastModified": 1618217525,
53+ "narHash": "sha256-WGrhVczjXTiswQaoxQ+0PTfbLNeOQM6M36zvLn78AYg=",
54+ "owner": "numtide",
55+ "repo": "flake-utils",
56+ "rev": "c6169a2772643c4a93a0b5ac1c61e296cba68544",
57+ "type": "github"
58+ },
59+ "original": {
60+ "owner": "numtide",
61+ "repo": "flake-utils",
62+ "type": "github"
63+ }
64+ },
65+ "flake-utils_3": {
66+ "locked": {
67+ "lastModified": 1618217525,
68+ "narHash": "sha256-WGrhVczjXTiswQaoxQ+0PTfbLNeOQM6M36zvLn78AYg=",
69+ "owner": "numtide",
70+ "repo": "flake-utils",
71+ "rev": "c6169a2772643c4a93a0b5ac1c61e296cba68544",
72+ "type": "github"
73+ },
74+ "original": {
75+ "owner": "numtide",
76+ "repo": "flake-utils",
77+ "type": "github"
78+ }
79+ },
80+ "flake-utils_4": {
81+ "locked": {
82+ "lastModified": 1618217525,
83+ "narHash": "sha256-WGrhVczjXTiswQaoxQ+0PTfbLNeOQM6M36zvLn78AYg=",
84+ "owner": "numtide",
85+ "repo": "flake-utils",
86+ "rev": "c6169a2772643c4a93a0b5ac1c61e296cba68544",
87+ "type": "github"
88+ },
89+ "original": {
90+ "owner": "numtide",
91+ "repo": "flake-utils",
92+ "type": "github"
93+ }
94+ },
95+ "get-flake": {
96+ "locked": {
97+ "lastModified": 1644686428,
98+ "narHash": "sha256-zkhYsURWFrvEZLkIoBeqFBzSu+cA2u5mo6M8vq9LN7M=",
99+ "owner": "ursi",
100+ "repo": "get-flake",
101+ "rev": "703f15558daa56dfae19d1858bb3046afe68831a",
102+ "type": "github"
103+ },
104+ "original": {
105+ "owner": "ursi",
106+ "repo": "get-flake",
107+ "type": "github"
108+ }
109+ },
110+ "gitignore": {
111+ "inputs": {
112+ "nixpkgs": [
113+ "hooks",
114+ "nixpkgs"
115+ ]
116+ },
117+ "locked": {
118+ "lastModified": 1709087332,
119+ "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
120+ "owner": "hercules-ci",
121+ "repo": "gitignore.nix",
122+ "rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
123+ "type": "github"
124+ },
125+ "original": {
126+ "owner": "hercules-ci",
127+ "repo": "gitignore.nix",
128+ "type": "github"
129+ }
130+ },
131+ "hooks": {
132+ "inputs": {
133+ "flake-compat": "flake-compat",
134+ "gitignore": "gitignore",
135+ "nixpkgs": "nixpkgs"
136+ },
137+ "locked": {
138+ "lastModified": 1747372754,
139+ "narHash": "sha256-2Y53NGIX2vxfie1rOW0Qb86vjRZ7ngizoo+bnXU9D9k=",
140+ "owner": "cachix",
141+ "repo": "git-hooks.nix",
142+ "rev": "80479b6ec16fefd9c1db3ea13aeb038c60530f46",
143+ "type": "github"
144+ },
145+ "original": {
146+ "owner": "cachix",
147+ "repo": "git-hooks.nix",
148+ "type": "github"
149+ }
150+ },
151+ "lint-utils": {
152+ "inputs": {
153+ "flake-utils": "flake-utils",
154+ "nixpkgs": [
155+ "purs-nix",
156+ "nixpkgs"
157+ ]
158+ },
159+ "locked": {
160+ "lastModified": 1707777931,
161+ "narHash": "sha256-PsPb5xMBZ9dPDP04o9vqKEUIEG80Z84/74fPuOMs0ZI=",
162+ "owner": "homotopic",
163+ "repo": "lint-utils",
164+ "rev": "5f11e3e51d8f1aa4ed62a89e90f05953931e105a",
165+ "type": "github"
166+ },
167+ "original": {
168+ "owner": "homotopic",
169+ "repo": "lint-utils",
170+ "type": "github"
171+ }
172+ },
173+ "make-shell": {
174+ "locked": {
175+ "lastModified": 1634940815,
176+ "narHash": "sha256-P69OmveboXzS+es1vQGS4bt+ckwbeIExqxfGLjGuJqA=",
177+ "owner": "ursi",
178+ "repo": "nix-make-shell",
179+ "rev": "8add91681170924e4d0591b22f294aee3f5516f9",
180+ "type": "github"
181+ },
182+ "original": {
183+ "owner": "ursi",
184+ "ref": "1",
185+ "repo": "nix-make-shell",
186+ "type": "github"
187+ }
188+ },
189+ "make-shell_2": {
190+ "locked": {
191+ "lastModified": 1634940815,
192+ "narHash": "sha256-P69OmveboXzS+es1vQGS4bt+ckwbeIExqxfGLjGuJqA=",
193+ "owner": "ursi",
194+ "repo": "nix-make-shell",
195+ "rev": "8add91681170924e4d0591b22f294aee3f5516f9",
196+ "type": "github"
197+ },
198+ "original": {
199+ "owner": "ursi",
200+ "ref": "1",
201+ "repo": "nix-make-shell",
202+ "type": "github"
203+ }
204+ },
205+ "nixpkgs": {
206+ "locked": {
207+ "lastModified": 1730768919,
208+ "narHash": "sha256-8AKquNnnSaJRXZxc5YmF/WfmxiHX6MMZZasRP6RRQkE=",
209+ "owner": "NixOS",
210+ "repo": "nixpkgs",
211+ "rev": "a04d33c0c3f1a59a2c1cb0c6e34cd24500e5a1dc",
212+ "type": "github"
213+ },
214+ "original": {
215+ "owner": "NixOS",
216+ "ref": "nixpkgs-unstable",
217+ "repo": "nixpkgs",
218+ "type": "github"
219+ }
220+ },
221+ "nixpkgs_2": {
222+ "locked": {
223+ "lastModified": 1747312588,
224+ "narHash": "sha256-MmJvj6mlWzeRwKGLcwmZpKaOPZ5nJb/6al5CXqJsgjo=",
225+ "owner": "NixOS",
226+ "repo": "nixpkgs",
227+ "rev": "b1bebd0fe266bbd1820019612ead889e96a8fa2d",
228+ "type": "github"
229+ },
230+ "original": {
231+ "owner": "NixOS",
232+ "ref": "nixpkgs-unstable",
233+ "repo": "nixpkgs",
234+ "type": "github"
235+ }
236+ },
237+ "nixpkgs_3": {
238+ "locked": {
239+ "lastModified": 1704161960,
240+ "narHash": "sha256-QGua89Pmq+FBAro8NriTuoO/wNaUtugt29/qqA8zeeM=",
241+ "owner": "NixOS",
242+ "repo": "nixpkgs",
243+ "rev": "63143ac2c9186be6d9da6035fa22620018c85932",
244+ "type": "github"
245+ },
246+ "original": {
247+ "owner": "NixOS",
248+ "ref": "nixpkgs-unstable",
249+ "repo": "nixpkgs",
250+ "type": "github"
251+ }
252+ },
253+ "nixpkgs_4": {
254+ "locked": {
255+ "lastModified": 1656549732,
256+ "narHash": "sha256-eILutFZGjfk2bEzfim8S/qyYc//0S1KsCeO+OWbtoR0=",
257+ "owner": "NixOS",
258+ "repo": "nixpkgs",
259+ "rev": "d3248619647234b5dc74a6921bcdf6dd8323eb22",
260+ "type": "github"
261+ },
262+ "original": {
263+ "owner": "NixOS",
264+ "ref": "nixpkgs-unstable",
265+ "repo": "nixpkgs",
266+ "type": "github"
267+ }
268+ },
269+ "option": {
270+ "flake": false,
271+ "locked": {
272+ "lastModified": 1699974506,
273+ "narHash": "sha256-rLuyGHHK0o3R55SpaYBgpO3eHQHvFC+to4/57D77rn4=",
274+ "owner": "jmatsushita",
275+ "repo": "purescript-option",
276+ "rev": "8d09843bf070fb6c40e28d05ccfa3b1c61b753e2",
277+ "type": "github"
278+ },
279+ "original": {
280+ "owner": "jmatsushita",
281+ "ref": "8d0984",
282+ "repo": "purescript-option",
283+ "type": "github"
284+ }
285+ },
286+ "parsec": {
287+ "locked": {
288+ "lastModified": 1635533376,
289+ "narHash": "sha256-/HrG0UPGnI5VdkhrNrpDiM2+nhdL6lD/bqyGtYv0QDE=",
290+ "owner": "nprindle",
291+ "repo": "nix-parsec",
292+ "rev": "1bf25dd9c5de1257a1c67de3c81c96d05e8beb5e",
293+ "type": "github"
294+ },
295+ "original": {
296+ "owner": "nprindle",
297+ "repo": "nix-parsec",
298+ "type": "github"
299+ }
300+ },
301+ "ps-tools": {
302+ "inputs": {
303+ "make-shell": "make-shell_2",
304+ "nixpkgs": "nixpkgs_4",
305+ "utils": "utils"
306+ },
307+ "locked": {
308+ "lastModified": 1704567308,
309+ "narHash": "sha256-WbFPIkKLtyQOPBUjintckKIYnfs7MvIbmfVsLRSAPlc=",
310+ "owner": "purs-nix",
311+ "repo": "purescript-tools",
312+ "rev": "ac626313141cbee78f06eb3c5e90359f695aef9b",
313+ "type": "github"
314+ },
315+ "original": {
316+ "owner": "purs-nix",
317+ "repo": "purescript-tools",
318+ "type": "github"
319+ }
320+ },
321+ "purs-nix": {
322+ "inputs": {
323+ "docs-search": "docs-search",
324+ "get-flake": "get-flake",
325+ "lint-utils": "lint-utils",
326+ "make-shell": "make-shell",
327+ "nixpkgs": "nixpkgs_3",
328+ "parsec": "parsec",
329+ "ps-tools": "ps-tools",
330+ "utils": "utils_2"
331+ },
332+ "locked": {
333+ "lastModified": 1746725234,
334+ "narHash": "sha256-r3Q/7yjcSdoAo79Jbl2mlhh1NISLsIkkOFU1pauC9qg=",
335+ "owner": "purs-nix",
336+ "repo": "purs-nix",
337+ "rev": "194a3973e70722274d9359568e4ac591c8b6a965",
338+ "type": "github"
339+ },
340+ "original": {
341+ "owner": "purs-nix",
342+ "repo": "purs-nix",
343+ "type": "github"
344+ }
345+ },
346+ "root": {
347+ "inputs": {
348+ "hooks": "hooks",
349+ "nixpkgs": "nixpkgs_2",
350+ "option": "option",
351+ "ps-tools": [
352+ "purs-nix",
353+ "ps-tools"
354+ ],
355+ "purs-nix": "purs-nix",
356+ "utils": "utils_3"
357+ }
358+ },
359+ "utils": {
360+ "inputs": {
361+ "flake-utils": "flake-utils_2"
362+ },
363+ "locked": {
364+ "lastModified": 1656044990,
365+ "narHash": "sha256-f01BB7CaOyntOab9XnpH9HD63rGcnu2iyL4M2ubs5F8=",
366+ "owner": "ursi",
367+ "repo": "flake-utils",
368+ "rev": "f53b674a2c90f6202a2f4cd491aba121775490b5",
369+ "type": "github"
370+ },
371+ "original": {
372+ "owner": "ursi",
373+ "ref": "8",
374+ "repo": "flake-utils",
375+ "type": "github"
376+ }
377+ },
378+ "utils_2": {
379+ "inputs": {
380+ "flake-utils": "flake-utils_3"
381+ },
382+ "locked": {
383+ "lastModified": 1656044990,
384+ "narHash": "sha256-f01BB7CaOyntOab9XnpH9HD63rGcnu2iyL4M2ubs5F8=",
385+ "owner": "ursi",
386+ "repo": "flake-utils",
387+ "rev": "f53b674a2c90f6202a2f4cd491aba121775490b5",
388+ "type": "github"
389+ },
390+ "original": {
391+ "owner": "ursi",
392+ "ref": "8",
393+ "repo": "flake-utils",
394+ "type": "github"
395+ }
396+ },
397+ "utils_3": {
398+ "inputs": {
399+ "flake-utils": "flake-utils_4"
400+ },
401+ "locked": {
402+ "lastModified": 1658606827,
403+ "narHash": "sha256-3kSWTDpV4+uApt/Xd0kv2m7TR1Y6A7SgYUeX86/qYuU=",
404+ "owner": "ursi",
405+ "repo": "flake-utils",
406+ "rev": "faec5f7431da6747a69957a9cd65e35b5173e10a",
407+ "type": "github"
408+ },
409+ "original": {
410+ "owner": "ursi",
411+ "repo": "flake-utils",
412+ "type": "github"
413+ }
414+ }
415+ },
416+ "root": "root",
417+ "version": 7
418+}
flake.nixnew file+78
@@ -0,0 +1,78 @@
1+{
2+ inputs = {
3+ nixpkgs.url = github:NixOS/nixpkgs/nixpkgs-unstable;
4+ utils.url = github:ursi/flake-utils;
5+ hooks.url = github:cachix/git-hooks.nix;
6+ purs-nix.url = github:purs-nix/purs-nix;
7+ ps-tools.follows = "purs-nix/ps-tools";
8+ option = {
9+ url = "github:jmatsushita/purescript-option/8d0984";
10+ flake = false;
11+ };
12+ };
13+
14+ outputs = { self, utils, ... }@inputs:
15+ utils.apply-systems
16+ { inherit inputs; }
17+ ({ pkgs, system, ... }@ctx:
18+ let
19+ # frontend
20+ inherit (pkgs) nodejs;
21+ purs-nix = inputs.purs-nix { inherit system; };
22+ inherit (ctx.ps-tools.for-0_15) purescript purs-tidy purescript-language-server;
23+ # TODO use option from official index
24+ option = purs-nix.build {
25+ name = "option";
26+ src.path = inputs.option;
27+ info.dependencies = [ "aff" "argonaut-codecs" "argonaut-core" "codec" "codec-argonaut" "datetime" "effect" "either" "enums" "foldable-traversable" "foreign" "foreign-object" "functors" "identity" "lists" "maybe" "prelude" "record" "simple-json" "spec" "transformers" "tuples" "unsafe-coerce"];
28+ };
29+ ps =
30+ purs-nix.purs
31+ {
32+ dir = ./.;
33+ dependencies =
34+ with purs-nix.ps-pkgs;
35+ [
36+ prelude
37+ option
38+ ];
39+ inherit purescript nodejs;
40+ };
41+ # helpers
42+ hooks = inputs.hooks.lib.${system}.run {
43+ src = ./src;
44+ hooks = {
45+ # hook for frontend
46+ purs-tidy = {
47+ enable = true;
48+ package = purs-tidy;
49+ };
50+ };
51+ };
52+ in
53+ {
54+ packages.default = ps.bundle { };
55+
56+ devShells.default = pkgs.mkShell {
57+ packages = with pkgs; [
58+ # TODO remove compiled output from the repo
59+ (ps.command { })
60+ purescript-language-server
61+ ];
62+ shellHook = ''
63+ ${hooks.shellHook}
64+ shopt -s expand_aliases
65+ alias log_='printf "\033[1;32m%s\033[0m\n" "$@"'
66+ alias info_='printf "\033[1;34m[INFO] %s\033[0m\n" "$@"'
67+ alias warn_='printf "\033[1;33m[WARN] %s\033[0m\n" "$@"'
68+
69+ log_ "Welcome to TypeApp shell."
70+ info_ "Available commands: purs-nix"
71+ '';
72+ };
73+ });
74+ nixConfig = {
75+ accept-flake-config = true;
76+ extra-experimental-features = "nix-command flakes";
77+ };
78+}
src/Data/Reflectable/TypeApp.pursnew file+8
@@ -0,0 +1,8 @@
1+module Data.Reflectable.TypeApp where
2+
3+import Data.Reflectable (class Reflectable)
4+import Data.Reflectable as Reflectable
5+import TypeApp (vta)
6+
7+reflectType :: forall @v t. Reflectable v t => t
8+reflectType = vta @v Reflectable.reflectType
src/Data/Symbol/TypeApp.pursnew file+8
@@ -0,0 +1,8 @@
1+module Data.Symbol.TypeApp (reflectSymbol) where
2+
3+import Data.Symbol (class IsSymbol)
4+import Data.Symbol as Data.Symbol
5+import TypeApp (vta)
6+
7+reflectSymbol :: forall (@sym ∷ Symbol). IsSymbol sym => String
8+reflectSymbol = vta @sym Data.Symbol.reflectSymbol
src/Option/TypeApp.pursnew file+12
@@ -0,0 +1,12 @@
1+module Option.TypeApp where
2+
3+import Data.Symbol (class IsSymbol)
4+import Data.Maybe (Maybe)
5+import Prim.Row (class Cons)
6+import Option (Option)
7+import Option as Option
8+import TypeApp (vta)
9+
10+get :: forall r r' (@l :: Symbol) a. IsSymbol l => Cons l a r' r => Option r -> Maybe a
11+get = vta @l Option.get
12+
src/Record/Builder/TypeApp.pursnew file+12
@@ -0,0 +1,12 @@
1+module Record.Builder.TypeApp
2+ ( insert
3+ ) where
4+
5+import Record.Builder (Builder)
6+import Record.Builder as Builder
7+import Data.Symbol (class IsSymbol)
8+import TypeApp (vta)
9+import Prim.Row (class Cons, class Lacks)
10+
11+insert :: forall (@l :: Symbol) a r1 r2. Cons l a r1 r2 => Lacks l r1 => IsSymbol l => a -> Builder (Record r1) (Record r2)
12+insert = vta @l Builder.insert
src/Record/TypeApp.pursnew file+19
@@ -0,0 +1,19 @@
1+module Record.TypeApp
2+ ( get
3+ , modify
4+ , set
5+ ) where
6+
7+import Record as Record
8+import Data.Symbol (class IsSymbol)
9+import TypeApp (vta)
10+import Prim.Row (class Cons)
11+
12+get :: forall r r' (@l :: Symbol) a. IsSymbol l => Cons l a r' r => Record r -> a
13+get = vta @l Record.get
14+
15+modify :: forall r1 r2 r (@l ∷ Symbol) a b. IsSymbol l ⇒ Cons l a r r1 ⇒ Cons l b r r2 ⇒ (a → b) → Record r1 → Record r2
16+modify = vta @l Record.modify
17+
18+set :: forall r1 r2 r (@l ∷ Symbol) a b. IsSymbol l ⇒ Cons l a r r1 ⇒ Cons l b r r2 ⇒ b → Record r1 → Record r2
19+set = vta @l Record.set
src/TypeApp.pursnew file+9
@@ -0,0 +1,9 @@
1+module TypeApp (p, vta) where
2+
3+import Type.Proxy (Proxy(Proxy))
4+
5+p :: forall k (@l :: k). Proxy l
6+p = Proxy
7+
8+vta :: forall @l a. (Proxy l -> a) -> a
9+vta f = f p