Giter Site home page Giter Site logo

Comments (5)

simonmar avatar simonmar commented on April 28, 2024 1

The law holds provided (a) you only look at the results of runHaxl and (b) your data sources satisfy the property that fetching in parallel gives the same result as fetching sequentially.

So Haxl stretches the law a bit, but doesn't break it.

from haxl.

safareli avatar safareli commented on April 28, 2024

I have updated code snippets to match ones from your slides and in that example (when performing side effective actions) it ignores that law. Is it common to obey laws for partial input like this in haskell?

from haxl.

simonmar avatar simonmar commented on April 28, 2024

Is it common to obey laws for partial input like this in haskell?

I don't fully understand the question. Perhaps if you give me a specific example of what you mean by partial input?

from haxl.

safareli avatar safareli commented on April 28, 2024

You said that Haxl is lawful if "your data sources satisfy the property that fetching in parallel gives the same result" so it's not lawful for all other possible use cases of Haxl(is partially lawful), for example for this fragment of Haxl it's not lawful as 1 and 2 have different results:

run $ do -- 1
  cmd "touch" ["foo"]
  cmd "rm" ["foo"]

run $ do -- 2
  _ <- cmd "touch" ["foo"]
  cmd "rm" ["foo"]

from haxl.

simonmar avatar simonmar commented on April 28, 2024

Right - the cmd data source doesn't satisfy the property, so when used with that data source Haxl doesn't obey the monad laws.

It's still possible to use Haxl under these conditions, but you have to know what you're doing. Be aware of when <*> is being used, and don't use ApplicativeDo.

from haxl.

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.