Opened 12 years ago

Closed 12 years ago

Last modified 2 years ago

#694 closed bug (fixed)

lawbreaker in HughesPJ

Reported by: maeder@… Owned by:
Priority: normal Milestone: 6.4.2
Component: libraries/base Version: 6.4.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


the law "empty is an identity for <> and $$" is currently broken by ie. isEmpty (empty<>empty) as Conal Elliot noted.

Either the test isEmpty or the combinators <>, <+>, $$, $+$ need to be fixed. My suggested patch for the for 4 combinators caused an object code explosion (see ticket #490). I've also sent a simple patch for isEmpty that seems to be less optimal (as the reduction of a document may occur twice).

I could supply another patch of the 4 combinators where only the base cases are swapped. This patch does not cause the explosion because the reordered base cases better fit to the left-associativity of the combinators. However, associativity does not help if one uses unfornate parentheses.

Anyway, HughesPJ should be fixed somehow Cheers Christian

Attachments (1)

patch2 (1.2 KB) - added by maeder@… 12 years ago.
patch 4 combinators without object code bloat

Download all attachments as: .zip

Change History (6)

Changed 12 years ago by maeder@…

Attachment: patch2 added

patch 4 combinators without object code bloat

comment:1 Changed 12 years ago by simonmar

Resolution: fixed
Status: newclosed

patch applied; thanks.

comment:2 Changed 9 years ago by simonmar

Architecture: UnknownUnknown/Multiple

comment:3 Changed 9 years ago by simonmar

Operating System: UnknownUnknown/Multiple

comment:4 Changed 8 years ago by simonmar

difficulty: Easy (1 hr)Easy (less than 1 hour)

comment:5 Changed 2 years ago by Thomas Miedema <thomasmiedema@…>

In 5d57087/ghc:

Pretty: fix a broken invariant (#10735)

This is a backport of a bug fix from
6cfbd0444981c074bae10a3cf72733bcb8597bef in libraries/pretty:

    Fix a broken invariant
    Patch from #694,  for the problem "empty is an identity for <> and $$" is
    currently broken by eg. isEmpty (empty<>empty)"
Note: See TracTickets for help on using tickets.