Skip to content

Experiment with F#, type holes, and type-directed search using F# Analyzers

License

Notifications You must be signed in to change notification settings

ionide/FSharp.EventHorizon

Repository files navigation

FSharp.EventHorizon

An experiment attempting to implement type holes and type-directed search/valid hole fits using F# analyzers. Long story short, it's an attempt of suggesting replacement for the unkown functions using type inferences and finding other entities that have fitting type signature.

Unlike some of the solutions for other FP languages this is not feature implemented directly in compiler, nor is feature of particular IDE, but it's using F# Analyzers.

Read more about F# Analyzers:

Limitations

F# Compiler Service is not exposing any API for subsumption of types. I've implemented really naive algorithm to check if entity can fit given type hole... but well, it's definitely not following 100% rules of the F# compiler, so not every suggestion is found.

I think that this limitation is acceptable given that the project is in experiment phase - if it were productized, we would need to expose those missing APIs from F# Compiler Services, so investing more into custom algorithm here would be waste of time

How to build

  1. Install requirements - .Net SDK 3.0, and Paket global tool
  2. Clone the repo
  3. dotnet build

How to play with it

First of all build repository.

In editor - just open this repository in VSCode with Ionide installed (4.4.2 required). Go to sample project, and open Program.fs file. The call of hole functions should be marked as warning and there should be a lightbulb quick action suggesting different possible replacements

From command line - install latest version of fsharp-analyzers CLI tool (0.2.0). From the root of repository run following command - fsharp-analyzers --project sample/FSharp.EventHorizon.Sample/FSharp.EventHorizon.Sample.fsproj --analyzers-path src/FSharp.EventHorizon.Analyzer/bin

How to contribute

Imposter syndrome disclaimer: I want your help. No really, I do.

There might be a little voice inside that tells you you're not ready; that you need to do one more tutorial, or learn another framework, or write a few more blog posts before you can help me with this project.

I assure you, that's not the case.

This project has some clear Contribution Guidelines and expectations that you can read here.

The contribution guidelines outline the process that you'll need to follow to get a patch merged. By making expectations and process explicit, I hope it will make it easier for you to contribute.

And you don't just have to write code. You can help out by writing documentation, tests, or even by giving feedback about this work. (And yes, that includes giving feedback about the contribution guidelines.)

Thank you for contributing!

Contributing and copyright

The project is hosted on GitHub where you can report issues, fork the project and submit pull requests.

The library is available under MIT license, which allows modification and redistribution for both commercial and non-commercial purposes.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

About

Experiment with F#, type holes, and type-directed search using F# Analyzers

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Languages