plaidfinch/StrictCheck

Show instance for Demand

Lysxia opened this issue · 1 comments

What do you think of adding an instance of Show for Demand a (or (%) if you prefer) so that we can simply write this:

> observe (`seq` ()) (&&) False False
(False,False :* _ :* Nil)

I find it quite convenient for doing small experiments in ghci. I have this instance as a quick hack but you may know a better implementation:

instance Shaped a => Show (Demand a) where
  show = prettyDemand

An alternative proposal is to have specialized functions to print the output of observe and variants, or a variant of observe that prints in addition to/instead of returning the demand.

I would be okay with adding this instance. Want to open a PR?