fsprojects / fsprojects/FSharpPlus
Validation shouldn't have Empty
Nobody has claimed this yet.
- Dominant language
- F#
- Stars
- 941
- Forks
- 106
- PR merge metrics
- No merged PRs in 30d
Description
The type Validation belongs to the Alt abstraction (operation <|>) but not to the Alternative abstraction (operation <|> and empty element).
Why?
Because it doesn't obey the Alternative rule empty <*> f = empty
Here's a repro:
> let (e: Validation<string list,int>) = empty
val e : Validation<string list,int> = Failure []
// but
> let (x: Validation<string list,int>) = empty <*> Failure [""] ;;
val x : Validation<string list,int> = Failure [""]
> e = x ;;
val it : bool = false
I can't see the Alternative instance in the Haskell implementation, if it ever was there now they removed it.
What to do?
We can't remove it now, because of backwards compatibility issues. We'll have to wait until v2.0
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the Validation type and its Alternative operations, especially empty and <*>; compare the reported behavior with the Haskell implementation mentioned in the issue. The work is complete when the v2.0 compatibility plan resolves the invalid Alternative behavior without leaving the documented law violation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fsharp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100