ajb at ajb at
Tue Aug 15 02:42:37 EDT 2006

G'day all.

Quoting John Meacham <john at>:

> newtype deriving is really great here.

It's really great, but in the case of Silliness, I wouldn't say it's
great _here_.

Incidentally, getting back to the original topic, the argument of using
built-in functions fails for Perhaps.

> Of course, to take the most advantage of this sort of thing, you want to
> define your own classes for some shared syntax.

Slightly contradicting myself, here's one that I use:

    class TestableProperty prop a | prop -> a where
        is :: prop -> a -> Bool

    data Prime = Prime

    instance TestableProperty Prime Integer where
        is Prime x = {- detail omitted -}

The only problem with this is that with the fundep, you can't do this:

    instance (Integral i) => TestableProperty Prime i where
        is Prime x = {- same detail -}

Andrew Bromage

More information about the Libraries mailing list