Giter Site home page Giter Site logo

iokasimov / apart Goto Github PK

View Code? Open in Web Editor NEW
29.0 29.0 4.0 109 KB

Get all your structure and rip it apart.

Home Page: http://hackage.haskell.org/package/apart

License: BSD 3-Clause "New" or "Revised" License

Haskell 100.00%
algebraic cofree persistence structures

apart's People

Contributors

iokasimov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

apart's Issues

Algebraic Graph structure

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

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.