<div dir="auto"><div>We already have the law</div><div dir="auto"><br></div><div dir="auto"> read . show = id</div><div dir="auto"><br></div><div dir="auto">which implies the injectivity and surjectivity conditions you specify.</div><div dir="auto"><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Wed, Jun 5, 2019, 3:45 AM Dannyu NDos <<a href="mailto:ndospark320@gmail.com">ndospark320@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">Shouldn't it be laws that "show" must be injective and "read" must be surjective? Without such laws, one could define:<div dir="auto"><br></div><div dir="auto">data Foo = Foo<br><div dir="auto">instance Show Foo where</div><div dir="auto"> show _ _ = id</div><div dir="auto">instance Read Foo where</div><div dir="auto"> readPrec = pfail</div><div dir="auto"><br></div><div dir="auto">which should be prevented.</div></div></div>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank" rel="noreferrer">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
</blockquote></div></div></div>