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

Version 5 of language-ext merging into main #1327

Merged
merged 259 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
259 commits
Select commit Hold shift + click to select a range
d6b0487
Flipped Reducer type-parameters
louthy Nov 13, 2023
1cb9079
Streaming
louthy Nov 13, 2023
9112ad5
Added Pure and Fail
louthy Nov 13, 2023
0158b25
liftIO support in the Prelude.cs
louthy Nov 13, 2023
4180833
Pure and Fail integration with Option amd Either
louthy Nov 14, 2023
fd5cdee
First pass at catching
louthy Nov 14, 2023
582c48c
Remove MapAsync
louthy Nov 14, 2023
99aae33
IO
louthy Nov 15, 2023
1ede6dc
Forking
louthy Nov 15, 2023
86547cb
Retry and Try transducers
louthy Nov 15, 2023
0709ac2
Retry extensions and prelude
louthy Nov 15, 2023
bd1541c
Recursive tests
louthy Nov 16, 2023
c1f2706
Tidy example
louthy Nov 16, 2023
634de99
Memory usage improvements
louthy Nov 16, 2023
e73f411
Memory leak saver when infinite loops return Unit
louthy Nov 16, 2023
f689ebb
Tail recursion transducer
louthy Nov 16, 2023
935eb45
More tail call testing
louthy Nov 16, 2023
02a152e
Support for `many`
louthy Nov 16, 2023
de4a305
Regular function lifting
louthy Nov 17, 2023
3d158cf
Add the `repeat` prelude and extensions for IO
louthy Nov 17, 2023
d8a1511
nullable enable
louthy Nov 17, 2023
3f196c9
Posting between SynchronizationContexts
louthy Nov 17, 2023
8b12831
Test application for IO → WPF IO dispatching
louthy Nov 17, 2023
673ce77
Tweaks
louthy Nov 17, 2023
27faa89
Don't use DispatcherTimer
louthy Nov 17, 2023
4e340d9
Remove unused
louthy Nov 17, 2023
98a2838
WPF app tidying
louthy Nov 17, 2023
545d2b0
Easier to use lift and liftIO functions
louthy Nov 17, 2023
42f03ea
More tidying
louthy Nov 17, 2023
6724651
Bulletproofing the PostTransducer
louthy Nov 17, 2023
37ba298
Remove test func
louthy Nov 18, 2023
f5ebc16
Add example event handler system
louthy Nov 18, 2023
0089a19
More WPF ideas
louthy Nov 18, 2023
f94bdfa
WindowIO base-type that encapslates some of the WPF behaviours
louthy Nov 18, 2023
02b0353
Refinement of the button handler
louthy Nov 18, 2023
9f6ef5f
Remove the need to specify the Window for onMouseMove
louthy Nov 18, 2023
205777c
Sequence and Traverse for IO
louthy Nov 18, 2023
83a77e4
Guards updated to support LINQ
louthy Nov 20, 2023
268e042
Merge remote-tracking branch 'origin/v5-transducers' into v5-transducers
louthy Nov 20, 2023
3f17790
Folding WIP
louthy Nov 20, 2023
7d7b1f5
WIP folding
louthy Dec 1, 2023
f629e02
Stream fix
louthy Dec 1, 2023
e4b28c5
Merge remote-tracking branch 'origin/v5-transducers' into v5-transducers
louthy Dec 1, 2023
8c725e3
Refactoring
louthy Dec 3, 2023
d8876b6
Rename MinimalRT to MinRT
louthy Dec 3, 2023
c99c0da
WIP
louthy Dec 5, 2023
a1b1192
FoldM
louthy Dec 13, 2023
1640f1c
Documentation
louthy Dec 20, 2023
9ec8f6c
Cancel on close
louthy Dec 20, 2023
02de322
Effects WIP
louthy Jan 20, 2024
9d01317
Effects WIP
louthy Jan 20, 2024
1dd60c9
Merge remote-tracking branch 'origin/v5-transducers' into v5-transducers
louthy Jan 21, 2024
953301d
Pipes refactor WIP
louthy Jan 21, 2024
799d348
Turning on nullable refereneces + traits as static interfaces
louthy Jan 24, 2024
1f71bd1
More nullable and trait fixups
louthy Jan 25, 2024
c465edc
More nullablity
louthy Jan 25, 2024
c5d907f
More nullable fixups
louthy Jan 26, 2024
fad21c3
Pipes to use transformers WIP
louthy Jan 28, 2024
7d4f9e5
ErrorMap to static
louthy Jan 28, 2024
e032905
Pipes refactor
louthy Jan 29, 2024
702aefc
Extensions nullable fixup
louthy Jan 29, 2024
be6d85f
Arr nullable fixes
louthy Jan 29, 2024
c15a326
BiMap, HashMap, TrieMap nullability
louthy Jan 29, 2024
9f3224d
Transducer fixups
louthy Jan 29, 2024
a03bf3f
Arr, HashMap, HashSet, Lst
louthy Jan 30, 2024
fb97421
Map nullable fixes
louthy Jan 30, 2024
e51406a
Seq nullable fixes
louthy Jan 30, 2024
8a22fd3
Set nullable and collection initialisers
louthy Jan 30, 2024
6cc7be5
Stck nullable and collection initialisers
louthy Feb 3, 2024
7d12d74
TrackingHashMap nullable and collection initialisers
louthy Feb 3, 2024
bd6a796
Collections prelude nullable fixes
louthy Feb 3, 2024
2cf042d
Lens tidying
louthy Feb 3, 2024
a2c85bc
Fin and Either
louthy Feb 4, 2024
6d7425d
Remove types:
louthy Feb 4, 2024
d36050b
Really removed OptionNone
louthy Feb 4, 2024
95ee58c
Moved Try* to Obsolete
louthy Feb 4, 2024
150b8a9
But the bullet and deleted the Obsoletes
louthy Feb 4, 2024
ce3a3c5
Sequence and Traverse
louthy Feb 4, 2024
102abf2
Reader monad and assorteds
louthy Feb 4, 2024
93c9818
RWS returns Fin
louthy Feb 5, 2024
6c9d577
Reader and RWS monad fixups
louthy Feb 5, 2024
9f7f778
Monad transformer ideas
louthy Feb 6, 2024
3c99d09
WIP
louthy Feb 7, 2024
56e1d9b
Merge
louthy Feb 7, 2024
275348b
Merge remote-tracking branch 'origin/main' into v5-transducers
louthy Feb 7, 2024
e09cd3d
Improved HKT
louthy Feb 8, 2024
708902b
A perfect moment
louthy Feb 9, 2024
67b44b0
More polish on the reader
louthy Feb 9, 2024
d3d960c
Reader polish
louthy Feb 9, 2024
b3c8250
Higher Kinds refactor
louthy Feb 9, 2024
859826c
Latest
louthy Feb 9, 2024
26731ca
Notes
louthy Feb 9, 2024
ab0310a
Notes
louthy Feb 9, 2024
f818723
Notes
louthy Feb 9, 2024
859d877
Notes
louthy Feb 9, 2024
3a9d6ec
Notes
louthy Feb 9, 2024
4c7699b
Applicatives
louthy Feb 10, 2024
6200979
Alternative trait
louthy Feb 10, 2024
f597e30
Traversable trait - WIP
louthy Feb 10, 2024
9e8f575
Either Traverse
louthy Feb 10, 2024
3b17b01
Foldables
louthy Feb 11, 2024
cacad95
No transducers in traits
louthy Feb 11, 2024
14533d2
Continuing HKT refactor
louthy Feb 11, 2024
1f8e38d
Monad transformers refactor WIP
louthy Feb 13, 2024
d691026
OptionT
louthy Feb 14, 2024
196c79a
Monad transformers WIP
louthy Feb 14, 2024
d33394a
Unlifting
louthy Feb 15, 2024
e118b0c
Unlifting
louthy Feb 15, 2024
11bdb70
StateT monad transformer
louthy Feb 15, 2024
2e6e18f
State monad
louthy Feb 15, 2024
cb83501
Eff implemeneted with transformers
louthy Feb 17, 2024
c77600b
Eff monad refactor to use transformers
louthy Feb 17, 2024
d0852a1
Eff conversion WIP
louthy Feb 17, 2024
6901e69
Eff refactor complete
louthy Feb 17, 2024
782ffb2
Pipes transformer refactor WIP
louthy Feb 17, 2024
5f2e73b
PureProxy refactor
louthy Feb 18, 2024
295defc
Pipes refactor (almost) complete
louthy Feb 18, 2024
cad5430
State refactor WIP
louthy Feb 18, 2024
4066300
State monad refactor
louthy Feb 18, 2024
918549c
First pass of Validation refactor
louthy Feb 18, 2024
28d0a13
More validation
louthy Feb 18, 2024
a47d4a0
unless and when for all
louthy Feb 18, 2024
65038d1
Refactor collections to derive from Monoid
louthy Feb 19, 2024
db38fc2
Patch and Compositions monoid fixup
louthy Feb 19, 2024
15e4fec
More monoid and tuple fixups
louthy Feb 19, 2024
bb92430
Removal of manually written traversal methods
louthy Feb 19, 2024
f04544a
It builds!!!!!
louthy Feb 19, 2024
0fc93a7
Fixup of LanguageExt.Sys WIP
louthy Feb 20, 2024
772da63
Sys migration to generic monad and readers
louthy Feb 20, 2024
2d1293d
Sys refactor WIP
louthy Feb 20, 2024
6250106
Sys refactor WIP
louthy Feb 20, 2024
d95bc6d
Core and Sys builds!
louthy Feb 21, 2024
6aefc0f
All key libraries building!
louthy Feb 21, 2024
a36c8d7
`T` extensions for nested monadic types
louthy Feb 21, 2024
273d8aa
Missed last commit
louthy Feb 21, 2024
c4c9df3
Remove transformers project
louthy Feb 21, 2024
07df4f2
NOTES
louthy Feb 22, 2024
0fe5eaa
IO await
louthy Feb 22, 2024
8f645b9
Starting to get the release notes orgnaised (WIP)
louthy Feb 22, 2024
9cf0313
HasIO removal
louthy Feb 22, 2024
ab38c1a
WIP fixup of Examples
louthy Feb 23, 2024
09f45f0
First sample project compiling
louthy Feb 23, 2024
0a451e6
Unit tests WIP
louthy Feb 23, 2024
82afe55
New feature: Free monad
louthy Feb 24, 2024
1abfea9
Aff tests migrated
louthy Feb 24, 2024
870c556
Either to a class
louthy Feb 24, 2024
c818de8
Move to SemiAlternative
louthy Feb 24, 2024
895a41e
Missing from lat commit
louthy Feb 24, 2024
3a45774
Fin to records
louthy Feb 24, 2024
610b889
Validation to record
louthy Feb 24, 2024
f606165
Validation fixes
louthy Feb 25, 2024
b3c308b
Unit test fixups
louthy Feb 25, 2024
b9a0273
Reader and State monads
louthy Feb 25, 2024
0abe761
WriterT
louthy Feb 25, 2024
53c240f
Writer monad complete
louthy Feb 25, 2024
67390cb
More writer
louthy Feb 25, 2024
ef0dcff
More unit test fixups
louthy Feb 25, 2024
8321cad
Unit test fixup
louthy Feb 26, 2024
041ce6c
Unit tests
louthy Feb 26, 2024
b6338be
Correct namespace for Monoid and Semigroup
louthy Feb 27, 2024
27d48e3
Rename TypeClasses to Traits
louthy Feb 27, 2024
ecac7ca
Minor fixups
louthy Feb 27, 2024
9995558
Unit tests
louthy Feb 27, 2024
8e5a57a
Unit tests
louthy Feb 27, 2024
0516c42
Remove blog code!
louthy Feb 27, 2024
548ce09
All core libraries and unit tests compiling
louthy Feb 29, 2024
04d882f
Latest unit test
louthy Mar 1, 2024
53222c2
Fix for Error and Value recursive property
louthy Mar 1, 2024
dd19008
Monad transformer testing
louthy Mar 1, 2024
9413b75
Rename first and second to mapFirst and mapSecond
louthy Mar 1, 2024
ae1ce13
Refactor for Error handling
louthy Mar 2, 2024
5c8f285
IO fixes
louthy Mar 2, 2024
a2cf665
Refactor of IL trait resolver
louthy Mar 2, 2024
3028acd
Unit test fixes
louthy Mar 3, 2024
2c8635d
Fixes
louthy Mar 3, 2024
49cb32d
Traversal ordering
louthy Mar 3, 2024
164f682
Stop Error being implicitly convertable from String
louthy Mar 3, 2024
49c7c03
Traverse unit test fixes
louthy Mar 3, 2024
4e076a1
More unit tests
louthy Mar 3, 2024
5d2ff90
Unit tests
louthy Mar 3, 2024
91d765a
Unit test fixes
louthy Mar 4, 2024
fee3c2f
Unit test fixes
louthy Mar 4, 2024
006043c
All unit tests passing!
louthy Mar 4, 2024
728d5cd
5.0.0-alpha.1
louthy Mar 4, 2024
5d6face
Remove the need for Alternative from Free
louthy Mar 4, 2024
bc1813b
Readme updates
louthy Mar 4, 2024
8816853
Restore EffectsExample main
louthy Mar 4, 2024
f0635e2
Parallel applicatives
louthy Mar 5, 2024
8243766
Parallel IO apply
louthy Mar 5, 2024
b2f5280
As not needed
louthy Mar 5, 2024
2cd44cf
MonoidK and SemigroupK
louthy Mar 5, 2024
0775b0e
IO repeat and retry
louthy Mar 7, 2024
808be26
WPF sample project working
louthy Mar 9, 2024
3b1cf5b
Initial pass at continuations
louthy Mar 9, 2024
bee5bf1
Extensions refactor WIP
louthy Mar 14, 2024
d44f7c8
Foldable and Foldable extensions
louthy Mar 15, 2024
2fbf704
More refactoring of Foldable + Extensions
louthy Mar 16, 2024
9b3f628
Seq refactor
louthy Mar 16, 2024
8a9a982
More foldable fixups
louthy Mar 17, 2024
959b1a6
Monad fixup for foldable
louthy Mar 17, 2024
d24558d
Enumerable fixups
louthy Mar 17, 2024
26f463c
Parsec fix ups
louthy Mar 17, 2024
8141311
Sys fix ups
louthy Mar 17, 2024
88ff814
Unit test fix ups
louthy Mar 17, 2024
f5d8379
Unit test fixups
louthy Mar 18, 2024
9e2aa2b
Foldable fixes
louthy Mar 18, 2024
41c1335
Resolver improvements for K types
louthy Mar 19, 2024
b75f938
Range fixes
louthy Mar 19, 2024
7d902d0
More extensions removals
louthy Mar 19, 2024
e96ec85
Fixup examples
louthy Mar 19, 2024
288c06b
Extension removals
louthy Mar 19, 2024
d52dbbf
Remove fold from collections
louthy Mar 19, 2024
38d1cb9
.NET operator support
louthy Mar 19, 2024
33a2e4a
5.0.0-alpha.2
louthy Mar 19, 2024
0a1f626
Update pack to point at latest bestform
louthy Mar 19, 2024
6949132
Pipes stack overflow fixes
louthy Mar 20, 2024
40033eb
Fixup queue example
louthy Mar 21, 2024
63cd552
Pipe folding
louthy Mar 22, 2024
a6db5c7
Producer.merge fixes
louthy Mar 23, 2024
a1dcf34
5.0.0-alpha.3
louthy Mar 23, 2024
1ec30ab
Change the `|` operator to have actual OR like behaviour, `&` can be …
louthy Mar 23, 2024
e15b740
5.0.0-alpha.4
louthy Mar 23, 2024
a656df2
ApplyM extensions
louthy Mar 24, 2024
9a6a089
Doc fixups
louthy Mar 24, 2024
f97d5a0
5.0.0-alpha.5
louthy Mar 24, 2024
08f7233
Make await respect both cancellation tokens
louthy Mar 27, 2024
b6b5456
MemoryFS linux support
louthy Mar 27, 2024
fe7322b
Minor
louthy Mar 31, 2024
08eb724
License update
louthy Apr 15, 2024
11aa33e
Applicative lift update
louthy Apr 15, 2024
3161e4e
Applictive lift update
louthy Apr 15, 2024
500ae39
Renamed MapM and SequenceA
louthy Apr 16, 2024
4e4fb7f
TraverseM implementation for collection types
louthy Apr 16, 2024
16d6170
Fix TraverseExtensions
louthy Apr 16, 2024
63477e7
5.0.0-alpha.6
louthy Apr 16, 2024
11c2c8f
TraverseM
louthy Apr 18, 2024
c186a69
Merge remote-tracking branch 'origin/v5-transducers' into v5-transducers
louthy Apr 18, 2024
240a035
Free monad and IO improvements
louthy May 3, 2024
03648a1
Fix for: v5 resource tracking issue
louthy May 12, 2024
7119811
5.0.0-alpha.7
louthy May 12, 2024
cb541ab
WIP replace ResourceT
louthy May 15, 2024
9e5d7a4
Remove ResourceT and merge it into the IO monad functionality
louthy May 15, 2024
b0b7b82
Move Resources to IO folder
louthy May 15, 2024
c87f7fd
Fix for Task exception reporting
louthy May 15, 2024
5d8cf4b
v5.0.0-alpha.8
louthy May 16, 2024
a0f83d7
Make SelectMany overrides for IO work with K<IO, A> rather than IO<A>
louthy May 16, 2024
c57348a
Fix Bind in pipes
louthy May 16, 2024
9c5557a
5.0.0-alpha.9
louthy May 16, 2024
ca20705
New Try monad
louthy May 16, 2024
d94f3fe
v5.0.0-alpha.10
louthy May 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2014-2022 Paul Louth
Copyright (c) 2014-2024 Paul Louth

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions LanguageExt.Benchmarks/HashMapAddBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Immutable;
using BenchmarkDotNet.Attributes;
using LanguageExt.ClassInstances;
using LanguageExt.TypeClasses;
using LanguageExt.Traits;
using Sasa.Collections;
using static LanguageExt.Prelude;

Expand All @@ -12,7 +12,7 @@ namespace LanguageExt.Benchmarks
[GenericTypeArguments(typeof(int), typeof(OrdInt))]
[GenericTypeArguments(typeof(string), typeof(OrdString))]
public class HashMapAddBenchmarks<T, TOrd>
where TOrd : struct, Ord<T>
where TOrd : Ord<T>
{
[Params(100, 1000, 10000, 100000)]
public int N;
Expand Down
4 changes: 2 additions & 2 deletions LanguageExt.Benchmarks/HashMapContainsKeyBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Linq;
using BenchmarkDotNet.Attributes;
using LanguageExt.ClassInstances;
using LanguageExt.TypeClasses;
using LanguageExt.Traits;
using Sasa.Collections;

namespace LanguageExt.Benchmarks
Expand All @@ -12,7 +12,7 @@ namespace LanguageExt.Benchmarks
[GenericTypeArguments(typeof(int), typeof(OrdInt))]
[GenericTypeArguments(typeof(string), typeof(OrdString))]
public class HashMapContainsKeyBenchmarks<T, TOrd>
where TOrd : struct, Ord<T>
where TOrd : Ord<T>
{
[Params(100, 1000, 10000, 100000)]
public int N;
Expand Down
4 changes: 2 additions & 2 deletions LanguageExt.Benchmarks/HashMapIterateBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Immutable;
using BenchmarkDotNet.Attributes;
using LanguageExt.ClassInstances;
using LanguageExt.TypeClasses;
using LanguageExt.Traits;
using Sasa.Collections;

namespace LanguageExt.Benchmarks
Expand All @@ -11,7 +11,7 @@ namespace LanguageExt.Benchmarks
[GenericTypeArguments(typeof(int), typeof(OrdInt))]
[GenericTypeArguments(typeof(string), typeof(OrdString))]
public class HashMapIterateBenchmarks<T, TOrd>
where TOrd : struct, Ord<T>
where TOrd : Ord<T>
{
[Params(100, 1000, 10000, 100000)]
public int N;
Expand Down
4 changes: 2 additions & 2 deletions LanguageExt.Benchmarks/HashMapRandomRemovalBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Linq;
using BenchmarkDotNet.Attributes;
using LanguageExt.ClassInstances;
using LanguageExt.TypeClasses;
using LanguageExt.Traits;
using Sasa.Collections;

namespace LanguageExt.Benchmarks
Expand All @@ -12,7 +12,7 @@ namespace LanguageExt.Benchmarks
[GenericTypeArguments(typeof(int), typeof(OrdInt))]
[GenericTypeArguments(typeof(string), typeof(OrdString))]
public class HashMapRandomRemovalBenchmarks<T, TOrd>
where TOrd : struct, Ord<T>
where TOrd : Ord<T>
{
[Params(100, 1000, 10000, 100000)]
public int N;
Expand Down
4 changes: 2 additions & 2 deletions LanguageExt.Benchmarks/HashSetAddBenchmarks.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections.Immutable;
using BenchmarkDotNet.Attributes;
using LanguageExt.ClassInstances;
using LanguageExt.TypeClasses;
using LanguageExt.Traits;
using static LanguageExt.Prelude;

namespace LanguageExt.Benchmarks
Expand All @@ -10,7 +10,7 @@ namespace LanguageExt.Benchmarks
[GenericTypeArguments(typeof(int), typeof(OrdInt))]
[GenericTypeArguments(typeof(string), typeof(OrdString))]
public class HashSetAddBenchmarks<T, TOrd>
where TOrd : struct, Ord<T>
where TOrd : Ord<T>
{
[Params(100, 1000, 10000, 100000)]
public int N;
Expand Down
4 changes: 2 additions & 2 deletions LanguageExt.Benchmarks/HashSetContainsBenchmarks.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
using System.Collections.Immutable;
using BenchmarkDotNet.Attributes;
using LanguageExt.ClassInstances;
using LanguageExt.TypeClasses;
using LanguageExt.Traits;

namespace LanguageExt.Benchmarks
{
[RPlotExporter, RankColumn]
[GenericTypeArguments(typeof(int), typeof(OrdInt))]
[GenericTypeArguments(typeof(string), typeof(OrdString))]
public class HashSetContainsBenchmarks<T, TOrd>
where TOrd : struct, Ord<T>
where TOrd : Ord<T>
{
[Params(100, 1000, 10000, 100000)]
public int N;
Expand Down
4 changes: 2 additions & 2 deletions LanguageExt.Benchmarks/HashSetIterationBenchmarks.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
using System.Collections.Immutable;
using BenchmarkDotNet.Attributes;
using LanguageExt.ClassInstances;
using LanguageExt.TypeClasses;
using LanguageExt.Traits;

namespace LanguageExt.Benchmarks
{
[RPlotExporter, RankColumn]
[GenericTypeArguments(typeof(int), typeof(OrdInt))]
[GenericTypeArguments(typeof(string), typeof(OrdString))]
public class HashSetIterationBenchmarks<T, TOrd>
where TOrd : struct, Ord<T>
where TOrd : Ord<T>
{
[Params(100, 1000, 10000, 100000)]
public int N;
Expand Down
4 changes: 2 additions & 2 deletions LanguageExt.Benchmarks/HashSetRandomRemovalBenchmarks.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
using System.Collections.Immutable;
using BenchmarkDotNet.Attributes;
using LanguageExt.ClassInstances;
using LanguageExt.TypeClasses;
using LanguageExt.Traits;

namespace LanguageExt.Benchmarks
{
[RPlotExporter, RankColumn]
[GenericTypeArguments(typeof(int), typeof(OrdInt))]
[GenericTypeArguments(typeof(string), typeof(OrdString))]
public class HashSetRandomRemovalBenchmarks<T, TOrd>
where TOrd : struct, Ord<T>
where TOrd : Ord<T>
{
[Params(100, 1000, 10000, 100000)]
public int N;
Expand Down
2 changes: 1 addition & 1 deletion LanguageExt.Benchmarks/LanguageExt.Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions LanguageExt.Benchmarks/ListAddBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Immutable;
using BenchmarkDotNet.Attributes;
using LanguageExt.ClassInstances;
using LanguageExt.TypeClasses;
using LanguageExt.Traits;
using static LanguageExt.Prelude;

namespace LanguageExt.Benchmarks
Expand All @@ -11,7 +11,7 @@ namespace LanguageExt.Benchmarks
[GenericTypeArguments(typeof(int), typeof(OrdInt))]
[GenericTypeArguments(typeof(string), typeof(OrdString))]
public class ListAddBenchmarks<T, TOrd>
where TOrd : struct, Ord<T>
where TOrd : Ord<T>
{
[Params(100, 1000, 10000, 100000)]
public int N;
Expand Down
6 changes: 3 additions & 3 deletions LanguageExt.Benchmarks/ListIterationBenchmarks.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections.Immutable;
using BenchmarkDotNet.Attributes;
using LanguageExt.ClassInstances;
using LanguageExt.TypeClasses;
using LanguageExt.Traits;
using static LanguageExt.Prelude;

namespace LanguageExt.Benchmarks
Expand All @@ -10,7 +10,7 @@ namespace LanguageExt.Benchmarks
[GenericTypeArguments(typeof(int), typeof(OrdInt))]
[GenericTypeArguments(typeof(string), typeof(OrdString))]
public class ListIterationBenchmarks<T, TOrd>
where TOrd : struct, Ord<T>
where TOrd : Ord<T>
{
[Params(100, 1000, 10000, 100000)]
public int N;
Expand All @@ -25,7 +25,7 @@ public void Setup()
{
values = ValuesGenerator.Default.GenerateUniqueValues<T>(N);
immutableList = ImmutableList.CreateRange(ValuesGenerator.Default.GenerateUniqueValues<T>(N));
lst = ValuesGenerator.Default.GenerateUniqueValues<T>(N).Freeze();
lst = ValuesGenerator.Default.GenerateUniqueValues<T>(N).AsEnumerableM().ToLst();
seq = toSeq(ValuesGenerator.Default.GenerateUniqueValues<T>(N)).Strict();
}

Expand Down
6 changes: 3 additions & 3 deletions LanguageExt.Benchmarks/ValuesGenerator.MapSetup.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using LanguageExt.TypeClasses;
using LanguageExt.Traits;
using Sasa.Collections;
using static LanguageExt.Prelude;

Expand Down Expand Up @@ -52,7 +52,7 @@ public static Dictionary<T, T> SysColDictionarySetup<T>(Dictionary<T, T> values)
}

public static HashMap<TEq, T, T> LangExtHashMapSetup<T, TEq>(Dictionary<T, T> values)
where TEq : struct, Eq<T>
where TEq : Eq<T>
{
var hashMap = HashMap<TEq, T, T>();
foreach (var kvp in values)
Expand All @@ -64,7 +64,7 @@ public static HashMap<TEq, T, T> LangExtHashMapSetup<T, TEq>(Dictionary<T, T> va
}

public static Map<TOrd, T, T> LangExtMapSetup<T, TOrd>(Dictionary<T, T> values)
where TOrd : struct, Ord<T>
where TOrd : Ord<T>
{
var hashMap = Map<TOrd, T, T>();
foreach (var kvp in values)
Expand Down
6 changes: 3 additions & 3 deletions LanguageExt.Benchmarks/ValuesGenerator.SetSetup.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Collections.Immutable;
using LanguageExt.TypeClasses;
using LanguageExt.Traits;
using static LanguageExt.Prelude;

namespace LanguageExt.Benchmarks
Expand Down Expand Up @@ -40,7 +40,7 @@ public static System.Collections.Generic.HashSet<T> SysColHashSetSetup<T>(T[] va
}

public static HashSet<TEq, T> LangExtHashSetSetup<T, TEq>(T[] values)
where TEq : struct, Eq<T>
where TEq : Eq<T>
{
var hashSet = HashSet<TEq, T>();
foreach (var value in values)
Expand All @@ -52,7 +52,7 @@ public static HashSet<TEq, T> LangExtHashSetSetup<T, TEq>(T[] values)
}

public static Set<TOrd, T> LangExtSetSetup<T, TOrd>(T[] values)
where TOrd : struct, Ord<T>
where TOrd : Ord<T>
{
var set = Set<TOrd, T>();
foreach (var value in values)
Expand Down
79 changes: 61 additions & 18 deletions LanguageExt.Core/Catch.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,66 @@
using System;
using LanguageExt.Common;
using LanguageExt.Traits;

namespace LanguageExt
namespace LanguageExt;

/// <summary>
/// Used by `@catch`, `@exceptional`, `@expected` to represent the catching of errors
/// </summary>
public readonly record struct CatchValue<A>(Func<Error, bool> Match, Func<Error, A> Value)
{
public CatchValue<Error, A> As() =>
new (Match, Value);
}

/// <summary>
/// Used by `@catch`, `@exceptional`, `@expected` to represent the catching of errors
/// </summary>
public readonly record struct CatchValue<E, A>(Func<E, bool> Match, Func<E, A> Value);

/// <summary>
/// Used by `@catch`, `@exceptional`, `@expected` to represent the catching of errors
/// </summary>
public readonly record struct CatchError(Func<Error, bool> Match, Func<Error, Error> Value)
{
public CatchError<Error> As() =>
new (Match, Value);
}

/// <summary>
/// Used by `@catch`, `@exceptional`, `@expected` to represent the catching of errors
/// </summary>
public readonly record struct CatchError<E>(Func<E, bool> Match, Func<E, E> Value);

/// <summary>
/// Used by `@catch`, `@exceptional`, `@expected` to represent the catching of errors
/// </summary>
public readonly record struct CatchIO<A>(Func<Error, bool> Match, Func<Error, IO<A>> Value)
{
public readonly struct CatchValue<A>
{
public readonly Func<Error, bool> Match;
public readonly Func<Error, A> Value;

public CatchValue(Func<Error, bool> match, Func<Error, A> value) =>
(Match, Value) = (match, value);
}

public readonly struct CatchError
{
public readonly Func<Error, bool> Match;
public readonly Func<Error, Error> Value;

public CatchError(Func<Error, bool> match, Func<Error, Error> value) =>
(Match, Value) = (match, value);
}
public CatchIO<Error, A> As() =>
new (Match, Value);
}

/// <summary>
/// Used by `@catch`, `@exceptional`, `@expected` to represent the catching of errors
/// </summary>
public readonly record struct CatchIO<E, A>(Func<E, bool> Match, Func<E, IO<A>> Value);

/// <summary>
/// Used by `@catch`, `@exceptional`, `@expected` to represent the catching of errors
/// </summary>
public readonly record struct CatchM<M, A>(Func<Error, bool> Match, Func<Error, K<M, A>> Value)
{
public K<M, A> Run(Error error, K<M, A> otherwise) =>
Match(error) ? Value(error) : otherwise;
}

/// <summary>
/// Used by `@catch`, `@exceptional`, `@expected` to represent the catching of errors
/// </summary>
public readonly record struct CatchM<M, E, A>(Func<E, bool> Match, Func<E, K<M, A>> Value)
{
public K<M, A> Run(E error, K<M, A> otherwise) =>
Match(error) ? Value(error) : otherwise;
}

Loading