Hazel in Patchwork - #1959
Draft
disconcision wants to merge 145 commits into
Draft
Conversation
# Conflicts: # src/web/app/History.re # src/web/app/editors/code/CodeEditable.re
The module system merge from dev added new Sort.t variants (Mod, Sig, MPat). Update FlatDoc.mli and PatchworkComm.re to handle them in JS conversion. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…at sorts The previous commit manually added Sort variants to FlatDoc.mli, but the source of truth is flatdoc.d.ts. Updated the .d.ts and regenerated via ts2ocaml, then fixed all cascading tag renames in PatchworkComm.re. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move caret save/restore machinery into a general-purpose module with a clean `transform(z, seg => seg)` API, decoupled from patchwork sync. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
# Conflicts: # src/web/app/editors/code/CodeEditable.re
- Add Structural(_) case to SyncReplace.should_send_state (new Action variant from dev) - Update PatchworkUndoSync field access chain for Scratchpad record type change (was tuple) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
# Conflicts: # src/web/app/editors/Editors.re
…in tests The IDB stub sets window=globalThis for Node.js, but without also setting parent, PatchworkComm.is_in_iframe() returns true (parent undefined !== window). This caused documentation_slides to be empty, making List.tl([]) crash in Test_ReparseDocSlides. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
# Conflicts: # src/haz3lcore/zipper/action/Perform.re # src/web/app/Page.re # src/web/app/editors/code/CodeEditable.re # src/web/www/style.css
disconcision
marked this pull request as draft
April 20, 2026 09:01
# Conflicts: # src/web/Main.re # src/web/app/Page.re # src/web/app/editors/Editors.re # src/web/app/editors/code/CodeEditable.re # src/web/init/Init.re
# Conflicts: # src/web/init/Init.re
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Try it out:
automerge:27ShjXmwBQPAovhh9Sgd5L5ue1a1. This registers a HazelDoc Patchwork datatype and tool, which will enable you to create and view new HazelDocs....menu at the top right.Relevant external URLs:
patchwork pushif changes are made; see patchwork-integration.md in the docs directory for detailed instructions.automerge:27ShjXmwBQPAovhh9Sgd5L5ue1a1Hazel in Patchwork
This adds supports for collaborative multiplayer hazel programs via patchwork+automerge.
In particular:
Minor limitations:
Major limitation:
let x = 1 iwhere one user appends andnat the same time as another backspaces thet. The only other situation which definitely causes clobbering are when two users edit the same token at the same time. There's no intrinsic complexity here; we'd just need to switch the token type to the automerge text CRDT; it's just not totally clear to me if that's desirable behavior for all token classes. It might be reasonable for a comment, but when editing a variable name perhaps clobbering is better? Unsure.Appendix: Restructuring operations versus concurrent edits.
Note: The below is now outdated, after implementing the plan specified in automerge-granular-sync.md. However it is retained as an intuition pump for the impedance mismatch which has now been partially addressed. In particular, both of the examples at the end now work fine concurrently
For example, consider the following program:
This will have the following (simplified) flattened rep:
Our basic setup handles concurrent edits to individual entries in the above list, but concurrent edits to the same entry will result in clobbering. So, for example, any two atomic tokens can be concurrently edited. But, any addition to the root segment, for example adding a new let definition (say, for a new variable z) between the two existing one while another user adds a
+ zto the end of the program, will result in clobbering. Additionally, if a user tries to edit the pattern for the definition ofx, say changing it tox, w, while another user edits the definition similarly, say changing1 + (2 * 3)to1 + (2 * 3), 4, these will get clobbered because, even though they are not edits to the same segment, they are nonetheless both edits to the list of lists for node A.