You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
letcutOffLast list =let mutableheadList= ListCollector<'a>()let recvisit list =match list with|[]|[_]->()| head :: tail ->
headList.Add(head)
visit tail
visit list
headList.Close()
Expected and actual results
Expected:
// Something along the lines of// let mutable headList = ListCollector<'a>()constheadList=[];// headList.Add(head)headList.push(head);// headList.Close()import{ofArray}from"fable-library/List.js";ofArray(headList);
Actual: error FABLE: Microsoft.FSharp.Core.CompilerServices.ListCollector1.Close is not supported by Fable`.
Related information
Fable version: dotnet fable --version: 4.9.0
Operating system: Windows
I might wanna dig into this if approved.
The text was updated successfully, but these errors were encountered:
It seems to be a small enough type to write Source so fo me it is ok to add it.
Because this is an F# type, what we do in general is we take heavy inspiration from the FSharp.Core implementation and include it inside of the fable-library folder. For example, this is what we did for StringBuilder.
The only things I have question about is that ListCollector is using RuntimeHelpers.FreshConsNoTail which is defined as:
let inlineFreshConsNoTail head = head ::(# "ldnull": 'T list #)
so it is emitting IL code and we will not be able to do that same goes for SetFreshConsTail. But I don't think this is blocking.
Description
It would be great if Fable could support ListCollector<'T>
Repro code
Expected and actual results
Expected:
Actual:
error FABLE: Microsoft.FSharp.Core.CompilerServices.ListCollector
1.Close is not supported by Fable`.Related information
dotnet fable --version
: 4.9.0I might wanna dig into this if approved.
The text was updated successfully, but these errors were encountered: