FSharpx.Extras icon indicating copy to clipboard operation
FSharpx.Extras copied to clipboard

Duplicates and naming

Open Evangelink opened this issue 10 years ago • 4 comments

Hi,

First of all, thank you for this helpful library.

I'd like to report here a duplication of the same method with 3 names (ofBoolAndValue, fromTryPattern, tryParseWith). let a = Double.TryParse "2" |> Option.ofBoolAndValue let b = Option.fromTryPattern Double.TryParse "2" let c = Option.tryParseWith Double.TryParse "2"

Also, I was wondering if you should not rename the Option.concat to Option.flatten or Option.switch (to look like Observable.switch) because the name is quite misleading and actually doesn't concat some options.

Cheers

Evangelink avatar Jul 30 '15 15:07 Evangelink

Good point about those duplicate functions. Too many people contributing without discussing things I guess.

About Option.concat, it's the same concept as the built-in List.concat i.e. m (m a) -> m a

mausch avatar Jul 30 '15 16:07 mausch

Don't know how you want to handle things but if you need some help, feel free to ask/contact me.

Evangelink avatar Jul 31 '15 08:07 Evangelink

m (m a) -> m a

shouldn't we name it join

sideeffffect avatar Oct 31 '16 10:10 sideeffffect

4th variant:

let d = Double.TryParse "2" |> toOption

https://github.com/fsprojects/FSharpx.Extras/blob/master/src/FSharpx.Extras/Prelude.fs#L89-L92

gdziadkiewicz avatar Feb 23 '20 10:02 gdziadkiewicz