perhaps
ajb at spamcop.net
ajb at spamcop.net
Tue Aug 15 02:42:37 EDT 2006
G'day all.
Quoting John Meacham <john at repetae.net>:
> 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 -}
Cheers,
Andrew Bromage
More information about the Libraries
mailing list