<div dir="auto"><div>A while back I complained to Ed Kmett that the `Bifunctor` instance for (,) isn't strictly law abiding. Specifically,<div dir="auto"><br></div><div dir="auto"> bimap id id _|_ = (_|_, _|_)</div><div dir="auto"><br></div><div dir="auto">while by the first law we should really have</div><div dir="auto"><br></div><div dir="auto"><div dir="auto"> bimap id id _|_ = _|_</div><div dir="auto"><br style="font-family:sans-serif"></div></div>He countered that for some purposes the extra laziness is necessary, and that it's rather less convenient to lazify a pair than to force one (unless you use something like forcePair[*] from utility-ht, which is another one-trick pony to remember). This package is my attempt to prove to Ed that lazifying is almost as easy as strictifying.</div><div dir="auto"><br></div><div dir="auto">[*] <a href="http://hackage.haskell.org/package/utility-ht-0.0.14/docs/Data-Tuple-Lazy.html#v:forcePair">http://hackage.haskell.org/package/utility-ht-0.0.14/docs/Data-Tuple-Lazy.html#v:forcePair</a></div><div dir="auto"><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Tue, Aug 6, 2019, 3:55 AM Chris Wong <<a href="mailto:lambda.fairy@gmail.com">lambda.fairy@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>Hi David,<div dir="auto"><br></div><div dir="auto">What are the use cases for such a package?</div><div dir="auto"><br></div><div dir="auto">I'd love to see some examples of problems that can be solved with Lazifiable.</div><div dir="auto"><br></div><div dir="auto">Chris</div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Aug 6, 2019, 19:25 David Feuer <<a href="mailto:david.feuer@gmail.com" target="_blank" rel="noreferrer">david.feuer@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I've put together a small package for lazifying record types. There's a "classy" version in Data.Lazify and a Generic-only version in Data.Lazify.Generic. A few examples are below. I'd love to hear comments on what looks good and what should be changed before I make the first release. As usual, names are the hardest part. Note especially that the operator ($~) is defined in *both* Data.Lazify and Data.Lazify.Generic, and that no operator corresponds to genericLazify. Hrmm mumble.<div><br></div><div>lazify (1, 2) = (1, 2)</div><div>lazify undefined = (_|_, _|_, _|_)</div><div>lazify undefined = Sum (_|_, _|_, _|_)</div><div><br></div><div>genericLazify (1,2) = (1,2)</div><div>genericLazify undefined = (_|_, _|_, _|_)</div><div>genericLazify (Sum (MyCon x y)) = ... oops, MyType isn't an instance of Lazifiable</div><div><br></div><div>lazifyGeneric (1,2) = (1,2)</div><div>lazifyGeneric undefined = (_|_, _|_, _|_)</div><div>lazifyGeneric (Sum (MyCon x y)) = Sum (MyCon x y)</div><div><br></div><div>Thanks in advance,</div><div>David</div></div>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" rel="noreferrer noreferrer" target="_blank">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
</blockquote></div></div></div>
</blockquote></div></div></div>