<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Fsharp on queil.net</title>
    <link>https://queil.net/tags/fsharp/</link>
    <description>Recent content in Fsharp on queil.net</description>
    <generator>Hugo</generator>
    <language>en-uk</language>
    <lastBuildDate>Wed, 14 Dec 2022 03:20:00 +0000</lastBuildDate>
    <atom:link href="https://queil.net/tags/fsharp/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>F# - an introduction for my colleagues</title>
      <link>https://queil.net/2022/12/fsharp-an-introduction-for-my-colleagues/</link>
      <pubDate>Wed, 14 Dec 2022 03:20:00 +0000</pubDate>
      <guid>https://queil.net/2022/12/fsharp-an-introduction-for-my-colleagues/</guid>
      <description>&lt;p&gt;&lt;em&gt;This article was originally published on the &lt;a href=&#34;https://www.accounttechnologies.com/blog/f-an-introduction-for-my-colleagues&#34;&gt;Account Technologies Tech Blog&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2 id=&#34;motivation&#34; class=&#34;anchor-link&#34;&gt;&lt;a href=&#34;#motivation&#34;&gt;Motivation&lt;span class=&#34;pilcrow&#34;&gt;&amp;nbsp;¶&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;Having used quite a few programming languages in numerous projects(C#, Powershell, TypeScript, Groovy, and others), my favourite so far is F#. In this article, I want to present to you the unique traits of F# as a pragmatic functional-first language. Hopefully, this article is a mild and concise introduction to F# for people using other languages.&lt;/p&gt;&#xA;&#xA;&lt;h2 id=&#34;what-is-f&#34; class=&#34;anchor-link&#34;&gt;&lt;a href=&#34;#what-is-f&#34;&gt;What is F#&lt;span class=&#34;pilcrow&#34;&gt;&amp;nbsp;¶&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;F# is a pragmatic general-purpose programming language. Its core design goals were:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Gmox Grpc Mock Server</title>
      <link>https://queil.net/2021/12/gmox-grpc-mock-server/</link>
      <pubDate>Sun, 26 Dec 2021 13:06:58 +0000</pubDate>
      <guid>https://queil.net/2021/12/gmox-grpc-mock-server/</guid>
      <description>&lt;p&gt;TLDR: I created &lt;a href=&#34;https://github.com/queil/gmox&#34;&gt;Gmox&lt;/a&gt; - a .NET-friendly gRPC mock server.&lt;/p&gt;&#xA;&#xA;&lt;h2 id=&#34;what-is-gmox&#34; class=&#34;anchor-link&#34;&gt;&lt;a href=&#34;#what-is-gmox&#34;&gt;What is Gmox&lt;span class=&#34;pilcrow&#34;&gt;&amp;nbsp;¶&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;It is a gRPC mock server similar to &lt;a href=&#34;https://github.com/tokopedia/gripmock&#34;&gt;grip-mock&lt;/a&gt; but written in F# and distributed as a dotnet cli tool and a dotnet template.&lt;/p&gt;&#xA;&#xA;&lt;h2 id=&#34;why-create-one-if-other-implementations-already-exist&#34; class=&#34;anchor-link&#34;&gt;&lt;a href=&#34;#why-create-one-if-other-implementations-already-exist&#34;&gt;Why create one if other implementations already exist&lt;span class=&#34;pilcrow&#34;&gt;&amp;nbsp;¶&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;I wanted to create something easy to use for (my fellow- and all other) .NET developers.&lt;/p&gt;&#xA;&lt;p&gt;I had the following scenarios in mind:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Development - enable developers to quickly spin up a mock server instance from local proto files.&lt;/li&gt;&#xA;&lt;li&gt;Testing - enable testers to deploy a mock server as a part of a test scenario and control it during a test run.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Also I had the following requirements:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Dependency Trees With Fable and Sutil</title>
      <link>https://queil.net/2021/12/dependency-trees-with-fable-and-sutil/</link>
      <pubDate>Sat, 04 Dec 2021 15:04:33 +0000</pubDate>
      <guid>https://queil.net/2021/12/dependency-trees-with-fable-and-sutil/</guid>
      <description>&lt;h1 id=&#34;motivation&#34; class=&#34;anchor-link&#34;&gt;&lt;a href=&#34;#motivation&#34;&gt;Motivation&lt;span class=&#34;pilcrow&#34;&gt;&amp;nbsp;¶&lt;/span&gt;&lt;/a&gt;&lt;/h1&gt;&#xA;&lt;p&gt;One of my colleagues has recently mentioned they can hardly follow the dependency tree of YAML-configured systems like &lt;a href=&#34;https://kustomize.io/&#34;&gt;kustomize&lt;/a&gt; or &lt;a href=&#34;https://docs.gitlab.com/ee/ci/&#34;&gt;GitLab CI&lt;/a&gt;. Both mentioned technologies enable configuration reuse via&#xA;composition and inheritance. Obviously the reuse comes with an increased complexity which may be overwhelming for a newcomer. To lower the learning curve I wanted to create a tool that would allow an ad-hoc tree traversal and visualisation. I am excited as it requires reaching beyond my comfort zone. Straight to the realm of front-end.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Embedding F# Compiler: Fsc-Host NuGet</title>
      <link>https://queil.net/2021/10/embedding-fsharp-compiler-fsc-host-nuget/</link>
      <pubDate>Sat, 16 Oct 2021 12:12:10 +0100</pubDate>
      <guid>https://queil.net/2021/10/embedding-fsharp-compiler-fsc-host-nuget/</guid>
      <description>&lt;p&gt;I have created a NuGet package that lets you easily use F# scripting in your apps.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;NuGet: &lt;a href=&#34;https://www.nuget.org/packages/Queil.FSharp.FscHost&#34;&gt;https://www.nuget.org/packages/Queil.FSharp.FscHost&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Source: &lt;a href=&#34;https://github.com/queil/fsc-host&#34;&gt;https://github.com/queil/fsc-host&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2 id=&#34;what-is-this-all-about&#34; class=&#34;anchor-link&#34;&gt;&lt;a href=&#34;#what-is-this-all-about&#34;&gt;What is this all about?&lt;span class=&#34;pilcrow&#34;&gt;&amp;nbsp;¶&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;In two previous posts (&lt;a href=&#34;https://queil.net/2021/05/embedding-fsharp-compiler/&#34;&gt;1&lt;/a&gt;, &lt;a href=&#34;https://queil.net/2021/06/embedding-fsharp-compiler-nuget-references/&#34;&gt;2&lt;/a&gt;) I showed you how to host the F# compiler in your own applications.&#xA;This time I wanted to reveal the result of those experiments.&#xA;I wanted to enable F# scripting in a few of my apps. This requirement made me create the &lt;a href=&#34;https://github.com/queil/fsc-host&#34;&gt;Fsc Host&lt;/a&gt; project. The goal was to create a light-weight reusable abstraction over &lt;code&gt;FSharp.Compiler.Service&lt;/code&gt; focused on compiling scripts and consuming them by the hosting application. The NuGet package is &lt;a href=&#34;https://www.nuget.org/packages/Queil.FSharp.FscHost&#34;&gt;available here&lt;/a&gt;. The project is still in the experimental phase (version 0) so the API and available features may change, (and the changes may be breaking so bear that in mind before using it in your projects).&lt;/p&gt;</description>
    </item>
    <item>
      <title>Embedding F# Compiler: NuGet References</title>
      <link>https://queil.net/2021/06/embedding-fsharp-compiler-nuget-references/</link>
      <pubDate>Fri, 04 Jun 2021 08:52:26 +0100</pubDate>
      <guid>https://queil.net/2021/06/embedding-fsharp-compiler-nuget-references/</guid>
      <description>&lt;p&gt;UPDATE: If you are looking for a ready to use solution please check out my &lt;a href=&#34;https://github.com/queil/fsc-host&#34;&gt;fsc-host&lt;/a&gt; NuGet package. Also I wrote a &lt;a href=&#34;https://queil.net/2021/10/embedding-fsharp-compiler-fsc-host-nuget/&#34;&gt;blog post&lt;/a&gt; about it.&lt;/p&gt;&#xA;&#xA;&lt;h2 id=&#34;intro&#34; class=&#34;anchor-link&#34;&gt;&lt;a href=&#34;#intro&#34;&gt;Intro&lt;span class=&#34;pilcrow&#34;&gt;&amp;nbsp;¶&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;In the &lt;a href=&#34;https://queil.net/2021/05/embedding-fsharp-compiler/&#34;&gt;previous post&lt;/a&gt; I showed how to extend an F# application with scripting capabilities. This time I want to extend the previous example with the &lt;a href=&#34;https://docs.microsoft.com/en-us/dotnet/fsharp/tools/fsharp-interactive/#referencing-packages-in-f-interactive&#34;&gt;#r directive&lt;/a&gt; support and resolving NuGet dependencies.&lt;/p&gt;&#xA;&#xA;&lt;h2 id=&#34;how-to&#34; class=&#34;anchor-link&#34;&gt;&lt;a href=&#34;#how-to&#34;&gt;How to&lt;span class=&#34;pilcrow&#34;&gt;&amp;nbsp;¶&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;On high level we need to extract NuGet packages information from the script and pass it to the compiler as additional arguments. Before compiling we also need to dynamically load the referenced dlls to the host application. I first took the naive approach of parsing and extracting the directives from AST and feeding them into &lt;code&gt;FSharpDependencyManager&lt;/code&gt;. It worked to an extent. Luckily, &lt;code&gt;FsChecker&lt;/code&gt; comes with a built-in solution. We can use &lt;code&gt;GetProjectOptionsFromScript&lt;/code&gt; and subsequently &lt;code&gt;ParseAndCheckProject&lt;/code&gt; methods. That way we can retrieve &lt;code&gt;DependencyFiles&lt;/code&gt; and extract resolved dlls&amp;rsquo; paths.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Embedding F# Compiler</title>
      <link>https://queil.net/2021/05/embedding-fsharp-compiler/</link>
      <pubDate>Sat, 29 May 2021 10:03:24 +0100</pubDate>
      <guid>https://queil.net/2021/05/embedding-fsharp-compiler/</guid>
      <description>&lt;p&gt;UPDATE: If you are looking for a ready to use solution please check out my &lt;a href=&#34;https://github.com/queil/fsc-host&#34;&gt;fsc-host&lt;/a&gt; NuGet package. Also I wrote a &lt;a href=&#34;https://queil.net/2021/10/embedding-fsharp-compiler-fsc-host-nuget/&#34;&gt;blog post&lt;/a&gt; about it.&lt;/p&gt;&#xA;&#xA;&lt;h2 id=&#34;motivation&#34; class=&#34;anchor-link&#34;&gt;&lt;a href=&#34;#motivation&#34;&gt;Motivation&lt;span class=&#34;pilcrow&#34;&gt;&amp;nbsp;¶&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;Embedded scripting is one of the ways of providing flexibility to compiled applications. It is not free from problems (performance penalty, security issues, additional tooling is required). But if your goal is a ceremony-free flexibility for the end-user then scripting is a very robust way&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt; . F# comes with great capabilities in this area. I want to show you how you can extend your otherwise statically compiled program with scripting.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Give it a try: Safe</title>
      <link>https://queil.net/2018/05/give-it-a-try-safe/</link>
      <pubDate>Wed, 16 May 2018 07:46:11 +0100</pubDate>
      <guid>https://queil.net/2018/05/give-it-a-try-safe/</guid>
      <description>&lt;h2 id=&#34;intro&#34; class=&#34;anchor-link&#34;&gt;&lt;a href=&#34;#intro&#34;&gt;Intro&lt;span class=&#34;pilcrow&#34;&gt;&amp;nbsp;¶&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;I&amp;rsquo;ve recently learnt about the &lt;a href=&#34;https://safe-stack.github.io/&#34;&gt;SAFE Stack&lt;/a&gt;. It&amp;rsquo;s F# all the way from the client to the server side. It&amp;rsquo;s a fantastic news for back-end people (knowing F#). There is no need of learning intricacies of JavaScript. You can focus on productivity instead. In this post I just want to show you how quickly you can start developing.&lt;/p&gt;&#xA;&#xA;&lt;h2 id=&#34;first-safe-app&#34; class=&#34;anchor-link&#34;&gt;&lt;a href=&#34;#first-safe-app&#34;&gt;First SAFE app&lt;span class=&#34;pilcrow&#34;&gt;&amp;nbsp;¶&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;&#xA;&#xA;&lt;h4 id=&#34;prerequisites&#34; class=&#34;anchor-link&#34;&gt;&lt;a href=&#34;#prerequisites&#34;&gt;Prerequisites&lt;span class=&#34;pilcrow&#34;&gt;&amp;nbsp;¶&lt;/span&gt;&lt;/a&gt;&lt;/h4&gt;&#xA;&lt;p&gt;.Net Core 2, Node.js, Yarn. Make sure you&amp;rsquo;ve got it all. Then just open shell and let&amp;rsquo;s type.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Finding references in C# code with Roslyn and F#</title>
      <link>https://queil.net/2018/02/finding-references-in-csharp-code-with-roslyn-and-fsharp/</link>
      <pubDate>Tue, 20 Feb 2018 19:58:29 +0000</pubDate>
      <guid>https://queil.net/2018/02/finding-references-in-csharp-code-with-roslyn-and-fsharp/</guid>
      <description>&lt;h2 id=&#34;introduction&#34; class=&#34;anchor-link&#34;&gt;&lt;a href=&#34;#introduction&#34;&gt;Introduction&lt;span class=&#34;pilcrow&#34;&gt;&amp;nbsp;¶&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;The most of .NET developers use &lt;a href=&#34;https://github.com/dotnet/roslyn&#34;&gt;Roslyn&lt;/a&gt; (the .NET Compiler) everyday. But apart from compiling code it comes with a versatile APIs used for syntax highlighting, analyzers, navigation tools just to name the most typical ones. I want to show you how to use it in your own tools. This time I want a tiny tool that finds all usages of a class&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt; in a solution&lt;sup id=&#34;fnref:2&#34;&gt;&lt;a href=&#34;#fn:2&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;2&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h2 id=&#34;lets-code&#34; class=&#34;anchor-link&#34;&gt;&lt;a href=&#34;#lets-code&#34;&gt;Let&amp;rsquo;s code&lt;span class=&#34;pilcrow&#34;&gt;&amp;nbsp;¶&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;&lt;em&gt;I picked F# as my language of choice for this post. The code is easily translatable to C# though. All the code from the article you can &lt;a href=&#34;https://github.com/queil/Queil.CodeRules.Analysis&#34;&gt;access here&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
