Code Monkey home page Code Monkey logo

Comments (11)

expipiplus1 avatar expipiplus1 commented on September 14, 2024 1

It might also be worth considering adding an instance for Bitraversable for the concrete data types in fgl. I came here looking for bisequenceA for graphs.

from fgl.

ivan-m avatar ivan-m commented on September 14, 2024

I'll have a think about this.

I personally don't use lenses, so I'm not sure how useful these functions would be. Can you please provide some examples of how they would be used? (Especially as I'm not sure what the performance of these functions would be like with the Applicative usage.)

from fgl.

tomjaguarpaw avatar tomjaguarpaw commented on September 14, 2024

I shouldn't have mentioned the word "lens", it's a red herring. traverseEdges is a Traversable instance for gr a and traverseNodes is a Traversable instance for gr _ b (with the caveat that the type arguments need to be shuffled around). They are generalizations of nmap and emap.

As for examples of how they'd be used, they would be used the same as any other Traversable instance in the Haskell ecosystem, i.e. very widely and to great advantage!

from fgl.

ivan-m avatar ivan-m commented on September 14, 2024

I can add something like this in (probably called nmapA and emapA or some such); but without the associated Traversable instance + associated functions (which I won't add in due to the the * -> * -> * nature of graphs meaning it will only apply to edges) I don't think they'd be as useful as you're suggesting (I'm willing to be proven wrong however).

from fgl.

tomjaguarpaw avatar tomjaguarpaw commented on September 14, 2024

That would be great. I guarantee that you are wrong :) I'm already using these functions to decorate graphs with SBV variables.

from fgl.

ivan-m avatar ivan-m commented on September 14, 2024

@expipiplus1 is Bitraversable in base? Since FGL is a Platform library I don't want to add any extra dependencies if possible.

from fgl.

tomjaguarpaw avatar tomjaguarpaw commented on September 14, 2024

@expipiplus1 Do you really want a Bitraversable instance rather than just a function which does the same job?

from fgl.

expipiplus1 avatar expipiplus1 commented on September 14, 2024

@ivan-m no, it's part of the bifunctors package.

@tomjaguarpaw Either would do.

from fgl.

ivan-m avatar ivan-m commented on September 14, 2024

OK, I'll look into adding an instance for Bifunctor (for newer versions of base) and functions implementing Bitraversable (but not actual instances until/unless bifunctors gets added to the Haskell Platform).

from fgl.

tomjaguarpaw avatar tomjaguarpaw commented on September 14, 2024

On Fri, May 27, 2016 at 04:30:18AM -0700, Ivan Lazar Miljenovic wrote:

OK, I'll look into adding an instance for Bifunctor (for newer versions
of base) and functions implementing Bitraversable (but not actual
instances until/unless bifunctors gets added to the Haskell Platform).

That's great, thanks!

from fgl.

ivan-m avatar ivan-m commented on September 14, 2024

OK, I'm adding the Bifunctor instance for base >= 4.8.0.0, but I won't be adding any Bitraversable-like functions as I'm not sure how much sense they make.

The problem is that the traversable functions are all about traversing (strangely enough)... but in which order? Unless it was something of questionable nature like "traverse in ascending order of the neighbour's node IDs" (and even then there's the question of multiple edges and loops), there's no real sensible way of doing it.

The closest I can think of is to have a BFS traversal and a DFS traversal, but even then I question their validity.

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.