[Haskell-cafe] Manual type-checking in graphs: Avoidable?
Tom Ellis
tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Fri Feb 19 11:25:48 UTC 2016
On Fri, Feb 19, 2016 at 12:07:14PM +0100, Johannes Waldmann wrote:
> > .. a graph that described which people own which hamsters,
>
> This is a bipartite graph, or, a relation. You want a type like
>
> data Rel src tgt a =
> Rel { fore :: ! ( M.Map src (M.Map tgt a) )
> , back :: ! ( M.Map tgt (M.Map src a) )
> }
>
> where src = People, tgt = Hamster, and a = Bool.
I agree. FGL seems inappropriate to model people owning hamsters because
you genuinely want to reflect the difference between people and hamsters by
having two different node types.
More information about the Haskell-Cafe
mailing list