[Haskell-cafe] Manual type-checking in graphs: Avoidable?
tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Fri Feb 19 12:29:53 UTC 2016
On Fri, Feb 19, 2016 at 03:07:59PM +0300, Kosyrev Serge wrote:
> Tom Ellis <tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> writes:
> > 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.
> What would you propose instead?
If I were utterly insane I would propose that FGL be extended with
higher-typed indexes, so instead of
Gr :: * -> * -> *
we would have
Gr :: (k -> *) -> (k -> k -> *) -> *
Then Hamster and Person would be the only inhabitants of some kind k, and
you can could choose two different types to represent them, and four
different types to represent the (directed) edges between them.
I would guess that most of the FGL implementation would carry over to this
setting with no change to its structure.
However, unless Jeffrey has a hard requirement to use something FGL-like,
Johannes and Andrew's suggestions will probably be fine.
More information about the Haskell-Cafe