Skip to content

Fix toArray and toList causing compilation errors#122

Open
jwosty wants to merge 1 commit into
JordanMarr:mainfrom
jwosty:patch-1
Open

Fix toArray and toList causing compilation errors#122
jwosty wants to merge 1 commit into
JordanMarr:mainfrom
jwosty:patch-1

Conversation

@jwosty

@jwosty jwosty commented Jan 23, 2026

Copy link
Copy Markdown
Contributor

Not sure if I'm doing something wrong, but toArray and toList in select expressions cause type mismatch errors for me whenever I try to use them.

I've tried this tiny little fix in my own codebase and it typechecks. It looks like more functions need fixing though. And I am also not sure how but mapSeq works in my code even though it appears to have the same issue...?

@jwosty jwosty changed the title Fix toArray and toList compilation errors Fix toArray and toList causing compilation errors Jan 23, 2026
@jwosty

jwosty commented Jan 23, 2026

Copy link
Copy Markdown
Contributor Author

Hmm. Seems it breaks some usages. For the record, I'm doing using mapSeq before the toList, maybe that has something to do with it? Roughly:

selectAsync {
    for x in table do
        select x
        mapSeq (
            // ...
        )
        toList
}

@JordanMarr

JordanMarr commented Jan 23, 2026

Copy link
Copy Markdown
Owner

Hi John!

I was able to recreate your issue. This also fails to build for me:

  let! results = 
      selectAsync openContext {
          for p in Person.Person do
          mapSeq $"{p.LastName}, {p.FirstName}"
          toList
      }
}

But the intended approach is to replace mapSeq into toList with mapList (or mapArray):

  let! results = 
      selectAsync openContext {
          for p in Person.Person do
          mapList $"{p.LastName}, {p.FirstName}"
      }

You may also include select p before the mapList if you want to only select certain columns:

  let! results = 
      selectAsync openContext {
          for p in Person.Person do
          select (p.LastName, p.FirstName) into selected
          mapList (
              let lname, fname = selected
              $"{lname}, {fname}"
          )
      }

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