Coder Social home page Coder Social logo

(&) operator silently drops edges about fgl HOT 5 CLOSED

haskell avatar haskell commented on May 18, 2024
(&) operator silently drops edges

from fgl.

Comments (5)

ivan-m avatar ivan-m commented on May 18, 2024

The former behaviour is correct; the latter is a bug.

That is: a Context should only refer to either a Node already in a graph or the node in the Context itself (for loops).

I'm finishing moving at the moment so I'll have a look at this once I've cleared enough space to set my computer up at home :p

from fgl.

osbugs avatar osbugs commented on May 18, 2024

Thanks. In the meantime, I have created a pull request to update the documentation (#28).

from fgl.

ivan-m avatar ivan-m commented on May 18, 2024

Closed in favour of #28

from fgl.

osbugs avatar osbugs commented on May 18, 2024

Is it a good idea to leave the bug in the code, and just document the bug in the line of issue #28?

from fgl.

ivan-m avatar ivan-m commented on May 18, 2024

Well, it's only a bug in the sense of fgl not throwing an error when this happens rather than silently doing losing information.

However, that would require either a) throwing an error (which is usually undesirable) or b) returning a Maybe, which makes the code messier.

(I have heard of graph manipulation being akin to pointer arithmetic due to this nature: you either have good APIs and nice performance with lots of ways to throw errors/have unexpected behaviour, or else be really safe but with a horrible API and lots of checking slowing the code down.)

I think a warning of this behaviour in the documentation for & (and potentially buildGr) would suffice; at the very least it's probably the lesser of all the evils.

from fgl.

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.