<div dir="ltr"><div>I use FGL, which (roughly) defines type Gr a b as a graph on nodes of type a and edges of type b.<br></div><div><br></div><div>Suppose you wanted a graph that described which people own which hamsters, knowing only their name. You would have to make node and edge types like this:</div><div><font face="monospace, monospace">    data GraphNode = Person String | Hamster String</font></div><div><font face="monospace, monospace">    data GraphEdge = Has</font></div><div>where the strings represent their names.</div><div><br></div><div>Suppose then you wanted to write a function that, given a person, returns the names of all their hamsters. To make sure the call makes sense, the function would have to first check that the input is in fact a person. Since persons and hamsters are both constructors of the same type, you can't let Haskell's robust, beautiful type-checking system distinguish them for you; you've got to write something like "case n of Person _ -> True; _ -> False".</div><div><br></div><div>Is there some way around writing such manual checks?</div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Jeffrey Benjamin Brown</div></div>
</div>