Comments (11)
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.
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.
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.
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.
That would be great. I guarantee that you are wrong :) I'm already using these functions to decorate graphs with SBV variables.
from fgl.
@expipiplus1 is Bitraversable
in base? Since FGL is a Platform library I don't want to add any extra dependencies if possible.
from fgl.
@expipiplus1 Do you really want a Bitraversable
instance rather than just a function which does the same job?
from fgl.
@ivan-m no, it's part of the bifunctors
package.
@tomjaguarpaw Either would do.
from fgl.
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.
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 implementingBitraversable
(but not actual
instances until/unlessbifunctors
gets added to the Haskell Platform).
That's great, thanks!
from fgl.
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)
- DynGraph contraint seems redundant in prettify
- GHC 9.4 compatibility
- Add tag for 5.8.1.0
- 5.8.1.0 crashes when computing dominators in graphs with unreachable nodes HOT 1
- fails to build with ghc-9.6 HOT 3
- Release tag for version 5.8.2.0 is missing HOT 1
- fgl and fgl-arbitrary need bumps for QuickCheck 2.10 and QuickCheck 2.11 HOT 2
- FLG doesn't build with MonadFailDesugaring HOT 4
- fgl-5.6.0.0 fails with ghc-8.6.1 HOT 10
- fgl and fgl-arbitrary incompatible with current QuickCheck
- Data.Graph.Inductive.Basic.undir appears to handle self-edges wrongly
- Data.Graph.Inductive.Query.TransClos.rc is wrongly implemented HOT 5
- Data/Graph/Inductive/NodeMap.hs:159:9-32: Non-exhaustive patterns in Just es' HOT 2
- gsel ignores edges to nodes HOT 1
- Add plain text synonym for `&`. HOT 2
- fgl-arbitrary on Hackage is extremely outdated. HOT 2
- `gfiltermap` can result in inconsistent graph. HOT 1
- Is the PatriciaTree matchGr too strict?
- Documentation updates for predicate functions that rely on match HOT 1
- The insMapEdge family of functions are partial HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fgl.