lawbreakers in Text.PrettyPrint.HughesPJ

Conal Elliott conal at conal.net
Wed Nov 23 15:19:50 EST 2005


The comments in HughesPJ say that empty is an identity for <> and $$,
but the implementation doesn't satisfy either of these laws.  Here are
the implementations:

> p $$ q = Above p False q

> p <> q = Beside p False q

and definitions for empty and isEmpty:

> empty = Empty

> isEmpty Empty = True
> isEmpty _     = False

It's an easy fix, just adding these two lines before the current
definitions of $$:

> Empty $$ q = q
> p $$ Empty = p

And these before the current definition of <>:

> Empty <> q = q
> p <> Empty = p


- Conal



More information about the Libraries mailing list