This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows; | |
using System.Windows.Controls; | |
using System.Windows.Data; | |
using System.Windows.Documents; | |
using System.Windows.Input; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type DifferenceType<'TKey, 'T> = | |
| Added of 'TKey * 'T | |
| Removed of 'TKey * 'T | |
| Modified of 'TKey * 'T * 'T * seq<string * (string * string)> with | |
member this.Key = | |
match this with | |
| Added (key, _) | |
| Removed (key, _) | |
| Modified (key, _, _, _) -> key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// business model | |
type Invoice = { CptyName: string; CptyNum: int; InvoiceNr: string; amount : decimal; curr: string; buysell: ActivePassive} | |
// array extraction from Excel with type provider | |
let ActiveInvoice = | |
ActiveInvoiceExcel.Data | |
|> Seq.map ( fun line -> { InvoiceNr = line.``Numero documento``; ... }) | |
|> Seq.toArray |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<DataGrid Grid.Column="2" ItemsSource="{Binding SelPayment.eur_invoices}" IsReadOnly="True" | |
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="10,10,10,10" > |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Back2UI() = | |
inherit SimpleViewModelBase() | |
let mutable _msg = "" | |
member this.msg | |
with get() = _msg | |
and set value = | |
_msg <- value | |
this.OnPropertyChanged(<@ this.msg @>) | |
type ActivePassive = Active | Passive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<DataGrid Grid.Column="2" ItemsSource="{Binding SelPayment.eur_invoices}" IsReadOnly="True" AutoGenerateColumns="False" | |
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="10,10,10,10" > | |
<DataGrid.Columns> | |
<DataGridTextColumn Header="Buy/Sell" Binding="{Binding buysell}" /> | |
<DataGridTextColumn Header="Cpty Name" Binding="{Binding CptyName}" /> | |
<DataGridTextColumn Header="Invoice Nr" Binding="{Binding InvoiceNr}" /> | |
<DataGridTextColumn Header="Amount" Binding="{Binding amount, StringFormat=N}" /> | |
<DataGridTextColumn Header="Curr" Binding="{Binding curr}" /> | |
<DataGridTextColumn Header="Msg" Binding="{Binding ui.msg}" /> | |
</DataGrid.Columns> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BindableTextBlock : TextBlock | |
{ | |
public ObservableCollection<Inline> InlineList | |
{ | |
get { return (ObservableCollection<Inline>)GetValue(InlineListProperty); } | |
set { SetValue(InlineListProperty, value); } | |
} | |
public static readonly DependencyProperty InlineListProperty = | |
DependencyProperty.Register("InlineList", typeof(ObservableCollection<Inline>), typeof(BindableTextBlock), new UIPropertyMetadata(null, OnPropertyChanged)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let rec bfs2 (fanout: Map<'node, 'node seq> -> 'node -> 'node seq) (tree: Map<'node, 'node seq>) (node: 'node) : 'node seq = | |
let single = seq [node] | |
match fanout tree node with | |
| e when e = Seq.empty -> single | |
| s -> Seq.fold (fun acc item -> | |
bfs2 fanout tree item | |
|> Seq.append acc) single s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let rec bfs2robust (fanout: Map<'node, 'node seq> -> 'node -> 'node seq) (tree: Map<'node, 'node seq>) (node: 'node) : 'node seq = | |
let single = seq [node] | |
match fanout tree node with | |
| e when e = Seq.empty -> single | |
| s -> Seq.fold (fun acc item -> | |
bfs2robust fanout (tree |> Map.remove node) item | |
|> Seq.append acc) single s |> Seq.distinct |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System | |
type Eff<'Ctx, 'T> = 'Ctx -> 'T | |
type EffBuilder() = | |
member __.Return x : Eff<'Ctx,'T> = | |
fun _ -> x | |
member __.Bind(f : Eff<'Ctx, 'T>, g : 'T -> Eff<'Ctx, 'S>) : Eff<'Ctx, 'S> = | |
fun c -> g (f c) c | |
member __.Zero() : Eff<'Ctx, unit> = |