Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom graph invariants #70

Open
JeffreyBenjaminBrown opened this issue Aug 15, 2017 · 1 comment
Open

Custom graph invariants #70

JeffreyBenjaminBrown opened this issue Aug 15, 2017 · 1 comment

Comments

@JeffreyBenjaminBrown
Copy link

Is there a some canonical way to enforce graph invariants in FGL?

I have been using FGL to implement a generalization of graphs that allows for arbitrary arity and nesting of relationships. It looks like this:

type RSLT = Gr Expr Role
data Expr = Word String
          | Template [String] -- e.g. "_ needs _ to _"
          | Relationship      -- e.g. "Gotham needs Batman to hurry"
data Role = TemplateRole | Member Int

Words and Templates emit no edges. Each Relationship emits an edge labeled "TemplateRole" to a Template of arity k, and k more edges, labeled "Member i" for i in [1,k]. Thus the model permits lots of invalid state.

I don't know whether it's relevant, but I just learned about the dependent map library, which implements a map that allows keys to specify the types of values associated with them.

@ivan-m
Copy link
Contributor

ivan-m commented Aug 15, 2017

There's no way to constrain in FGL which edges are legal.

It may be possible to implement a new FGL type using dependent-maps, but I'm hesitant to add any extra dependencies as it's part of the Haskell Platform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants