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

Documentation for F# #97

Open
nabeelvalley opened this issue Oct 28, 2019 · 10 comments
Open

Documentation for F# #97

nabeelvalley opened this issue Oct 28, 2019 · 10 comments

Comments

@nabeelvalley
Copy link
Contributor

nabeelvalley commented Oct 28, 2019

Would there be an interest in adding code samples for F#?

I wouldn't mind working on it (as far as I can of course)

@odinserj
Copy link
Member

Does Hangfire work well for F#? I expected some more work is required to bring "native" experience there. Anyway this is an interesting idea, but I'm unsure how multiple languages will look in the docs. I've just found a plugin for Sphinx that allows code examples for multiple languages that may solve some issues.

@nabeelvalley
Copy link
Contributor Author

I've used it very at a very basic level thus far and I can definitely say that it "works" but will try to actually run through some of the examples from the doc and put together some parallels so you can take a look at it

@odinserj
Copy link
Member

Sounds great, maybe it's better to start first with a small page with several snippets to see how it will look like.

@nabeelvalley
Copy link
Contributor Author

nabeelvalley commented Nov 16, 2019

Hey, so I've taken a look at the package and it doesn't seem to really do much - it looks like it just adds two code blocks, and I assume you'd then have to include the CSS and JS, but this installs in my local and I'm not sure what it looks like. This is the output without that enabled

This is with the CSS and JS enabled (I just copied it manually into the build directory), the toggles don't really work correctly either

image

Also, I'm not too sure if we would need to include the extension in the repo itself, the documentation is not too clear on that, also note the RST and HTML output for the code blocks below

.. example-code::
   .. code-block:: csharp
      
      // ...
      using Microsoft.Extensions.DependencyInjection;
      using Hangfire;
      using Hangfire.SqlServer;
   
   .. code-block:: fsharp
        
      // ...
      open Microsoft.Extensions.DependencyInjection;
      open Hangfire
      open Hangfire.SqlServer
<div class="example-code docutils container">
<div class="highlight-csharp notranslate"><div class="highlight"><pre><span></span><span class="c1">// ...</span>
<span class="k">using</span> <span class="nn">Microsoft.Extensions.DependencyInjection</span><span class="p">;</span>
<span class="k">using</span> <span class="nn">Hangfire</span><span class="p">;</span>
<span class="k">using</span> <span class="nn">Hangfire.SqlServer</span><span class="p">;</span>
</pre></div>
</div>
<div class="highlight-fsharp notranslate"><div class="highlight"><pre><span></span><span class="c1">// ...</span>
<span class="k">open</span> <span class="nn">Microsoft.Extensions.DependencyInjection</span><span class="o">;</span>
<span class="k">open</span> <span class="nn">Hangfire</span>
<span class="k">open</span> <span class="nn">Hangfire.SqlServer</span>
</pre></div>
</div>
</div>

I couldn't use the emphasize-lines thing either as this threw an error on the function that generates the blocks maximum 1 argument(s) allowed, 3 supplied.

@odinserj
Copy link
Member

So it’s 2019 and there are still a lot of things to be done in software for writing docs 😅

So it’s hard to guess what the result would look like, and without the whole picture it’s hard to make decisions.

What do you think about a separate page for using Hangfire in F# instead with some overview of the common usage patterns?

It would be much simpler to start with and doesn’t require to make global choices.

@nabeelvalley
Copy link
Contributor Author

nabeelvalley commented Nov 16, 2019 via email

@natalie-o-perret
Copy link

@nabeelvalley it is different, the biggest issue is about the way reflection is achieved with F# functions, what you can see in Dashboard UI can appear rather clunky and misleading.

@jannesiera
Copy link

What is the status of Hangfire + F#? Is it stable? We're looking into using Hangfire (although we might have to write our own extension to add scheduling jobs from the dashboard and allow passing parameters to said job). Our intention is to do all of this from F# but if we can't be certain things work we might have to explore other options as we are restricted in resources.

@abelbraaksma
Copy link

reflection is achieved with F# functions, what you can see in Dashboard UI can appear rather clunky and misleading.

perhaps an idea is to cast them to Func, which would reflect better.

@natalie-o-perret
Copy link

natalie-o-perret commented Jun 23, 2023

reflection is achieved with F# functions, what you can see in Dashboard UI can appear rather clunky and misleading.

perhaps an idea is to cast them to Func, which would reflect better.

In-place casting of anonymous F# functions to Func<...> is what works best in my experience.
The only downside, is that you don't really get to see the implementation preview (unlike with regular C# methods) but at least it's not too much of a clunky display: https://github.com/natalie-o-perret/how-to-experiments/tree/main/fsharp/how-to-add-hangfire-console-logs
This is an aul' repo that I use occasionally to test whether some libs need adjustments and whatnot.

[EDIT]
Also, worth mentioning that there is (I believe) new repo available now, https://github.com/HangfireIO/Hangfire.DynamicJobs
Which might also help further customizing some use cases relevant to F#.

Hope that helpes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants