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
| /// <summary>Wraps this object instance into an IEnumerable<T> consisting of a single item.</summary> | |
| /// <typeparam name="T"> Type of the object. </typeparam> | |
| /// <param name="item"> The instance that will be wrapped. </param> | |
| /// <returns> An IEnumerable<T> consisting of a single item. </returns> | |
| public static IEnumerable<T> Yield<T>(this T item) | |
| { | |
| yield return item; | |
| } |
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
| Fable.Core.JsInterop.Debugger |
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
| public static Option<TException> WithoutValue<TValue, TException>(this Option<TValue, TException> option) | |
| { | |
| return option.Match(_ => Option.None<TException>(), exception => exception.Some()); | |
| } | |
| public static IEnumerable<TValue> Values<TValue, TException>(this IEnumerable<Option<TValue, TException>> source) | |
| { | |
| if (source == null) throw new ArgumentNullException(nameof(source)); | |
| return source.SelectMany(option => option.ToEnumerable()); | |
| } |
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
| // Learn more about F# at http://fsharp.org | |
| // See the 'F# Tutorial' project for more help. | |
| open System | |
| let toInt a = | |
| match (Int32.TryParse(a)) with | |
| | (true, x) -> Some x | |
| | (false, _) -> None | |
| type MaybeBuilder() = |
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
| open System | |
| let divideBy bottom top = | |
| if bottom = 0 | |
| then None | |
| else Some(top/bottom) | |
| type MaybeBuilder() = | |
| member this.Bind(x, f) = |
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 Result = | |
| type Result<'TResult, 'TError> = | |
| | Ok of 'TResult | |
| | Error of 'TError | |
| let ifNone (error : 'TError) = function | |
| | Some (o) -> Ok o | |
| | None -> Error error | |
| let map f = function |
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
| type MayBeBuilder() = | |
| member x.Bind(v,f) = Option.bind f v | |
| member x.Return v = Some v | |
| member x.ReturnFrom o = o | |
| let maybe = OptionBuilder() |
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
| export function flatten<T>(array: T[][]): T[] { | |
| return [].concat.apply([], array); | |
| } | |
| export function chunk<T>( | |
| array: T[], | |
| chunkSize: number, | |
| acc: T[][] = [] | |
| ): T[][] { | |
| return array.length > chunkSize |
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
| declare module "react-throttle" { | |
| export interface DebounceProps extends React.Props<Debounce> { | |
| time: number; | |
| handler: string; | |
| } | |
| export class Debounce extends React.Component<DebounceProps> {} | |
| } |
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
| let getXsd id = | |
| query { | |
| for messageItem in ctx.ProtoType.MessageType do | |
| for originalMessage in messageItem.``ProtoType.OriginalMessage by Id`` do | |
| for messageType in originalMessage.``ProtoType.MessageType by Id`` do | |
| where (messageItem.Id = id) | |
| select (messageType.Xsd) | |
| } |> Seq.head |