This file contains hidden or 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
| module Block = | |
| open System.Collections.Generic | |
| // I find it convenient in `let ia = l |> Block.map f`, for l to be allowed to be a list or block. | |
| // This helps to convert lists to blocks in APIs where existing users expect to input lists. | |
| // Alternatively, this could be an additional method mapFromCollection | |
| let mapVersionA<'a, 'b> (f:'a -> 'b) (arr:IReadOnlyCollection<'a>) = | |
| // note that null reference check shouldn't be needed any more as nulls are rapidly | |
| // becoming a non-issue in .Net and that will apply to F# when NRT support is implemented | |
| let builder = ImmutableArray.CreateBuilder<'b>(arr.Count) |
This file contains hidden or 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
| namespace XamarinHelpers | |
| open Xamarin.Forms | |
| type Grid with | |
| member t.RowHeights | |
| with set l = | |
| t.RowDefinitions.Clear() | |
| for gl in l do t.RowDefinitions.Add(RowDefinition(Height = gl)) | |
| member t.Rows with set (l: seq<seq<View>>) = |
This file contains hidden or 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
| // Could use NewtonSoft intead but the API is a little less clean, and NewtonSoft is limited to Json. | |
| open PeterO.Cbor | |
| open System | |
| // from https://www.znprojects.com/2019/03/daily-coding-problem-3.html | |
| type DUNode = | |
| | Node of string * left:DUNode option * right:DUNode option | |
| [<AutoOpen>] | |
| module CBORHelpers = |
This file contains hidden or 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
| // Initial draft of F# Input Model. | |
| // To input an F# type T, define an function T -> Input and a function ReceivedInput -> T. | |
| // An InputView can be defined that takes an Input. It gives a ReceivedInput when the input is complete. | |
| // Validation needs to be added. | |
| [<RequireQualifiedAccess>] | |
| type Input = | |
| | Int | |
| | Float | |
| | DU of (string * (unit -> Input))[] |