<div dir="ltr"><div class="gmail_quote"><div>Olaf,</div><div><br></div><div>Thanks for the reply. Answer inline.</div><div><br></div><div dir="ltr">On Tue, 19 Jun 2018 at 20:53, Olaf Klinke <<a href="mailto:olf@aatal-apotheke.de" target="_blank">olf@aatal-apotheke.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Aaron, <br>
<br>
the lattices package provides some modules to extend a given lattice by some elements, e.g. new top and bottoms. There are also derived typeclass instances for combinations like tuples, endomorphisms and so forth. But the way of choice really depends on what you know about your multiple inheritance hierarchy</blockquote><div><br></div><div>AFAICS all that needs to be known about the inheritance hierarchy in order to create the lattice is the sub type relations, and also top and bottom reference types.</div><div><br></div><div>Ideally I would like to iterate through the hierarchy starting with top and then the base classes and add them incrementally with their subtype dependencies through to bottom.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">. <br>
In universal algebra one powerful method of constructing (semi-)lattices is by generators and relations. That means you define the lattice as a quotient of a free lattice. The quotient itself is defined as a set of ineqalities on the generators. I don't know how one would implement that without dependent types, though, as the type would be another type together with a function. To make things worse, the word problem is undecidable in general. <br>
Looking at Algebra.Lattice.Free I'm surprised that the free (semi-)lattice types don't have a Monad instance. Does anyone know why they are not implemented? Under the hood the free lattice types are identical to the continuation monad. </blockquote><div><br></div><div>I think the Lattice classes may well be still in flux as I looked about a month ago ad there seemed to be AFAICR a Least Upper Bound operation taking a list of elements and returning an element.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> </blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Olaf<br>
<br>
>Hi,<br>
><br>
>I am trying to work out how to use the Algebra.Lattice family of Lattice<br>
>data structures.<br>
><br>
>Firstly how do I construct a lattice ?<br>
><br>
>What I am wanting to do is to be able to construct a lattice to represent a<br>
>multiple inheritance hierarchy. Then I to be able to find the Least Upper<br>
>Bound of a set of classes/types. This is in order to find the type of a<br>
>multiple case expression.<br>
><br>
>I am not sure if the Haskell classes are actually applicable ? but if they<br>
>are how do I apply them to the following problem please ?</blockquote></div><br clear="all"><br>-- <br><div class="m_-4607298535245321141m_-475844857578822831gmail_signature" dir="ltr" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Aaron Gray</div><div><br></div><div>Independent Open Source Software Engineer, Computer Language Researcher, Information Theorist, and amateur computer scientist.<br></div></div></div></div></div></div>