Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make getShow output more conformant #5

Merged
merged 1 commit into from
Feb 16, 2024
Merged

Make getShow output more conformant #5

merged 1 commit into from
Feb 16, 2024

Conversation

samhh
Copy link
Contributor

@samhh samhh commented Feb 16, 2024

Like this we better adhere to the idea that Show's output should ideally be a valid TypeScript expression that'd be reversible with something equivalent to Haskell's Read. This therefore also makes the output equivalent to that of fp-ts' sums such as Either.

type Sum = Member<"A"> | Member<"B", number>
show(Sum.mk.A) === "A"
-show(Sum.mk.B(123)) === "B 123"
+show(Sum.mk.B(123)) === "B(123)"

Like this we better adhere to the idea that Show's
output should ideally be a valid TypeScript
expression that'd be reversible with something
equivalent to Haskell's Read.
@samhh samhh merged commit 2a08139 into master Feb 16, 2024
5 checks passed
@samhh samhh deleted the conformant-show branch March 18, 2024 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants