-
Notifications
You must be signed in to change notification settings - Fork 146
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
Typeclasses #24
Typeclasses #24
Conversation
…ype Inference. It could be implemented later with a wrapper. - Instances for IEnumerator: Was a dummy instance to help Type Inference with seq.
Some comments removed.
Old code from Monoid and Reader removed.
+ Type annotations to guide type inference to the right signature.
This looks good to me. |
what's the status on this? |
@forki see discussion above. This needs more use to uncover all problems so we can make an informed decision about making this part of master. |
Have there been any news on this subject? |
@ohwow status is still the same. Any input would be appreciated (in the mailing list). |
Just as an update: I have been working a little on this in my fork: https://github.com/mausch/fsharpx/tree/typeclasses, and found a number of cases where type inference breaks or seemingly correct code won't typecheck. |
Hi As Mauricio said, I'm working in an alternative solution. http://code.google.com/p/fsharp-typeclasses/#Alternative_Solution It requires to fix a bug in the F# Parser, but it's included, so you can Regards Gustavo On 8 May 2012 17:37, Mauricio Scheffer <
|
@ffogd helped out with a couple of issues: mausch@eda97d6#commitcomment-1613711 mausch@4d2f760#commitcomment-1613633 |
Q: Why did you choose Choice1of2 as the "Right Choice"? Is there any special reason? |
Async.Catch uses that convention, so we went with that.
For instances, I think you can use a Flip type combinator, though I'm not sure and it would still be kinda annoying. |
OK, I guess that's a good reason. My next question is about Nullable. |
Good point, I didn't realize that Nullable isn't really a monad. I don't think it's even a functor. |
I think is a Restricted Monad, like Ord a => Set a (F# notation: Set<'a> In Haskell it's a problem to code Restricted Monads, you need an extension, For now,as you said, we can just add a comment making it very explicit that Gustavo On 30 August 2012 20:19, Mauricio Scheffer notifications@github.com wrote:
|
What's the status on this? |
Since I did this pull request, this approach was refined and finally I decided to create a new Project: FsControl. The goal is to get the same functionality but in a less intrusive way, I mean not forcing everybody to a specific name convention or style (Haskell vs F#). At the same time there were some discussions about splitting FSharpx in separated DLLs. It contains just the basic overloads but does not define generic functions, so if used in FSharpx or other project it's the project which should create the generic functions. FsControl is basically an overload repository, there might be projects that add overloads to it, projects that use the overloads for generic functions and projects that do both. For F#x I propose to link this dll, add overloads for all Monads, Applicatives, etc and eventually define some generic functions inside a module for people wanting to use this approach. UPDATEFsControl is dead, now we have F#+ and we don't need to link anything, as long as we add static members with the required signature both projects will integrate nicely. |
Whether in FSharpx or the new FsControl project, please write XML comments (documentation) on all types and functions, and write a comprehensive readme.md. Otherwise this excellent work is only accessible to the most motivated individuals. The way to spread adoption of F# is to make work like this more accessible. |
Also worth noting is that this has to be within FSharpx, i.e. if we want As the Haskell wiki says in http://www.haskell.org/haskellwiki/Orphan_instance : "If you encounter a missing instance for a class or a type of a package, resist to define your own orphan instance, because it will likely collide with such instances of other packages, or it will collide with new instances added in later versions of that package. Instead ask the package author to add your instance." I'd just take the dependency on FsControl. Since FsControl doesn't export any operators or even functions, we can later decide whether we want to add a new module with the overloaded functions/operators binding to typeclasses or not, but that would be a separate discussion. Also, this wouldn't have any impact on current client code of FSharpx. Users would be able to choose between the typeclassy way of doing things, or the traditional, more fsharpish style. Both have pros and cons. |
Can we close/archive this request? It is very old. |
Existing code was refactored in order to define Typeclasses in a more generic way.