Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fable4 #539

Merged
merged 12 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"fable": {
"version": "3.7.20",
"version": "4.1.4",
"commands": [
"fable"
]
Expand Down
38 changes: 37 additions & 1 deletion .github/workflows/fable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,43 @@ jobs:
- name: Run Fable tests
working-directory: tests/FSharpPlusFable.Tests
run: fable . --outDir bin --runScript ./bin


testfable4:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Restore
run: git submodule update --init --recursive
- name: Remove global json
run: rm global.json
- name: Setup .NET Core 7
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.200
- name: Setup .NET Core 6
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.201
- name: Restore tools
run: dotnet tool restore
- name: Install jq
uses: dcarbone/install-jq-action@v1.0.1
- name: Install fable
run: |
version=`cat ./.config/dotnet-tools.json | jq --raw-output '.tools.fable.version'`
dotnet tool install --global Fable --version $version
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '18.x'
- name: Install npm dependencies
working-directory: tests/FSharpPlusFable.Tests
run: npm install
- name: Run Fable tests
working-directory: tests/FSharpPlusFable.Tests
run: fable . --outDir bin --runScript ./bin

testFable3SubsetOnCore:
runs-on: ubuntu-latest

Expand Down
2 changes: 1 addition & 1 deletion src/FSharpPlus/Builders.fs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace FSharpPlus

#nowarn "40"

#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

/// Constructs to express generic computations
[<AutoOpenAttribute>]
Expand Down
2 changes: 1 addition & 1 deletion src/FSharpPlus/Control/Alternative.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace FSharpPlus.Control
/// </summary>
/// </namespacedoc>

#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

open System.Runtime.InteropServices
open FSharpPlus
Expand Down
4 changes: 2 additions & 2 deletions src/FSharpPlus/Control/Applicative.fs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ open FSharpPlus.Data
type Apply =
inherit Default1

#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

static member inline ``<*>`` (f: '``Monad<'T->'U>`` , x: '``Monad<'T>`` , [<Optional>]_output: '``Monad<'U>`` , [<Optional>]_mthd:Default2) : '``Monad<'U>`` = Bind.InvokeOnInstance f (fun (x1: 'T->'U) -> Bind.InvokeOnInstance x (fun x2 -> Return.InvokeOnInstance (x1 x2)))
static member inline ``<*>`` (f: '``Applicative<'T->'U>``, x: '``Applicative<'T>``, [<Optional>]_output: '``Applicative<'U>``, [<Optional>]_mthd:Default1) : '``Applicative<'U>`` = ((^``Applicative<'T->'U>`` or ^``Applicative<'T>`` or ^``Applicative<'U>``) : (static member (<*>) : _*_ -> _) f, x)
Expand Down Expand Up @@ -87,7 +87,7 @@ type Apply =
static member inline InvokeOnInstance (f: '``Applicative<'T->'U>``) (x: '``Applicative<'T>``) : '``Applicative<'U>`` =
((^``Applicative<'T->'U>`` or ^``Applicative<'T>`` or ^``Applicative<'U>``) : (static member (<*>) : _*_ -> _) (f, x))

#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

type Lift2 =
inherit Default1
Expand Down
2 changes: 1 addition & 1 deletion src/FSharpPlus/Control/Arrow.fs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace FSharpPlus.Control

#nowarn "0077"
#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

open System
open System.Runtime.InteropServices
Expand Down
2 changes: 1 addition & 1 deletion src/FSharpPlus/Control/ArrowApply.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ open System
open System.Runtime.InteropServices
open FSharpPlus.Internals

#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

// ArrowApply class -------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion src/FSharpPlus/Control/ArrowChoice.fs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace FSharpPlus.Control

#nowarn "0077"
#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

open System
open System.Runtime.InteropServices
Expand Down
2 changes: 1 addition & 1 deletion src/FSharpPlus/Control/Bifoldable.fs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace FSharpPlus.Control

#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

open System.Runtime.InteropServices
open FSharpPlus.Internals
Expand Down
2 changes: 1 addition & 1 deletion src/FSharpPlus/Control/Bitraversable.fs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace FSharpPlus.Control

#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

// open System.Runtime.InteropServices
open FSharpPlus.Internals
Expand Down
2 changes: 1 addition & 1 deletion src/FSharpPlus/Control/Category.fs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace FSharpPlus.Control

#nowarn "0077"
#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

open System
open System.Runtime.InteropServices
Expand Down
2 changes: 1 addition & 1 deletion src/FSharpPlus/Control/Collection.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ open System.Runtime.InteropServices
open FSharpPlus
open FSharpPlus.Internals

#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

type OfSeq =
inherit Default1
Expand Down
5 changes: 3 additions & 2 deletions src/FSharpPlus/Control/Comonad.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ open System.Threading.Tasks

open FSharpPlus
open FSharpPlus.Internals

#if !FABLE_COMPILER4

// Comonad class ----------------------------------------------------------

type Extract =
static member Extract (x: Async<'T> ) =
#if FABLE_COMPILER_3
#if FABLE_COMPILER_3 || FABLE_COMPILER_4
wallymathieu marked this conversation as resolved.
Show resolved Hide resolved
Async.RunSynchronously x
#else
Async.StartImmediateAsTask(x).Result
Expand Down Expand Up @@ -118,3 +118,4 @@ type Duplicate =
call (Unchecked.defaultof<Duplicate>, x, Unchecked.defaultof<'``Comonad<'Comonad<'T>>``>)

#endif
#endif
2 changes: 1 addition & 1 deletion src/FSharpPlus/Control/Converter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ open System.Text
open FSharpPlus.Internals
open FSharpPlus.Internals.Prelude

#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

type Explicit =
inherit Default1
Expand Down
2 changes: 1 addition & 1 deletion src/FSharpPlus/Control/Foldable.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Warn FS0077 -> Member constraints with the name 'get_Item' are given special status by the F# compiler as certain .NET types are implicitly augmented with this member. This may result in runtime failures if you attempt to invoke the member constraint from your own code.
// Those .NET types are string and array. String is explicitely handled here and array through the seq overload.

#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

open FSharpPlus.Control

Expand Down
22 changes: 11 additions & 11 deletions src/FSharpPlus/Control/Functor.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ open FSharpPlus.Internals.Prelude
open FSharpPlus
open FSharpPlus.Data

#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && ! FABLE_COMPILER_4

// Functor class ----------------------------------------------------------

Expand Down Expand Up @@ -61,7 +61,7 @@ type Iterate =
type Map =
inherit Default1

#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

static member Map ((x: Lazy<_> , f: 'T->'U), _mthd: Map) = Lazy.map f x
#if !FABLE_COMPILER
Expand Down Expand Up @@ -113,7 +113,7 @@ type Map =
static member inline InvokeOnInstance (mapping: 'T->'U) (source: '``Functor<'T>``) : '``Functor<'U>`` =
(^``Functor<'T>`` : (static member Map : _ * _ -> _) source, mapping)

#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4


type Map with
Expand All @@ -139,7 +139,7 @@ type Map with
static member inline Map ((_: ^t when ^t: null and ^t: struct, _ ), _mthd: Default1) = ()

#endif
#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

type Unzip =
inherit Default1
Expand Down Expand Up @@ -199,7 +199,7 @@ type Unzip =
call (Unchecked.defaultof<Unzip>, source) : '``Functor<'T1>`` * '``Functor<'T2>``

#endif
#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

type Zip =
inherit Default1
Expand Down Expand Up @@ -239,7 +239,7 @@ type Zip with
static member inline Zip ((x: '``ZipFunctor<'T1>`` , y: '``ZipFunctor<'T2>`` , _output: '``ZipFunctor<'T1 * 'T2>`` ), _mthd: Default1) = Zip.InvokeOnInstance x y : '``ZipFunctor<'T1 * 'T2>``

#endif
#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

// Bifunctor class --------------------------------------------------------

Expand All @@ -260,7 +260,7 @@ type Bimap =
(^``Bifunctor<'T,'V>``: (static member Bimap : _*_*_ -> _) source, f, g)

#endif
#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

type MapFirst =
inherit Default1
Expand Down Expand Up @@ -312,7 +312,7 @@ type Dimap =
(^``Profunctor<'B,'C>`` : (static member Dimap : _*_*_ -> _) source, ab, cd)

#endif
#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

// Contravariant class ----------------------------------------------------

Expand All @@ -338,21 +338,21 @@ type Contramap =
#endif
#endif

#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

type Contramap with
static member inline Contramap (x: '``Profunctor<'B,'C>``, f: 'A->'B, [<Optional>]_mthd: Default2) = Dimap.InvokeOnInstance f id x : '``Profunctor<'A,'C>``
static member inline Contramap (x: '``Contravariant<'T>``, f: 'U->'T, [<Optional>]_mthd: Default1) = Contramap.InvokeOnInstance f x: '``Contravariant<'U>``
static member inline Contramap (_: ^t when ^t: null and ^t: struct , _: 'A->'B, _mthd: Default1) = ()

#endif
#if !FABLE_COMPILER|| FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

type Map with
static member inline Map ((x: '``Profunctor<'B,'C>``, cd: 'C->'D), [<Optional>]_mthd: Default5) = Dimap.InvokeOnInstance id cd x : '``Profunctor<'B,'D>``

#endif
#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

type Dimap with
static member inline Dimap (x: '``Profunctor<'B,'C>``, ab: 'A->'B, cd: 'C->'D, [<Optional>]_mthd: Default2) = x |> Map.InvokeOnInstance cd |> Contramap.InvokeOnInstance ab : '``Profunctor<'A,'D>``
Expand Down
2 changes: 1 addition & 1 deletion src/FSharpPlus/Control/Indexable.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Warn FS0077 -> Member constraints with the name 'get_Item' are given special status by the F# compiler as certain .NET types are implicitly augmented with this member. This may result in runtime failures if you attempt to invoke the member constraint from your own code.
// Those .NET types are string and array but they are explicitely handled here.

#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

open System
open System.Runtime.InteropServices
Expand Down
2 changes: 1 addition & 1 deletion src/FSharpPlus/Control/Invokable.fs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace FSharpPlus.Control

#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

open System
open FSharpPlus.Internals
Expand Down
5 changes: 3 additions & 2 deletions src/FSharpPlus/Control/Monad.fs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ open FSharpPlus.Data
open FSharpPlus.Internals
open FSharpPlus.Internals.Prelude


#if !FABLE_COMPILER_4
// Monad class ------------------------------------------------------------

type Bind =
Expand Down Expand Up @@ -128,7 +128,7 @@ type Return =
inherit Default1
static member inline InvokeOnInstance (x: 'T) = (^``Applicative<'T>`` : (static member Return : ^T -> ^``Applicative<'T>``) x)

#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

static member inline Invoke (x: 'T) : '``Applicative<'T>`` =
let inline call (mthd: ^M, output: ^R) = ((^M or ^R) : (static member Return : _*_ -> _) output, mthd)
Expand Down Expand Up @@ -329,3 +329,4 @@ type Using with
static member inline Using (_ , _ : 'a -> ^t when ^t : null and ^t: struct , _: Using ) = ()

#endif
#endif
2 changes: 1 addition & 1 deletion src/FSharpPlus/Control/MonadOps.fs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace FSharpPlus.Internals

#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

module internal MonadOps =
open FSharpPlus.Control
Expand Down
2 changes: 1 addition & 1 deletion src/FSharpPlus/Control/MonadTrans.fs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace FSharpPlus.Control

#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

open FSharpPlus

Expand Down
2 changes: 1 addition & 1 deletion src/FSharpPlus/Control/Monoid.fs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
open FSharpPlus.Internals
open FSharpPlus.Internals.Prelude

#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

[<Extension; Sealed>]
type Plus =
Expand Down Expand Up @@ -40,7 +40,7 @@
static member ``+`` (_: Id0 , _: Id0 , [<Optional>]_mthd: Plus ) = Id0 ""
static member ``+`` (x: exn , y: exn , [<Optional>]_mthd: Plus ) =
let f (e: exn) = match e with :? AggregateException as a -> a.Data0 :> seq<_> | _ -> Seq.singleton e
AggregateException (seq {yield! f x; yield! f y}) :> exn

Check warning on line 43 in src/FSharpPlus/Control/Monoid.fs

View workflow job for this annotation

GitHub Actions / testFable3SubsetOnCore

This upcast is unnecessary - the types are identical
#endif

static member inline Invoke (x: 'Plus) (y: 'Plus) : 'Plus =
Expand Down
2 changes: 1 addition & 1 deletion src/FSharpPlus/Control/Numeric.fs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type FromBigInt =
call Unchecked.defaultof<FromBigInt> x
#endif

#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

type FromInt64 =
inherit Default1
Expand Down
2 changes: 1 addition & 1 deletion src/FSharpPlus/Control/Traversable.fs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace FSharpPlus.Control

#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

open System.Runtime.InteropServices
open System.ComponentModel
Expand Down
2 changes: 1 addition & 1 deletion src/FSharpPlus/Control/Tuple.fs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ type MapItem5 =
call (Unchecked.defaultof<MapItem5>, value)


#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

type Curry =
static member inline Invoke f =
Expand Down
2 changes: 1 addition & 1 deletion src/FSharpPlus/Data/Cont.fs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ type Cont<'r,'t> with
[<EditorBrowsable(EditorBrowsableState.Never)>]
static member CallCC (f: ('T -> Cont<'R,'U>) -> _) = Cont.callCC f : Cont<'R,'T>

#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

static member inline Lift (m: '``Monad<'T>``) = Cont ((>>=) m) : ContT<'``Monad<'R>``,'T>

Expand Down
2 changes: 1 addition & 1 deletion src/FSharpPlus/Data/Coproduct.fs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace FSharpPlus.Data

#if !FABLE_COMPILER || FABLE_COMPILER_3
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

open FSharpPlus
open FSharpPlus.Control
Expand Down
Loading
Loading