Skip to content

Fix Tag.to-type: unwrap Maybe values for Integer/Floating#3

Merged
hellerve merged 1 commit into
masterfrom
claude/fix-tag-to-type-maybe-unwrap
May 18, 2026
Merged

Fix Tag.to-type: unwrap Maybe values for Integer/Floating#3
hellerve merged 1 commit into
masterfrom
claude/fix-tag-to-type-maybe-unwrap

Conversation

@carpentry-agent

Copy link
Copy Markdown

Summary

Long.from-string and Double.from-string return (Maybe Long) and (Maybe Double), but CLI.Type.Integer and CLI.Type.Floating constructors expect bare Long and Double. This caused a type error at compile time, making integer and floating-point CLI flags unusable.

Wraps both calls with Maybe.from using defaults of 0l and 0.0, so invalid numeric input falls back to zero rather than crashing.

Closes #2


Opened by the carpentry-org heartbeat agent (Claude). Veit has not reviewed this yet.

…tring

Long.from-string and Double.from-string return (Maybe Long) and
(Maybe Double), but CLI.Type.Integer and CLI.Type.Floating expect
bare Long and Double. Use Maybe.from with sensible defaults (0l, 0.0)
to unwrap the values.

Closes #2

@carpentry-agent carpentry-agent Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test

@carpentry-agent carpentry-agent Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build & Tests

CI passes on both ubuntu-latest and macos-latest. No Carp compiler available locally for an independent build, but CI confirms it compiles and all tests pass.

Findings

The fix is correct. Long.from-string and Double.from-string return (Maybe Long) and (Maybe Double), but CLI.Type.Integer and CLI.Type.Floating constructors expect bare values. Wrapping with Maybe.from resolves the type mismatch.

Minor design note (not blocking): Invalid numeric input (e.g. --port abc) now silently defaults to 0l/0.0 rather than producing an error. This is a reasonable choice given the current CLI parser architecture — there's no validation infrastructure in the parse loop to thread a Result from to-type. A future enhancement could add numeric validation in the CmdMap.put! path, but that's out of scope here.

No changelog to update (none exists in this repo).

Verdict: merge

The fix is minimal, correct, and unblocks integer/floating-point CLI flags which were completely broken at the type level.

@hellerve hellerve merged commit f141552 into master May 18, 2026
2 checks passed
@hellerve hellerve deleted the claude/fix-tag-to-type-maybe-unwrap branch May 18, 2026 16:02
@carpentry-agent carpentry-agent Bot mentioned this pull request May 23, 2026
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.

cli.carp: CLI.Tag.to-type passes Maybe Long/Maybe Double to constructors expecting bare values

1 participant