[Haskell-cafe] showing a user defined type
David Menendez
dave at zednenem.com
Mon May 18 22:26:02 EDT 2009
On Mon, May 18, 2009 at 10:02 PM, Ryan Ingram <ryani.spam at gmail.com> wrote:
> Unfortunately, you can't derive Show on Chain as defined, because it
> contains a function:
Sure you can. I just tried the following, and it compiled without complaints.
> import Text.Show.Functions
>
> data Chain = Link Int (Int -> Chain) deriving (Show)
The usual warnings about orphan instances apply, but the purpose of
the Text.Show.Functions module is to provide a standard Show instance
for functions so that libraries (e.g., QuickCheck) don't declare
conflicting instances.
--
Dave Menendez <dave at zednenem.com>
<http://www.eyrie.org/~zednenem/>
More information about the Haskell-Cafe
mailing list