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
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe