iokasimov / apart Goto Github PK
View Code? Open in Web Editor NEWGet all your structure and rip it apart.
Home Page: http://hackage.haskell.org/package/apart
License: BSD 3-Clause "New" or "Revised" License
Get all your structure and rip it apart.
Home Page: http://hackage.haskell.org/package/apart
License: BSD 3-Clause "New" or "Revised" License
Hi there,
I've really liked your blog post on Apart and using Comonads as an abstraction for what is in memory and what is persisted. It's super clever and I'm still inspired by trying to use this more.
When I started looking at Data.Apart.Structures.Graph
I was super excited since I really like alga
but then after a while I started wondering whether we can describe arbitrary direct acyclic graphs with type Graph = Cofree Edges
and I think the answer is no, but I wanted to check my reasoning with you. I think for instance you can't really build a -> b -> c
without also adding an arrow between a
and c
which you might not want. Basically the problem, I think, is that Connect
(in the alga definition) since it will want to connect all the previous vertices in the structure, to the new one you're just adding, will always connect probably more than you want. And since you don't have a way to remove edges, you can't really represent all graphs.
I think that seeing the base functor Edge as GraphOperations though might work? In this case we're really doing a bit of a event sourced version of the graph, where you can not only add vertices and edges, but also remove them. I'm not sure it would work with this algebraic construction though, and it certainly wouldn't be a simple as Cofree Edges
. I came across this kind of construction using event sourced triples, with an assert/retract qualifier, but that's not algebraic and therefore doesn't guarantee that all your edges point to valid vertices.
Another way to look at it is that probably Cofree Edges
actually describes some interesting subclass of Graphs that maybe have some Tree-ness to them? The fact that all recent Connect vertices will be connected to all previous vertices is interesting, maybe it's something like causality.
It would be fun creating an arbitrary instance for this and converting some randomly generated graphs into diagrams and see what comes out :)
I might be completely wrong here, so I'd be happy to learn more!
Cheers,
Jun
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.