Closed
Description
I am trying to use Oxpecker + ViewEngine with datastar and for that I decided to use AsyncSeq for the views which are then rendered and sent to the Client via PatchElementsAsync.
When trying to create AsyncSeq of views with computation expression it does not work. I get the error: repro.fsx(10,38): error FS0193: The type 'AsyncSeq.AsyncSeqBuilder' is not compatible with the type 'HtmlContainer'.
Without the computation expression everything works as expected.
Do you know what could be the problem? Is there maybe a workaround so that I can still use asyncSeq CE?
Small repro.fsx:
#r "nuget: Oxpecker.ViewEngine"
#r "nuget: FSharp.Control.AsyncSeq"
open FSharp.Control
open Oxpecker.ViewEngine
let myView (name: string) : HtmlContainer =
h1() { name }
let main : AsyncSeq<HtmlContainer> = asyncSeq {
yield myView "Hello, world"
}Metadata
Metadata
Assignees
Labels
No labels
Activity
dsyme commentedon Feb 22, 2026
Yes that's a bit strange. Code looks like it should be fine
dsyme commentedon Feb 22, 2026
I think this highly generic constrained
Runis causing grief - probably for any computation expressions.This could be onsidered an F# compiler bug but we'd have to check the spec - the compiler commits to using this
Runbefore it knows the constraint check#HtmlContainerwill fail.dsyme commentedon Feb 22, 2026
But it's not AsyncSeq causing this as such - I think you'll get the same problem with many computation expressions (though it may vary on other details related to overloading, subtyping)
dsyme commentedon Feb 22, 2026
I'll close this one, thanks, though not sure what you should do to resolve the incompat
dsyme commentedon Feb 22, 2026
Not sure if using the less generic variant without
#will help?Lanayx commentedon Feb 22, 2026
It also feels like a compiler bug to me.