We already have the law

  read . show = id

which implies the injectivity and surjectivity conditions you specify.

On Wed, Jun 5, 2019, 3:45 AM Dannyu NDos <ndospark320@gmail.com> wrote:
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.
_______________________________________________
Libraries mailing list
Libraries@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries