
19 Sep
2009
19 Sep
'09
6:55 p.m.
On 17 Sep 2009, at 18:01, Ryan Ingram wrote:
Here's a way that works more closely to your original version:
instance Enumerated a => Target a where convert n | n >= 0 && n < numConstrs = Just (constrs !! n) | otherwise = Nothing where constrs = constructors numConstrs = length constrs
Aha - that's great, and it works without OverlappingInstances (but still with FlexibleInstances and UndecidableInstances - should that worry me?) Just making sure constructors is only referenced once is the key, it seems. Thanks! -Andy