Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Commit

Permalink
remove adt (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart committed Aug 23, 2023
1 parent 3092cbd commit 36ca9f9
Show file tree
Hide file tree
Showing 11 changed files with 568 additions and 1,187 deletions.
5 changes: 5 additions & 0 deletions .changeset/shy-jobs-argue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@effect/match": minor
---

remove TaggedEnum/ADT modules (moved to @effect/data/Data)
30 changes: 15 additions & 15 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@ module.exports = {
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2018,
sourceType: "module"
sourceType: "module",
},
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
"@typescript-eslint/parser": [".ts", ".tsx"],
},
"import/resolver": {
typescript: {
alwaysTryTypes: true
}
}
alwaysTryTypes: true,
},
},
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@effect/recommended"
"plugin:@effect/recommended",
],
plugins: [
"deprecation",
"import",
"sort-destructure-keys",
"simple-import-sort",
"codegen"
"codegen",
],
rules: {
"codegen/codegen": "error",
Expand All @@ -50,7 +50,7 @@ module.exports = {
"deprecation/deprecation": "off",
"@typescript-eslint/array-type": [
"warn",
{ default: "generic", readonly: "generic" }
{ default: "generic", readonly: "generic" },
],
"@typescript-eslint/member-delimiter-style": 0,
"@typescript-eslint/no-non-null-assertion": "off",
Expand All @@ -62,8 +62,8 @@ module.exports = {
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_"
}
varsIgnorePattern: "^_",
},
],
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/camelcase": "off",
Expand All @@ -81,9 +81,9 @@ module.exports = {
lineWidth: 80,
semiColons: "asi",
quoteStyle: "alwaysDouble",
"arrowFunction.useParentheses": "force"
}
}
]
}
"arrowFunction.useParentheses": "force",
},
},
],
},
}
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.ts
*.js
5 changes: 0 additions & 5 deletions .prettierrc.json

This file was deleted.

19 changes: 14 additions & 5 deletions examples/bench.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import * as Data from "@effect/data/Data"
import { pipe } from "@effect/data/Function"
import * as Match from "@effect/match"
import type { TaggedEnum } from "@effect/match/TaggedEnum"
import { taggedEnum } from "@effect/match/TaggedEnum"
import benny from "benny"
import { match } from "ts-pattern"

const ABC = taggedEnum<{
type ABC = Data.TaggedEnum<{
A: { a: number }
B: { b: number }
C: { c: number }
}>()
type ABC = TaggedEnum.Infer<typeof ABC>
}>
const ABC = Data.taggedEnum<ABC>()

const matchEval = pipe(
Match.type<ABC>(),
Expand All @@ -28,6 +27,15 @@ const matchPatternEval = pipe(
Match.exhaustive,
)

const matchValue = (abc: ABC) =>
pipe(
Match.value(abc),
Match.tag("A", (_) => _.a),
Match.tag("B", (_) => _.b),
Match.tag("C", (_) => _.c),
Match.exhaustive,
)

const matchPatternValue = (abc: ABC) =>
pipe(
Match.value(abc),
Expand Down Expand Up @@ -60,6 +68,7 @@ benny.suite(
"comparison",
benny.add("@effect/match Match.type/tag", () => matchEval(abc)),
benny.add("@effect/match Match.type/when", () => matchPatternEval(abc)),
benny.add("@effect/match Match.value/tag", () => matchValue(abc)),
benny.add("@effect/match Match.value/when", () => matchPatternValue(abc)),
benny.add("ts-pattern", () => tspEval(abc)),
benny.add("if/else", () => ifElseEval(abc)),
Expand Down
36 changes: 17 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,40 +59,38 @@
"@effect/data": "^0.17.1"
},
"devDependencies": {
"@babel/cli": "^7.22.9",
"@babel/core": "^7.22.9",
"@babel/cli": "^7.22.10",
"@babel/core": "^7.22.10",
"@babel/plugin-transform-modules-commonjs": "^7.22.5",
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.2",
"@effect/build-utils": "^0.1.3",
"@effect/data": "^0.17.1",
"@effect/docgen": "^0.1.2",
"@effect/build-utils": "^0.1.4",
"@effect/data": "^0.17.6",
"@effect/docgen": "^0.1.3",
"@effect/eslint-plugin": "^0.1.2",
"@effect/language-service": "^0.0.19",
"@effect/language-service": "^0.0.21",
"@types/chai": "^4.3.5",
"@types/node": "^20.4.6",
"@typescript-eslint/eslint-plugin": "^6.2.1",
"@typescript-eslint/parser": "^6.2.1",
"@vitest/coverage-v8": "^0.34.1",
"@types/node": "^20.5.3",
"@typescript-eslint/eslint-plugin": "^6.4.1",
"@typescript-eslint/parser": "^6.4.1",
"@vitest/coverage-v8": "^0.34.2",
"babel-plugin-annotate-pure-calls": "^0.4.0",
"benny": "^3.7.1",
"concurrently": "^8.2.0",
"eslint": "^8.46.0",
"eslint-config-prettier": "^8.10.0",
"eslint-import-resolver-typescript": "^3.5.5",
"concurrently": "^8.2.1",
"eslint": "^8.47.0",
"eslint-import-resolver-typescript": "^3.6.0",
"eslint-plugin-codegen": "0.17.0",
"eslint-plugin-deprecation": "^1.5.0",
"eslint-plugin-import": "^2.28.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-sort-destructure-keys": "^1.5.0",
"madge": "^6.1.0",
"prettier": "^3.0.1",
"rimraf": "^5.0.1",
"ts-node": "^10.9.1",
"ts-pattern": "^5.0.4",
"ts-pattern": "^5.0.5",
"tslint": "^6.1.3",
"typescript": "5.1.6",
"vite": "^4.4.8",
"vitest": "0.34.1"
"vite": "^4.4.9",
"vitest": "0.34.2"
}
}
Loading

0 comments on commit 36ca9f9

Please sign in to comment.