[Haskell-cafe] And, Or, Not, and [something atomic] data types: What am I doing?

Jeffrey Brown jeffbrown.the at gmail.com
Tue Jun 9 08:45:36 UTC 2015

I am considering the problem of representing search results in a graph
database. (Define such a database as a collection N of nodes and E of
labeled edges, where a labeled edge consists of a triplet (l, n1, n2),
where l is some kind of label and n1 and n2 are members of N.)

I think a type something like the following would be useful:
  data Search =
    Fan { origin :: Node
          , label :: Label
          , members :: [Node]
    | And Search Search
    | Or Search Search
    | Not Search
In a Fan with origin o, members would be the set of Nodes p such that
(label, o, p) is an edge. A Search is ultimately built out of Fans.

I've seen this kind of thing before, and I believe it will lead me to some
substantial problems that other people have already solved. What should I
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150609/48ca49b4/attachment.html>

More information about the Haskell-Cafe mailing list