Laws for Show and Read?

Dannyu NDos ndospark320 at gmail.com
Wed Jun 5 07:47:05 UTC 2019


In the instance Show Foo, I mean "showsPrec" rather than "show".

2019년 6월 5일 (수) 16:45, Dannyu NDos <ndospark320 at gmail.com>님이 작성:

> Shouldn't it be laws that "show" must be injective and "read" must be
> surjective? Without such laws, one could define:
>
> data Foo = Foo
> instance Show Foo where
>     show _ _ = id
> instance Read Foo where
>     readPrec = pfail
>
> which should be prevented.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20190605/d36aeb55/attachment.html>


More information about the Libraries mailing list