Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Add more Eq and Show instances #4

merged 1 commit into from Apr 18, 2012
Commits on Apr 18, 2012
  1. More Eq and Show instances

    joeyadams committed Apr 18, 2012
    The procedure I used to decide what types get Eq and Show instances is:
        If the data type is exported and has at least one data constructor:
         * If it is purely an enumeration (no values attached to any data
           constructors), it gets an Eq instance.  For example CopyOutResult is not
           given an Eq instance because the CopyOutRow constructor has a ByteString
         * If its data constructors are exported, it gets a Show instance.
    The decision to give result data types an Eq instance is questionable:
     * If the Eq instance is omitted, the user is forced to handle all cases
       exhaustively (which is good, especially if the API changes in the future!).
     * If the data type is extended to include a constructor with extra data
       attached to it, code that used == for state comparison may unintentionally
       perform content comparison.  However, this shouldn't be an issue if the user
       uses the form x == NullaryThing.