Skip to content

chore: migrate timeflies-beam example to Fable.Beam rc.30 typed Cowboy API#27

Merged
dbrattli merged 1 commit into
mainfrom
chore/timeflies-fable-beam-rc30
May 31, 2026
Merged

chore: migrate timeflies-beam example to Fable.Beam rc.30 typed Cowboy API#27
dbrattli merged 1 commit into
mainfrom
chore/timeflies-fable-beam-rc30

Conversation

@dbrattli

Copy link
Copy Markdown
Collaborator

Summary

Migrates the timeflies-beam example to Fable.Beam 5.0.0-rc.30 (Cowboy 5.0.0-rc.24) and removes every inline [<Emit>] Cowboy/Beam workaround in favour of the typed bindings.

The main Fable.Actor library is unchanged — its Fable.Beam reference is a floating 5.0.0-rc.* wildcard that already resolves to rc.30, and it uses no Cowboy/changed APIs.

Changes

Timeflies.fsproj

  • Fable.Beam 5.0.0-rc.29 → 5.0.0-rc.30; Fable.Beam.Cowboy stays at 5.0.0-rc.24 (latest).

App.fs

  • Delete the local route / hostRule / protoOpts / transportOpts [<Emit>] helpers.
  • Use CowboyRouter.wildcard/route/hostRule/compile and Cowboy.tcpPort/protocolOpts/startClear.
  • Switch the now-internal application.ensure_all_started to Application.ensureAllStarted.

Http.fs

  • Replace the content-type header [<Emit>] with Maps.ofList — the helper added upstream in Fable.Beam#105 after this migration surfaced the gap (the array-based from_list lowered to a process-dictionary ref; ofList emits a direct maps:from_list([...])).
  • Type init's return as HandlerResult<'State> since CowboyHandler.ok is now typed.

The example F# is now free of Cowboy/Beam Emits; the only remaining [<Emit>]s in the repo are Fable.Actor's own wire protocol in Platform.fs (fable_actor_msg / fable_actor_reply / EXIT), which are app-specific, not a Fable.Beam gap.

Verification

  • dotnet build (lib type-check) ✓
  • Fable BEAM transpile + rebar3 compile ✓ — inspected generated app.erl/http.erl: cowboy_router:compile([{'_', […]}]), [{port,3000}], #{env => #{dispatch => …}}, and clean maps:from_list([{<<"content-type">>, <<"text/html">>}]) (no process-dict-ref wrapper).
  • just test-native 21/21 ✓
  • just test-beam 21/21 ✓
  • dotnet fantomas clean

🤖 Generated with Claude Code

…y API

Bump the timeflies-beam example to Fable.Beam 5.0.0-rc.30 (Cowboy
5.0.0-rc.24) and drop all inline [<Emit>] Cowboy workarounds in favour of
the typed bindings:

- App.fs: delete the local route/hostRule/protoOpts/transportOpts Emit
  helpers; use CowboyRouter.wildcard/route/hostRule/compile and
  Cowboy.tcpPort/protocolOpts/startClear. Switch the now-internal
  application.ensure_all_started to Application.ensureAllStarted.
- Http.fs: replace the content-type header Emit with Maps.ofList (added
  upstream in Fable.Beam#105 after this migration surfaced the gap), and
  type init's return as HandlerResult<'State> since CowboyHandler.ok is
  now typed.

The example F# is now free of Cowboy/Beam Emits; only Fable.Actor's own
wire-protocol Emits remain in Platform.fs. Verified: dotnet build, Fable
BEAM transpile, rebar3 compile, and native + BEAM test suites (21/21
each) all pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dbrattli dbrattli merged commit ae8a554 into main May 31, 2026
2 checks passed
@dbrattli dbrattli deleted the chore/timeflies-fable-beam-rc30 branch May 31, 2026 08:37
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.

1 participant