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 FPrimitive | |
let unknown = 10 | |
let untrusted = Untrust unknown | |
type NonZeroInt = | |
private NonZeroInt of int with | |
static member create x = | |
Spec.def<int> | |
|> Spec.notEqual 0 "should not be zero" |
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
int unknown = 5; | |
var untrusted = Untrust<int>(unknown); | |
if (untrusted.TryGetValue(x => x > 3, out int trusted)) | |
{ | |
// Set 'trusted' now into dedicated 'Int' type. | |
} |
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
// Specification that the input parameter of the access-controlled function should satisfy | |
let spec = | |
Spec.def<string> | |
|> Spec.notEmpty "should not be empty string" | |
// The function (fun x -> Some x) is now 'access-controlled' with a specifiation for non-empty strings, | |
// can be revoked anytime the 'Access.revoke acc' is called, and can only be accessed three times. | |
let acc = | |
Access.func (fun x -> Some x) | |
|> Access.satisfy spec |
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
// Specification before the actual check of the base-uri. | |
Spec<Uri> spec = | |
Spec.Of<Uri>() | |
.Add(uri => uri.Scheme == Uri.UriSchemeHttps, "should be 'https' scheme"); | |
// Demonstration purposes, generic type could be anything. | |
IObservable<T> obs = null; | |
// Access controlled function with validation, revocation, limited amount of evaluations and time-based availability. | |
Access<Uri, Uri> access = |
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 FPrimitive | |
/// Composible specifications for your domain types: | |
type NonEmptyString = | |
private NonEmptyString of string with | |
static member create x = | |
Spec.def<string> | |
|> Spec.notNull "should not be null" | |
|> Spec.notEmpty "should not be empty" | |
|> Spec.createModel NonEmptyString x |
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 FPrimitive; | |
public class ProductName | |
{ | |
private readonly string _value; | |
/// Prevents a default instance of the type from being created. | |
private ProductName(string value) | |
{ | |
_value = value; |
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 FScenario | |
Http.get "http://localhost:9090/" | |
// Logging: | |
// Information: GET -> http://localhost:9090 | |
// Information: OK <- http://localhost:9090 |
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 FScenario | |
// Polling Computation Expression | |
pol { target (fun () -> async { return FileInfo "C:/temp/file.txt" }) | |
until (fun f -> f.Exists) | |
every _1s | |
timeout _5s | |
error "Polling at file path 'C:/temp/file.txt' doesn't result in any file" } | |
// Pipable polling functions |
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
<?xml version="1.0" encoding="utf-8"?> | |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" exclude-result-prefixes="msxsl var s0" version="1.0" xmlns:s0="http://schemas.microsoft.com/BizTalk/EDI/EDIFACT/2006"> | |
<xsl:output omit-xml-declaration="yes" method="xml" version="1.0" /> | |
<xsl:template match="/"> | |
<xsl:apply-templates select="/s0:EFACT_D96A_ORDERS_EAN008" /> | |
</xsl:template> | |
<xsl:template match="/s0:EFACT_D96A_ORDERS_EAN008"> | |
<order> | |
<reference> | |
<xsl:value-of select="s0:BGM/BGM02" /> |
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
{ | |
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"accessPolicies": { | |
"defaultValue": { "list": [] }, | |
"type": "object" | |
} | |
}, | |
"variables": { |
NewerOlder