Git Product home page Git Product logo

Comments (4)

kurtschelfthout avatar kurtschelfthout commented on May 25, 2024

Due to F#’s eagerness, the right hand side is always executed. There is no practical way I know of FsCheck can avoid this without user intervention. You can wrap the right hand side in Lazy to avoid this.

from fscheck.

kurtschelfthout avatar kurtschelfthout commented on May 25, 2024

See the docs here for more https://fscheck.github.io/FsCheck/Properties.html#Lazy-Properties

from fscheck.

isberg avatar isberg commented on May 25, 2024

Thanks @kurtschelfthout! That was exactly what I needed to know. :-)

The following code show what I really was trying to achieve: getting FsCheck and Unquote to be friends.

open FsCheck
open FsCheck.FSharp
open Swensen.Unquote

let lazy_test : Quotations.Expr<bool> -> Lazy<unit> = fun expr -> lazy test expr

type ListProperties =
  static member ``explicit lazy`` (xs : int list) : Property =
    (List.length xs > 0) ==>
        lazy test <@ List.head xs::List.tail xs = xs @>
        
  static member ``implizit lazy`` (xs : int list) : Property =
    (List.length xs > 0) ==>
        lazy_test <@ List.head xs::List.tail xs = xs @>

Check.QuickAll<ListProperties> ()

from fscheck.

isberg avatar isberg commented on May 25, 2024

This issue relates to issue #130 and above code might be relevant for that issue also.

from fscheck.

Related Issues (20)

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.