From 0ba475fd836a42aa2ab6f3d1a58384cc9a78e43f Mon Sep 17 00:00:00 2001 From: Maciej Jur Date: Sun, 5 Nov 2023 15:01:47 +0100 Subject: [PATCH] content: typeclasses --- package.json | 8 +- pnpm-lock.yaml | 233 +++++++++--------- src/content/posts/typeclasses.md | 192 +++++++++++++++ .../posts/writing-code-considered-harmful.md | 2 +- src/content/wiki/japanese/reading-two.md | 6 + src/content/wiki/japanese/tachi.md | 5 +- src/utils/remark/bib.ts | 2 +- 7 files changed, 319 insertions(+), 129 deletions(-) create mode 100644 src/content/posts/typeclasses.md create mode 100644 src/content/wiki/japanese/reading-two.md diff --git a/package.json b/package.json index 1445aa8..267de1b 100644 --- a/package.json +++ b/package.json @@ -15,10 +15,10 @@ "@astrojs/solid-js": "^3.0.2", "@citation-js/plugin-bibtex": "^0.7.2", "@js-temporal/polyfill": "^0.4.4", - "astro": "^3.4.0", + "astro": "^3.4.3", "astro-pagefind": "^1.3.0", "chart.js": "^4.4.0", - "citation-js": "^0.7.1", + "citation-js": "^0.7.4", "dayjs": "^1.11.10", "leaflet": "^1.9.4", "leaflet.markercluster": "^1.5.3", @@ -33,8 +33,8 @@ "remark-math": "^5.1.1", "remark-parse": "^11.0.0", "remark-rehype": "^11.0.0", - "reveal.js": "^5.0.0", - "solid-js": "^1.8.4", + "reveal.js": "^5.0.1", + "solid-js": "^1.8.5", "unified": "^11.0.4", "unist-util-visit": "^5.0.0" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f72c3af..f3a1cc3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7,10 +7,10 @@ settings: dependencies: '@astrojs/mdx': specifier: ^1.1.3 - version: 1.1.3(astro@3.4.0) + version: 1.1.3(astro@3.4.3) '@astrojs/solid-js': specifier: ^3.0.2 - version: 3.0.2(solid-js@1.8.4)(vite@4.5.0) + version: 3.0.2(solid-js@1.8.5)(vite@4.5.0) '@citation-js/plugin-bibtex': specifier: ^0.7.2 version: 0.7.2(@citation-js/core@0.7.1) @@ -18,17 +18,17 @@ dependencies: specifier: ^0.4.4 version: 0.4.4 astro: - specifier: ^3.4.0 - version: 3.4.0(sass@1.69.5) + specifier: ^3.4.3 + version: 3.4.3(sass@1.69.5) astro-pagefind: specifier: ^1.3.0 - version: 1.3.0(astro@3.4.0) + version: 1.3.0(astro@3.4.3) chart.js: specifier: ^4.4.0 version: 4.4.0 citation-js: - specifier: ^0.7.1 - version: 0.7.1 + specifier: ^0.7.4 + version: 0.7.4 dayjs: specifier: ^1.11.10 version: 1.11.10 @@ -72,11 +72,11 @@ dependencies: specifier: ^11.0.0 version: 11.0.0 reveal.js: - specifier: ^5.0.0 - version: 5.0.0 + specifier: ^5.0.1 + version: 5.0.1 solid-js: - specifier: ^1.8.4 - version: 1.8.4 + specifier: ^1.8.5 + version: 1.8.5 unified: specifier: ^11.0.4 version: 11.0.4 @@ -117,23 +117,23 @@ packages: '@jridgewell/trace-mapping': 0.3.20 dev: false - /@astrojs/compiler@2.2.1: - resolution: {integrity: sha512-NJ1lWKzMkyEjE3W5NpPNAVot4/PLF5om/P6ekxNu3iLS05CaYFTcp7WpYMjdCC252b7wkNVAs45FNkVQ+RHW/g==} + /@astrojs/compiler@2.2.2: + resolution: {integrity: sha512-nJaEgq0EP1mybaW1PvNnnp4RxVQnaLajUYnqrqxFbIdu1ELbH6OxNuAJWI+/q9TbMP6NG/eK6WRMhQsxX6qkUQ==} dev: false /@astrojs/internal-helpers@0.2.1: resolution: {integrity: sha512-06DD2ZnItMwUnH81LBLco3tWjcZ1lGU9rLCCBaeUCGYe9cI0wKyY2W3kDyoW1I6GmcWgt1fu+D1CTvz+FIKf8A==} dev: false - /@astrojs/markdown-remark@3.3.0(astro@3.4.0): + /@astrojs/markdown-remark@3.3.0(astro@3.4.3): resolution: {integrity: sha512-ezFzEiZygc/ASe2Eul9v1yrTbNGqSbR348UGNXQ4Dtkx8MYRwfiBfmPm6VnEdfIGkW+bi5qIUReKfc7mPVUkIg==} peerDependencies: astro: ^3.3.0 dependencies: '@astrojs/prism': 3.0.0 - astro: 3.4.0(sass@1.69.5) + astro: 3.4.3(sass@1.69.5) github-slugger: 2.0.0 - import-meta-resolve: 3.0.0 + import-meta-resolve: 3.1.1 mdast-util-definitions: 6.0.0 rehype-raw: 6.1.1 rehype-stringify: 9.0.4 @@ -141,7 +141,7 @@ packages: remark-parse: 10.0.2 remark-rehype: 10.1.0 remark-smartypants: 2.0.0 - shikiji: 0.6.10 + shikiji: 0.6.12 unified: 10.1.2 unist-util-visit: 4.1.2 vfile: 5.3.7 @@ -149,16 +149,16 @@ packages: - supports-color dev: false - /@astrojs/mdx@1.1.3(astro@3.4.0): + /@astrojs/mdx@1.1.3(astro@3.4.3): resolution: {integrity: sha512-5U5l6bCmywF2IOO8T7oIeStrRB16cxlGCz02U2akpEkLw93dmn5QcHjr4Cwem0bSKROEjYqZ7DxN8t8YAAV2qA==} engines: {node: '>=18.14.1'} peerDependencies: astro: ^3.3.4 dependencies: - '@astrojs/markdown-remark': 3.3.0(astro@3.4.0) + '@astrojs/markdown-remark': 3.3.0(astro@3.4.3) '@mdx-js/mdx': 2.3.0 acorn: 8.11.2 - astro: 3.4.0(sass@1.69.5) + astro: 3.4.3(sass@1.69.5) es-module-lexer: 1.3.1 estree-util-visit: 1.2.1 github-slugger: 2.0.0 @@ -182,14 +182,14 @@ packages: prismjs: 1.29.0 dev: false - /@astrojs/solid-js@3.0.2(solid-js@1.8.4)(vite@4.5.0): + /@astrojs/solid-js@3.0.2(solid-js@1.8.5)(vite@4.5.0): resolution: {integrity: sha512-BGTtS/ygAlcopELdjgTURHnxS2AoDRKjpu3Dgp12TOcArBMCiI/rYdHtlB+ligMm9Bbvar8qdzXsT1zlrxK5jQ==} engines: {node: '>=18.14.1'} peerDependencies: solid-js: ^1.4.3 dependencies: - solid-js: 1.8.4 - vite-plugin-solid: 2.7.2(solid-js@1.8.4)(vite@4.5.0) + solid-js: 1.8.5 + vite-plugin-solid: 2.7.2(solid-js@1.8.5)(vite@4.5.0) transitivePeerDependencies: - supports-color - vite @@ -544,18 +544,18 @@ packages: to-fast-properties: 2.0.0 dev: false - /@citation-js/cli@0.7.1: - resolution: {integrity: sha512-fT/hLCI/2HAgcsO7lp5TE1xstMlbSTqMW6FUTIZp8Oj7/JD+S6wIVnW8lEQk4xSJJPMtcqxwMPOSbVuiUShE5Q==} + /@citation-js/cli@0.7.4: + resolution: {integrity: sha512-EB+xAJX1I2eyfRNMfoAEnNAjDHLz63SFE82NAQGFEjRgDiKHrPPVpLeHZrf3KDY3XFGDg2S73WTw4pPvpwcZ9Q==} engines: {node: '>=16.0.0'} hasBin: true dependencies: '@citation-js/core': 0.7.1 - '@citation-js/plugin-bibjson': 0.7.1(@citation-js/core@0.7.1) + '@citation-js/plugin-bibjson': 0.7.2(@citation-js/core@0.7.1) '@citation-js/plugin-bibtex': 0.7.2(@citation-js/core@0.7.1) - '@citation-js/plugin-csl': 0.7.1(@citation-js/core@0.7.1) - '@citation-js/plugin-doi': 0.7.1(@citation-js/core@0.7.1) - '@citation-js/plugin-ris': 0.7.1(@citation-js/core@0.7.1) - '@citation-js/plugin-wikidata': 0.7.1(@citation-js/core@0.7.1) + '@citation-js/plugin-csl': 0.7.2(@citation-js/core@0.7.1) + '@citation-js/plugin-doi': 0.7.2(@citation-js/core@0.7.1) + '@citation-js/plugin-ris': 0.7.4(@citation-js/core@0.7.1) + '@citation-js/plugin-wikidata': 0.7.2(@citation-js/core@0.7.1) commander: 11.1.0 transitivePeerDependencies: - encoding @@ -583,8 +583,8 @@ packages: engines: {node: '>=6'} dev: false - /@citation-js/plugin-bibjson@0.7.1(@citation-js/core@0.7.1): - resolution: {integrity: sha512-5JnISRx9/V+dBNpHt1qoSuvojqSip7+7FvdI1CFVEo9usLaOfEzfHc2E7BlwUum993t3yJJtRdh9ClnGtutyaw==} + /@citation-js/plugin-bibjson@0.7.2(@citation-js/core@0.7.1): + resolution: {integrity: sha512-RW2kVcdPX2XeslRcWT6sGTQZgo9JdN3BqvH8cjrIkmaH8ws21C83Oxl7J0B/7cqxT1CL836bg4TXq7gRbMGIzg==} engines: {node: '>=16.0.0'} peerDependencies: '@citation-js/core': ^0.7.0 @@ -594,18 +594,6 @@ packages: '@citation-js/name': 0.4.2 dev: false - /@citation-js/plugin-bibtex@0.7.1(@citation-js/core@0.7.1): - resolution: {integrity: sha512-dj/GzpceS/QNbU8+rVzJfXeli7XSTYVTltGv5w2RHM+CCOdtG3tiFP1Ohu3yWi+8VPMjQJG9u2W789grIqc/ng==} - engines: {node: '>=16.0.0'} - peerDependencies: - '@citation-js/core': ^0.7.0 - dependencies: - '@citation-js/core': 0.7.1 - '@citation-js/date': 0.5.1 - '@citation-js/name': 0.4.2 - moo: 0.5.2 - dev: false - /@citation-js/plugin-bibtex@0.7.2(@citation-js/core@0.7.1): resolution: {integrity: sha512-QkgPfYbs1dierenxKWzIlPV7450Jci8bvZbcpjO3HQTfTaj15SV2C2AaeKhUotXZmTjm49AJQWHZtrNh+7YWjg==} engines: {node: '>=16.0.0'} @@ -618,8 +606,8 @@ packages: moo: 0.5.2 dev: false - /@citation-js/plugin-csl@0.7.1(@citation-js/core@0.7.1): - resolution: {integrity: sha512-B5Yv1o04Ds8/PF3FYlfL7bL3LFpVUhCEOAEqLFN5qgk785dnU0gMhDYbpJuCbQ8P6lIQpoU7O5x+EcJvWQhqCA==} + /@citation-js/plugin-csl@0.7.2(@citation-js/core@0.7.1): + resolution: {integrity: sha512-ogNb/gdcZ/EXZq+We+/aw6RkiYxjF+h7myJypyR0PApGJq9GzwcfGHW9ded2JdQIxyz4fO46pCTR4nv6FPUvMA==} engines: {node: '>=16.0.0'} peerDependencies: '@citation-js/core': ^0.7.0 @@ -629,8 +617,8 @@ packages: citeproc: 2.4.63 dev: false - /@citation-js/plugin-doi@0.7.1(@citation-js/core@0.7.1): - resolution: {integrity: sha512-CXZnZ8GIEFYAe3T5Dp4mNkmdi5cYkPGIVByt1MNrOsjNjcXTcNoEqV6jAYwxjws+WDksiS3g7C5oVYUMEcERgA==} + /@citation-js/plugin-doi@0.7.2(@citation-js/core@0.7.1): + resolution: {integrity: sha512-gHwDZp3s3rqIYvO44Te4oFeYrPC3b3MpWRi+2NR3wtsZlqdAgJGFH3fw5O39HF2S09lXoky+Eo6W12Fc7LVGZw==} engines: {node: '>=16.0.0'} peerDependencies: '@citation-js/core': ^0.7.0 @@ -639,8 +627,8 @@ packages: '@citation-js/date': 0.5.1 dev: false - /@citation-js/plugin-ris@0.7.1(@citation-js/core@0.7.1): - resolution: {integrity: sha512-u18gC1bsX7JrT4i3BUeQkGZSq+UQ+AIjRs/zX35/F5Vi7OYTBcrfWWcZSJj1GJatin6vNXxaHZrwaVHq8LJuww==} + /@citation-js/plugin-ris@0.7.4(@citation-js/core@0.7.1): + resolution: {integrity: sha512-8tqZPPiQ0XggHZCEvZSF4ssAi14xDzJo16hnE4xIuL/+Xk8WSbohscHaeroZLYpzkIZa+Qzq3o8r0g50H2hXTg==} engines: {node: '>=16.0.0'} peerDependencies: '@citation-js/core': ^0.7.0 @@ -650,8 +638,8 @@ packages: '@citation-js/name': 0.4.2 dev: false - /@citation-js/plugin-wikidata@0.7.1(@citation-js/core@0.7.1): - resolution: {integrity: sha512-7wkjbLtt9n4pcvhy2dDIJWBgKejIoUZ3TJtYe6eQ5hCkgijZ8ZR6zNB/yfIL8bDoJTvWDLqlENUXpk3vfzRYsw==} + /@citation-js/plugin-wikidata@0.7.2(@citation-js/core@0.7.1): + resolution: {integrity: sha512-OAm0vArh+VP/74pZaf3pJ1AI4iO4e10MEN0PWb0g4qf1ccKDLyy2uzsDcgdJonEA0iiRTUNfrpIfDDEXEOEMmg==} engines: {node: '>=16.0.0'} peerDependencies: '@citation-js/core': ^0.7.0 @@ -1196,7 +1184,7 @@ packages: /@types/acorn@4.0.6: resolution: {integrity: sha512-veQTnWP+1D/xbxVrPC3zHnCZRjSrKfhbMUlEA43iMZLu7EsnTtkJklIuwrCPbOi8YkvDQAiW05VQQFvvz9oieQ==} dependencies: - '@types/estree': 1.0.3 + '@types/estree': 1.0.4 dev: false /@types/babel__core@7.20.3: @@ -1237,11 +1225,11 @@ packages: /@types/estree-jsx@1.0.2: resolution: {integrity: sha512-GNBWlGBMjiiiL5TSkvPtOteuXsiVitw5MYGY1UYlrAq0SKyczsls6sCD7TZ8fsjRsvCVxml7EbyjJezPb3DrSA==} dependencies: - '@types/estree': 1.0.3 + '@types/estree': 1.0.4 dev: false - /@types/estree@1.0.3: - resolution: {integrity: sha512-CS2rOaoQ/eAgAfcTfq6amKG7bsN+EMcgGY4FAFQdvSj2y1ixvOZTUA9mOtCai7E1SYu283XNw7urKK30nP3wkQ==} + /@types/estree@1.0.4: + resolution: {integrity: sha512-2JwWnHK9H+wUZNorf2Zr6ves96WHoWDJIftkcxPKsS7Djta6Zu519LarhRNljPXkpsZR2ZMwNCPeW7omW07BJw==} dev: false /@types/geojson@7946.0.12: @@ -1393,25 +1381,25 @@ packages: hasBin: true dev: false - /astro-pagefind@1.3.0(astro@3.4.0): + /astro-pagefind@1.3.0(astro@3.4.3): resolution: {integrity: sha512-7VqoJnaW301KY+mjf1cGJTfKNI+zjdYxDXtBIE6aD77NKNPrOjxIXllt9Fo3wU84z1sNmaI+LwzK6S0Zm8t9RQ==} peerDependencies: astro: ^2.0.4 || ^3.0.0 dependencies: '@pagefind/default-ui': 1.0.3 - astro: 3.4.0(sass@1.69.5) + astro: 3.4.3(sass@1.69.5) pagefind: 1.0.3 sirv: 2.0.3 dev: false - /astro@3.4.0(sass@1.69.5): - resolution: {integrity: sha512-nTOFxrPOnmACl8noTPkRJkaEOMx4wZy4QCLB2aDL3Lm+AiEaVcgH7YQ4GpCl72zSNXp/A7hGdUgcXbC4XYHOCQ==} + /astro@3.4.3(sass@1.69.5): + resolution: {integrity: sha512-6zcONz2FjX6GaAy6Mysie4gT8rH5QCBXyPjkuYZKiPdV+sXmDpLm44J2MpQwA3mHb8YQ35L5O4nNg09d4luQ7g==} engines: {node: '>=18.14.1', npm: '>=6.14.0'} hasBin: true dependencies: - '@astrojs/compiler': 2.2.1 + '@astrojs/compiler': 2.2.2 '@astrojs/internal-helpers': 0.2.1 - '@astrojs/markdown-remark': 3.3.0(astro@3.4.0) + '@astrojs/markdown-remark': 3.3.0(astro@3.4.3) '@astrojs/telemetry': 3.0.4 '@babel/core': 7.23.2 '@babel/generator': 7.23.0 @@ -1443,6 +1431,7 @@ packages: js-yaml: 4.1.0 kleur: 4.1.5 magic-string: 0.30.5 + mdast-util-to-hast: 12.3.0 mime: 3.0.0 ora: 7.0.1 p-limit: 4.0.0 @@ -1455,7 +1444,7 @@ packages: resolve: 1.22.8 semver: 7.5.4 server-destroy: 1.0.1 - shikiji: 0.6.10 + shikiji: 0.6.12 string-width: 6.1.0 strip-ansi: 7.1.0 tsconfck: 3.0.0 @@ -1465,7 +1454,7 @@ packages: vitefu: 0.2.5(vite@4.5.0) which-pm: 2.1.1 yargs-parser: 21.1.1 - zod: 3.21.1 + zod: 3.22.4 optionalDependencies: sharp: 0.32.6 transitivePeerDependencies: @@ -1556,8 +1545,8 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001557 - electron-to-chromium: 1.4.569 + caniuse-lite: 1.0.30001559 + electron-to-chromium: 1.4.576 node-releases: 2.0.13 update-browserslist-db: 1.0.13(browserslist@4.22.1) dev: false @@ -1580,8 +1569,8 @@ packages: engines: {node: '>=14.16'} dev: false - /caniuse-lite@1.0.30001557: - resolution: {integrity: sha512-91oR7hLNUP3gG6MLU+n96em322a8Xzes8wWdBKhLgUoiJsAF5irZnxSUCbc+qUZXNnPCfUwLOi9ZCZpkvjQajw==} + /caniuse-lite@1.0.30001559: + resolution: {integrity: sha512-cPiMKZgqgkg5LY3/ntGeLFUpi6tzddBNS58A4tnTgQw1zON7u2sZMU7SzOeVH4tj20++9ggL+V6FDOFMTaFFYA==} dev: false /ccount@2.0.1: @@ -1652,21 +1641,21 @@ packages: engines: {node: '>=8'} dev: false - /citation-js@0.7.1: - resolution: {integrity: sha512-T6doY/BLRjNHTavbdwyk+UNF5LyeC0QzHS1vSIMssEpyBkgb8Ub78Z/aeBIQ3KjuGV9fUXZMKZbDl6Eo96w8nw==} + /citation-js@0.7.4: + resolution: {integrity: sha512-QLHsRQ02ypWXkv95PGeqOqlOpZZN6X2ZGftKyQ+n77u38hV2q7pxNghHSaL8mlRAotKFLi1CPQOm2D/83pcBdQ==} engines: {node: '>=14'} hasBin: true dependencies: - '@citation-js/cli': 0.7.1 + '@citation-js/cli': 0.7.4 '@citation-js/core': 0.7.1 '@citation-js/date': 0.5.1 '@citation-js/name': 0.4.2 - '@citation-js/plugin-bibjson': 0.7.1(@citation-js/core@0.7.1) - '@citation-js/plugin-bibtex': 0.7.1(@citation-js/core@0.7.1) - '@citation-js/plugin-csl': 0.7.1(@citation-js/core@0.7.1) - '@citation-js/plugin-doi': 0.7.1(@citation-js/core@0.7.1) - '@citation-js/plugin-ris': 0.7.1(@citation-js/core@0.7.1) - '@citation-js/plugin-wikidata': 0.7.1(@citation-js/core@0.7.1) + '@citation-js/plugin-bibjson': 0.7.2(@citation-js/core@0.7.1) + '@citation-js/plugin-bibtex': 0.7.2(@citation-js/core@0.7.1) + '@citation-js/plugin-csl': 0.7.2(@citation-js/core@0.7.1) + '@citation-js/plugin-doi': 0.7.2(@citation-js/core@0.7.1) + '@citation-js/plugin-ris': 0.7.4(@citation-js/core@0.7.1) + '@citation-js/plugin-wikidata': 0.7.2(@citation-js/core@0.7.1) citeproc: 2.4.63 transitivePeerDependencies: - encoding @@ -1865,8 +1854,8 @@ packages: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} dev: false - /electron-to-chromium@1.4.569: - resolution: {integrity: sha512-LsrJjZ0IbVy12ApW3gpYpcmHS3iRxH4bkKOW98y1/D+3cvDUWGcbzbsFinfUS8knpcZk/PG/2p/RnkMCYN7PVg==} + /electron-to-chromium@1.4.576: + resolution: {integrity: sha512-yXsZyXJfAqzWk1WKryr0Wl0MN2D47xodPvEEwlVePBnhU5E7raevLQR+E6b9JAD3GfL/7MbAL9ZtWQQPcLx7wA==} dev: false /emoji-regex@10.3.0: @@ -1987,7 +1976,7 @@ packages: /estree-util-attach-comments@2.1.1: resolution: {integrity: sha512-+5Ba/xGGS6mnwFbXIuQiDPTbuTxuMCooq3arVv7gPZtYpjp+VXH/NkHAP35OOefPhNG/UGqU3vt/LTABwcHX0w==} dependencies: - '@types/estree': 1.0.3 + '@types/estree': 1.0.4 dev: false /estree-util-build-jsx@2.2.2: @@ -2020,7 +2009,7 @@ packages: /estree-walker@3.0.3: resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} dependencies: - '@types/estree': 1.0.3 + '@types/estree': 1.0.4 dev: false /eventemitter3@5.0.1: @@ -2216,7 +2205,7 @@ packages: '@types/hast': 2.3.7 '@types/unist': 2.0.9 hastscript: 7.2.0 - property-information: 6.3.0 + property-information: 6.4.0 vfile: 5.3.7 vfile-location: 4.1.0 web-namespaces: 2.0.1 @@ -2229,7 +2218,7 @@ packages: '@types/unist': 3.0.1 devlop: 1.1.0 hastscript: 8.0.0 - property-information: 6.3.0 + property-information: 6.4.0 vfile: 6.0.1 vfile-location: 5.0.2 web-namespaces: 2.0.1 @@ -2290,7 +2279,7 @@ packages: /hast-util-to-estree@2.3.3: resolution: {integrity: sha512-ihhPIUPxN0v0w6M5+IiAZZrn0LH2uZomeWwhn7uP7avZC6TE7lIiEh2yBMPr5+zi1aUCXq6VoYRgs2Bw9xmycQ==} dependencies: - '@types/estree': 1.0.3 + '@types/estree': 1.0.4 '@types/estree-jsx': 1.0.2 '@types/hast': 2.3.7 '@types/unist': 2.0.9 @@ -2300,7 +2289,7 @@ packages: hast-util-whitespace: 2.0.1 mdast-util-mdx-expression: 1.3.2 mdast-util-mdxjs-esm: 1.3.1 - property-information: 6.3.0 + property-information: 6.4.0 space-separated-tokens: 2.0.2 style-to-object: 0.4.4 unist-util-position: 4.0.4 @@ -2319,7 +2308,7 @@ packages: hast-util-raw: 7.2.3 hast-util-whitespace: 2.0.1 html-void-elements: 2.0.1 - property-information: 6.3.0 + property-information: 6.4.0 space-separated-tokens: 2.0.2 stringify-entities: 4.0.3 zwitch: 2.0.4 @@ -2336,7 +2325,7 @@ packages: hast-util-whitespace: 3.0.0 html-void-elements: 3.0.0 mdast-util-to-hast: 13.0.2 - property-information: 6.3.0 + property-information: 6.4.0 space-separated-tokens: 2.0.2 stringify-entities: 4.0.3 zwitch: 2.0.4 @@ -2347,7 +2336,7 @@ packages: dependencies: '@types/hast': 2.3.7 comma-separated-tokens: 2.0.3 - property-information: 6.3.0 + property-information: 6.4.0 space-separated-tokens: 2.0.2 web-namespaces: 2.0.1 zwitch: 2.0.4 @@ -2359,7 +2348,7 @@ packages: '@types/hast': 3.0.2 comma-separated-tokens: 2.0.3 devlop: 1.1.0 - property-information: 6.3.0 + property-information: 6.4.0 space-separated-tokens: 2.0.2 web-namespaces: 2.0.1 zwitch: 2.0.4 @@ -2390,7 +2379,7 @@ packages: '@types/hast': 2.3.7 comma-separated-tokens: 2.0.3 hast-util-parse-selector: 3.1.1 - property-information: 6.3.0 + property-information: 6.4.0 space-separated-tokens: 2.0.2 dev: false @@ -2400,7 +2389,7 @@ packages: '@types/hast': 3.0.2 comma-separated-tokens: 2.0.3 hast-util-parse-selector: 4.0.0 - property-information: 6.3.0 + property-information: 6.4.0 space-separated-tokens: 2.0.2 dev: false @@ -2442,8 +2431,8 @@ packages: /immutable@4.3.4: resolution: {integrity: sha512-fsXeu4J4i6WNWSikpI88v/PcVflZz+6kMhUfIwc5SY+poQRPnaf5V7qds6SUyUN3cVxEzuCab7QIoLOQ+DQ1wA==} - /import-meta-resolve@3.0.0: - resolution: {integrity: sha512-4IwhLhNNA8yy445rPjD/lWh++7hMDOml2eHtd58eG7h+qK3EryMuuRbsHGPikCoAgIkkDnckKfWSk2iDla/ejg==} + /import-meta-resolve@3.1.1: + resolution: {integrity: sha512-qeywsE/KC3w9Fd2ORrRDUw6nS/nLwZpXgfrOc2IILvZYnCaEMd+D56Vfg9k4G29gIeVi3XKql1RQatME8iYsiw==} dev: false /inherits@2.0.4: @@ -2546,7 +2535,7 @@ packages: /is-reference@3.0.2: resolution: {integrity: sha512-v3rht/LgVcsdZa3O2Nqs+NMowLOxeOm7Ay9+/ARQ2F+qEoANRcqrjAZKGN0v8ymUetZGgkp26LTnGT7H0Qo9Pg==} dependencies: - '@types/estree': 1.0.3 + '@types/estree': 1.0.4 dev: false /is-stream@3.0.0: @@ -3293,7 +3282,7 @@ packages: /micromark-extension-mdx-expression@1.0.8: resolution: {integrity: sha512-zZpeQtc5wfWKdzDsHRBY003H2Smg+PUi2REhqgIhdzAa5xonhP03FcXxqFSerFiNUr5AWmHpaNPQTBVOS4lrXw==} dependencies: - '@types/estree': 1.0.3 + '@types/estree': 1.0.4 micromark-factory-mdx-expression: 1.0.9 micromark-factory-space: 1.1.0 micromark-util-character: 1.2.0 @@ -3307,7 +3296,7 @@ packages: resolution: {integrity: sha512-gPH+9ZdmDflbu19Xkb8+gheqEDqkSpdCEubQyxuz/Hn8DOXiXvrXeikOoBA71+e8Pfi0/UYmU3wW3H58kr7akA==} dependencies: '@types/acorn': 4.0.6 - '@types/estree': 1.0.3 + '@types/estree': 1.0.4 estree-util-is-identifier-name: 2.1.0 micromark-factory-mdx-expression: 1.0.9 micromark-factory-space: 1.1.0 @@ -3327,7 +3316,7 @@ packages: /micromark-extension-mdxjs-esm@1.0.5: resolution: {integrity: sha512-xNRBw4aoURcyz/S69B19WnZAkWJMxHMT5hE36GtDAyhoyn/8TuAeqjFJQlwk+MKQsUD7b3l7kFX+vlfVWgcX1w==} dependencies: - '@types/estree': 1.0.3 + '@types/estree': 1.0.4 micromark-core-commonmark: 1.1.0 micromark-util-character: 1.2.0 micromark-util-events-to-acorn: 1.2.3 @@ -3388,7 +3377,7 @@ packages: /micromark-factory-mdx-expression@1.0.9: resolution: {integrity: sha512-jGIWzSmNfdnkJq05c7b0+Wv0Kfz3NJ3N4cBjnbO4zjXIlxJr+f8lk+5ZmwFvqdAbUy2q6B5rCY//g0QAAaXDWA==} dependencies: - '@types/estree': 1.0.3 + '@types/estree': 1.0.4 micromark-util-character: 1.2.0 micromark-util-events-to-acorn: 1.2.3 micromark-util-symbol: 1.1.0 @@ -3546,7 +3535,7 @@ packages: resolution: {integrity: sha512-ij4X7Wuc4fED6UoLWkmo0xJQhsktfNh1J0m8g4PbIMPlx+ek/4YdW5mvbye8z/aZvAPUoxgXHrwVlXAPKMRp1w==} dependencies: '@types/acorn': 4.0.6 - '@types/estree': 1.0.3 + '@types/estree': 1.0.4 '@types/unist': 2.0.9 estree-util-visit: 1.2.1 micromark-util-symbol: 1.1.0 @@ -3983,7 +3972,7 @@ packages: /periscopic@3.1.0: resolution: {integrity: sha512-vKiQ8RRtkl9P+r/+oefh25C3fhybptkHKCZSPlcXiJux2tJF55GnEj3BVn4A5gKfq9NWWXXrxkHBwVPUfH0opw==} dependencies: - '@types/estree': 1.0.3 + '@types/estree': 1.0.4 estree-walker: 3.0.3 is-reference: 3.0.2 dev: false @@ -4068,8 +4057,8 @@ packages: sisteransi: 1.0.5 dev: false - /property-information@6.3.0: - resolution: {integrity: sha512-gVNZ74nqhRMiIUYWGQdosYetaKc83x8oT41a0LlV3AAFCAZwCpg4vmGkq8t34+cUhp3cnM4XDiU/7xlgK7HGrg==} + /property-information@6.4.0: + resolution: {integrity: sha512-9t5qARVofg2xQqKtytzt+lZ4d1Qvj8t5B8fEwXK6qOfgRLgH/b13QlgEyDh033NOS31nXeFbYv7CLUDG1CeifQ==} dev: false /pump@3.0.0: @@ -4354,9 +4343,9 @@ packages: engines: {iojs: '>=1.0.0', node: '>=0.10.0'} dev: false - /reveal.js@5.0.0: - resolution: {integrity: sha512-GXbW7GVJxgJh5szlh/jnifAMt9KBDh7Q4Or+v0q1hIaddn6vr4cvUFxoYsAfa5Hmw2G+6fIwZCDf3firB5FJHg==} - engines: {node: '>=10.0.0'} + /reveal.js@5.0.1: + resolution: {integrity: sha512-cgbEasV/Yh8QIRyCCiOHRtio6uxAwmOAhyr80vegX2P69/iwE1FX77EXJ9NAPvcODxoIyYrgvxAaPxR5TKcsFw==} + engines: {node: '>=18.0.0'} dev: false /rollup@3.29.4: @@ -4420,8 +4409,8 @@ packages: dependencies: lru-cache: 6.0.0 - /seroval@0.12.0: - resolution: {integrity: sha512-5qvk9WRORhvOdHVtDv6KEKrTDbG8O9nODDdETfQcJ0u9iaZJ6mAASg/nQgPzqtuV9cqln9msE7WNmD+sJomrIw==} + /seroval@0.12.3: + resolution: {integrity: sha512-5WDeMpv7rmEylsypRj1iwRVHE/QLsMLiZ+9savlNNQEVdgGia1iRMb7qyaAagY0wu/7+QTe6d2wldk/lgaLb6g==} engines: {node: '>=10'} dev: false @@ -4455,8 +4444,8 @@ packages: engines: {node: '>=8'} dev: false - /shikiji@0.6.10: - resolution: {integrity: sha512-WE+A5Y2ntM5hL3iJQujk97qr5Uj7PSIRXpQfrZ6h+JWPXZ8KBEDhFXc4lqNriaRq1WGOVPUT83XMOzmHiH3W8A==} + /shikiji@0.6.12: + resolution: {integrity: sha512-sm7Wg8P4w6T3quDAZQxvk0P02o2hheIFEdbaEuGOhGnqLDjVsP28GDUVPdgbacOIc1auapNVNCVEykhPploLyg==} dependencies: hast-util-to-html: 9.0.0 dev: false @@ -4505,14 +4494,14 @@ packages: unicode-emoji-modifier-base: 1.0.0 dev: false - /solid-js@1.8.4: - resolution: {integrity: sha512-l8tZCa0nA1iyFR+yTZi4cKNktX3UfwT3FbdzDAtNwp40EtabVRf3t0EUN3C3Kokkh7c7nBx8ak/0GZV+KFVSxQ==} + /solid-js@1.8.5: + resolution: {integrity: sha512-xvtJvzJzWbsn35oKFhW9kNwaxG1Z/YLMsDp4tLVcYZTMPzvzQ8vEZuyDQ6nt7xDArVgZJ7TUFrJUwrui/oq53A==} dependencies: csstype: 3.1.2 - seroval: 0.12.0 + seroval: 0.12.3 dev: false - /solid-refresh@0.5.3(solid-js@1.8.4): + /solid-refresh@0.5.3(solid-js@1.8.5): resolution: {integrity: sha512-Otg5it5sjOdZbQZJnvo99TEBAr6J7PQ5AubZLNU6szZzg3RQQ5MX04oteBIIGDs0y2Qv8aXKm9e44V8z+UnFdw==} peerDependencies: solid-js: ^1.3 @@ -4520,7 +4509,7 @@ packages: '@babel/generator': 7.23.0 '@babel/helper-module-imports': 7.22.15 '@babel/types': 7.23.0 - solid-js: 1.8.4 + solid-js: 1.8.5 dev: false /source-map-js@1.0.2: @@ -4555,8 +4544,8 @@ packages: - supports-color dev: false - /streamx@2.15.1: - resolution: {integrity: sha512-fQMzy2O/Q47rgwErk/eGeLu/roaFWV0jVsogDmrszM9uIw8L5OA+t+V93MgYlufNptfjmYR1tOMWhei/Eh7TQA==} + /streamx@2.15.2: + resolution: {integrity: sha512-b62pAV/aeMjUoRN2C/9F0n+G8AfcJjNC0zw/ZmOHeFsIe4m4GzjVW9m6VHXVjk536NbdU9JRwKMJRfkc+zUFTg==} dependencies: fast-fifo: 1.3.2 queue-tick: 1.0.1 @@ -4691,7 +4680,7 @@ packages: dependencies: b4a: 1.6.4 fast-fifo: 1.3.2 - streamx: 2.15.1 + streamx: 2.15.2 /to-fast-properties@2.0.0: resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} @@ -4963,7 +4952,7 @@ packages: vfile-message: 4.0.2 dev: false - /vite-plugin-solid@2.7.2(solid-js@1.8.4)(vite@4.5.0): + /vite-plugin-solid@2.7.2(solid-js@1.8.5)(vite@4.5.0): resolution: {integrity: sha512-GV2SMLAibOoXe76i02AsjAg7sbm/0lngBlERvJKVN67HOrJsHcWgkt0R6sfGLDJuFkv2aBe14Zm4vJcNME+7zw==} peerDependencies: solid-js: ^1.7.2 @@ -4974,8 +4963,8 @@ packages: '@types/babel__core': 7.20.3 babel-preset-solid: 1.8.4(@babel/core@7.23.2) merge-anything: 5.1.7 - solid-js: 1.8.4 - solid-refresh: 0.5.3(solid-js@1.8.4) + solid-js: 1.8.5 + solid-refresh: 0.5.3(solid-js@1.8.5) vite: 4.5.0(sass@1.69.5) vitefu: 0.2.5(vite@4.5.0) transitivePeerDependencies: @@ -5127,8 +5116,8 @@ packages: engines: {node: '>=12.20'} dev: false - /zod@3.21.1: - resolution: {integrity: sha512-+dTu2m6gmCbO9Ahm4ZBDapx2O6ZY9QSPXst2WXjcznPMwf2YNpn3RevLx4KkZp1OPW/ouFcoBtBzFz/LeY69oA==} + /zod@3.22.4: + resolution: {integrity: sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==} dev: false /zwitch@2.0.4: diff --git a/src/content/posts/typeclasses.md b/src/content/posts/typeclasses.md new file mode 100644 index 0000000..4eac7e1 --- /dev/null +++ b/src/content/posts/typeclasses.md @@ -0,0 +1,192 @@ +--- +title: Breaking apart the Haskell type class +date: 2023-11-02T17:28:25.466Z +tags: [haskell] +desc: > + Type classes are perhaps the most distinctive feature of Haskell. + I’ve found them pretty confusing, but in reality they are an incredibly + elegant solution to a certain problem found in functional languages. +--- + +Type classes are perhaps the most distinctive feature of Haskell. +I've found them pretty confusing, but in reality they are an incredibly elegant solution to a certain problem found in functional languages. + +## Why? + +In Haskell, we can write monomorphic functions which accepts concrete types. +As an example, the function `add` shown below adds together two values of type `Int`. + +```haskell +add :: Int -> Int -> Int +add a b = a + b +``` + +We can also create functions which are polymorphic. +The signatures of such functions contain type variables. +As an example, the function `head` shown below has a type variable `a`, which means that it accepts lists of any type `a`. + +```haskell +head :: [a] -> a +head [] = undefined +head (x:_) = x +``` + +However, there are situations where we want to create functions that accept a specific set of different types. +For example, a function should work with both `Int` and `Float` values: + +```haskell +a = 1 :: Int +b = 1 :: Float + +x = add a a +y = add b b + +add :: ? -> ? -> ? +``` + +Using a type variable like `a` in the function's signature would make it too permissive, allowing unintended types like `String`. + +```haskell +add :: a -> a -> a +add a b = a + b + +-- wrong! +x = add "hello" "world" +``` + +To address this issue, Haskell introduces a concept called "type classes". + +```haskell +a = 1 :: Int +b = 1 :: Float + +add :: Num a => a -> a -> a +add a b = a + b +``` + +In this case the types `Int` and `Float` are instances of the `Num` type class. +By specifying the `Num a => ...` constraint in the function's signature, we declare that the function should be polymorphic for instances of the `Num` type class. + +## How it works + +You can visualize a type class as a set of operations defined for a given type. +The `Num` type class, for example, includes operations such as addition, multiplication, and negation: + +```haskell +class Num a where + (+) :: a -> a -> a + (*) :: a -> a -> a + negate :: a -> a + -- etc. + +add :: Num a => a -> a -> a +add a b = a + b +``` + +In this class declaration, each operation is like a record field for the type. +It's as if there's a data type hidden behind the scenes, and each operation is a selector function for that data type: + +```haskell +data Num a = MkNum + (a -> a -> a) + (a -> a -> a) + (a -> a) + -- etc. + +(+) :: Num a -> a -> a -> a +(+) (MkNum f _ _ ...) = f + +add :: Num a -> a -> a -> a +add d a b = (+) d a b +``` + +Effectively, `Num a` serves as a table of operations for the `Num` class for type `a`. +This elegant mechanism allows Haskell to implement polymorphism with type classes while maintaining strict type safety. + + +## Kinds + +A type in Haskell is a classification that defines what kind of data a value can represent. +For example, `Int` is a type that represents integer values, and `Float` is a type for floating-point numbers. + +Kinds are a higher-level classification system for types in Haskell. +Every type in Haskell has a kind, and this kind represents the "type of types". + +The notation for kinds in Haskell uses an asterisk `*` to represent the most basic kind, which corresponds to concrete types. +You can check the kind of any type by using the `:kind` command in GHCi. + +The kind of `Int` is `*`, indicating that `Int` is a concrete type. +```haskell +Int :: * +``` + +Similarly, the kind of `Float` is `*`, signifying that it is also a concrete type. +```haskell +Float :: * +``` + +However, Haskell's type system can go beyond basic types and deal with more complex constructs. +For instance, type classes introduce a kind called `Constraint`, denoted as `=>`. +The kind Constraint is used to represent constraints on types and is commonly encountered when defining type classes and their instances. + +The kind of `Num` is `* -> Constraint`, showing that `Num` is a type class that takes a type (like `Int`) as an argument. +```haskell +Num :: * -> Constraint +``` + +When `Num` is applied to `Int`, it becomes a constraint on the `Int` type, indicating that `Int` is an instance of the `Num` type class. +```haskell +Num Int :: Constraint +``` + +### Higher Kinded Types + +### The venerable monad + +## Other languages + +### Scala + +scala + +### Rust + +rust + + +## Bibliography + +:::bibtex +@inproceedings{10.1145/1238844.1238856, + author = {Hudak, Paul and Hughes, John and Peyton Jones, Simon and Wadler, Philip}, + title = {A History of Haskell: Being Lazy with Class}, + year = {2007}, + isbn = {9781595937667}, + publisher = {Association for Computing Machinery}, + address = {New York, NY, USA}, + url = {https://doi.org/10.1145/1238844.1238856}, + doi = {10.1145/1238844.1238856}, + abstract = {This paper describes the history of Haskell, including its genesis and principles, technical contributions, implementations and tools, and applications and impact.}, + booktitle = {Proceedings of the Third ACM SIGPLAN Conference on History of Programming Languages}, + pages = {12–1–12–55}, + location = {San Diego, California}, + series = {HOPL III} +} + +@online{youtube, + title = {Escape from the ivory tower: the Haskell journey}, + date = {2017}, + organization = {Youtube}, + author = {Simon {Peyton Jones}}, + url = {https://youtu.be/re96UgMk6GQ}, +} + +@book{skinner2023effective, + title = {Effective Haskell: Solving Real-World Problems with Strongly Typed Functional Programming}, + author = {Skinner, R.}, + isbn = {9781680509342}, + series = {Pragmatic Bookshelf}, + year = {2023}, + publisher = {O'Reilly Media} +} +::: diff --git a/src/content/posts/writing-code-considered-harmful.md b/src/content/posts/writing-code-considered-harmful.md index 52bcab0..05e52d9 100644 --- a/src/content/posts/writing-code-considered-harmful.md +++ b/src/content/posts/writing-code-considered-harmful.md @@ -24,7 +24,7 @@ It was a pretty fun and interesting adventure, difficult at times, but worth it ## Bibliography -:::bib +:::bibtex @book{gamma1994design, title = {Design Patterns: Elements of Reusable Object-Oriented Software}, author = {Gamma, E. and Helm, R. and Johnson, R. and Vlissides, J.}, diff --git a/src/content/wiki/japanese/reading-two.md b/src/content/wiki/japanese/reading-two.md new file mode 100644 index 0000000..c2f1878 --- /dev/null +++ b/src/content/wiki/japanese/reading-two.md @@ -0,0 +1,6 @@ +--- +title: 読書 〜 その2 +--- + +- [ ] 東方文果真報 ~ Alternative Facts in Eastern Utopia + diff --git a/src/content/wiki/japanese/tachi.md b/src/content/wiki/japanese/tachi.md index 0d66184..cc16515 100644 --- a/src/content/wiki/japanese/tachi.md +++ b/src/content/wiki/japanese/tachi.md @@ -16,7 +16,10 @@ I've come across 〜達 used for inanimate things several times with one example “目指したトコロは此処だったのか?” 今は先を急ぐ **水達**に乗せられたまま -:::bib + +## Bibliography + +:::bibtex @book{dojg-advanced, title = {A dictionary of advanced Japanese grammar}, author = {Makino, Seiichi and Tsutsui, Michio}, diff --git a/src/utils/remark/bib.ts b/src/utils/remark/bib.ts index de6dc7a..e382f55 100644 --- a/src/utils/remark/bib.ts +++ b/src/utils/remark/bib.ts @@ -10,7 +10,7 @@ function locateBibliography(tree: any) { let bibliography: Maybe = Maybe.empty(); visit(tree, 'containerDirective', (node, index, parent) => { - if (node.name !== 'bib') + if (node.name !== 'bibtex') return CONTINUE; const data = new Cite(toString(node));