This is not running yet, but nearly almost
First install a WSL2 with Ubuntu 20.04 as described at Microsoft
Enter wsl shell
// This sample will guide you through elements of the F# language. | |
// | |
// ******************************************************************************************************* | |
// To execute the code in F# Interactive, highlight a section of code and press Alt-Enter in Windows or | |
// Ctrl-Enter Mac, or right-click and select "Send Selection to F# Interactive". | |
// You can open the F# Interactive Window from the "View" menu. | |
// ******************************************************************************************************* | |
// For more about F#, see: |
namespace AzurefnSecret | |
open Microsoft.Azure.KeyVault | |
open Microsoft.IdentityModel.Clients.ActiveDirectory | |
module Example = | |
let getSecret (appKeyDescription:string) (appKeyValue:string) (secretUrl:string) = | |
async { | |
use keyVault = new KeyVaultClient(fun authority resource (_:string) -> | |
async { |
<Window x:Class="ConsoleApp.Wpf.Views.MainWindow" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |
xmlns:local="clr-namespace:ConsoleApp.Wpf.Views" | |
mc:Ignorable="d" | |
Title="MainWindow" Height="450" Width="800"> | |
<Grid Margin="0,25,0,0"> | |
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Top"> |
// ========= Event Sourcing in a nutshell | |
(* | |
FriendlyName: string | |
Aggregate friendly name. | |
Initial: 'State | |
Initial (empty) state we will start with. | |
Decide: 'Command -> 'State -> 'Event list |
namespace ComputationExpression | |
module AsyncResultDemo = | |
open System | |
open FsToolkit.ErrorHandling | |
type AuthError = | |
| UserBannedOrSuspended |
This is not running yet, but nearly almost
First install a WSL2 with Ubuntu 20.04 as described at Microsoft
Enter wsl shell
// 1. pure, don't think about IO at all | |
module Domain = | |
let add x y = x + y | |
// 2. think about IO but not its implementation | |
module App = | |
let add (getX: unit -> Async<int32>) y = | |
async { | |
let! x = getX () | |
return Domain.add x y |
{ | |
"final_space": true, | |
"console_title": true, | |
"console_title_style": "folder", | |
"blocks": [ | |
{ | |
"type": "prompt", | |
"alignment": "left", | |
"horizontal_offset": 0, | |
"vertical_offset": 0, |
[<EntryPoint>] | |
let main argv = | |
printfn "Should be zero (netWeight emptyPallet): %A" Stock.shouldBeZero | |
printfn "harvesterPartsWeight: %A" Stock.harvesterPartsWeight | |
printfn "grossWeight harvesterParts: %A" (Stock.grossWeight Stock.harvesterParts) | |
printfn "grossWeight emptyPallet: %A" (Stock.grossWeight Stock.emptyPallet) | |
printfn "netWeight harvesterParts: %A" (Stock.netWeight Stock.harvesterParts) | |
printfn "value harvesterParts: %A" (Stock.value Stock.harvesterParts) | |
printfn "boxLabels harvesterParts: %A" (Stock.boxLabels Stock.harvesterParts) | |
printfn "boxLabels emptyPallet: %A" (Stock.boxLabels Stock.emptyPallet) |