Skip to content

Pr 2#4

Merged
dalurness merged 3 commits into
mainfrom
pr-2
Apr 7, 2026
Merged

Pr 2#4
dalurness merged 3 commits into
mainfrom
pr-2

Conversation

@dalurness
Copy link
Copy Markdown
Owner

No description provided.

du-breeze and others added 3 commits April 6, 2026 15:53
Redesigns the CLI source input model so each command has a natural default:

  run/check: file-first, -e for inline code
    clank run app.clk
    clank run -e 'main : () -> <io> () = print("hi")'
    clank check -e 'main : () -> <io> () = print("hi")'

  eval: expression-first, -f for file
    clank eval '2 + 2'
    clank eval 'map(range(1, 6), fn(x) => x * x)'
    clank eval -f app.clk

eval no longer requires a main function — bare expressions are
automatically wrapped and the result is printed. Full programs
(with type signatures) are detected and passed through unchanged.

All existing tests pass. No breaking changes to file-based usage.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Redesigns the CLI source input model so each command has a natural default:

  run/check: file-first, -c for inline code
    clank run app.clk
    clank run -c 'main : () -> <io> () = print("hi")'
    clank check -c 'main : () -> <io> () = print("hi")'

  eval: expression-first, -f for file
    clank eval '2 + 2'
    clank eval 'map(range(1, 6), fn(x) => x * x)'
    clank eval -f app.clk

eval no longer requires a main function — bare expressions are
automatically wrapped and the result is printed. Full programs
(with type signatures or top-level keywords like type/effect/use)
are detected and passed through unchanged.

Uses -c flag (matching python, ruby, sh convention) for inline code.

All existing tests pass. No breaking changes to file-based usage.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix comment referencing old -e flag (now -c)
- Guard strings.Fields against empty slice before indexing
- Add unit tests for wrapExprSource covering expressions, decls,
  comments, blank lines, and empty input

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dalurness dalurness merged commit 3f75a9d into main Apr 7, 2026
3 checks passed
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.

2 participants