Giter Site home page Giter Site logo

ekonbenefits / fsharp.interop.nulloptable Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 0.0 327 KB

Missing OptionBuilder for F# filling the void to interop with C#'s ?. usage

Home Page: https://ekonbenefits.github.io/FSharp.Interop.NullOptAble/

License: MIT License

F# 75.87% Shell 8.22% CSS 6.33% JavaScript 0.77% HTML 8.80%
fsharp null option nullable monads

fsharp.interop.nulloptable's Introduction

FSharp.Interop.NullOptAble NuGet Status

Missing OptionBuilder for F# filling the void to interop with C#'s ?. usage. It works with Nulls, Options, Nullables.

CI Builds available: MyGet Pre Release

Build Statuses:

  • Windows: Build status
  • Mac & Linux: Build Status

Basic Info

There are more C# devs relying on the safe nav operator ?. and so nulls will only get worse on the C# side, making it more likely null's are going to drop out of APIs.

This project creates an option { } computational expression and chooseSeq { } computational expression that allows binding 'T option/'T Nullable/'T:null thus either returns an option or a sequence respectively.

With chooseSeq if you yield! another chooseSeq it will work recursively flatten or any sequence of NonNullSeq, list, or Set type. Any other sequence will be treated like a T:null object yield! and let! work with 'T option/'T Nullable/'T:null

Examples

let x = Nullable(3)
let y = Nullable(3)
option {
    let! x' = x
    let! y' = y
    return (x' + y')
} |> should equal (Some 6)

See more examples in Tests/RealWorld.fs.

Operator Examples

This library also has some operators available when specifically included

using FSharp.Interop.NullOptAble.Operators

You can find examples of them in Tests/RealWorldOperators.fs.

fsharp.interop.nulloptable's People

Contributors

jbtule avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

fsharp.interop.nulloptable's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.