Skip to content

Add @@ infix operator for LazyList.consLazy#261

Draft
Copilot wants to merge 1 commit into
masterfrom
copilot/fix-invalid-index-access
Draft

Add @@ infix operator for LazyList.consLazy#261
Copilot wants to merge 1 commit into
masterfrom
copilot/fix-invalid-index-access

Conversation

Copilot AI commented May 16, 2026

Copy link
Copy Markdown
Contributor

Closes #134.

Adds an @@ infix operator as a convenient alias for LazyList.consLazy, so users can write infinite lazy lists naturally:

open FSharpx.Collections

let rec ones : LazyList<int> = 1 @@ lazy ones
// [1; 1; 1; 1; 1; ...]

Changes

  • New LazyListOperators.fs defines [<AutoOpen>] module FSharpx.Collections.LazyListOperators with the @@ operator. Using a top-level [<AutoOpen>] module ensures the operator is automatically in scope whenever open FSharpx.Collections is used (no extra open needed).
  • FSharpx.Collections.fsproj — includes the new file after LazyList.fs.
  • LazyListTests.fs — adds four tests for @@: head access, toList, lazy-divergence (tail not forced on construction/head access), and the infinite-ones example.
  • LazyList.test.fs (Fable) — adds the same @@ tests for the JavaScript target.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants