[Haskell-cafe] Ambiguous type variable with subclass instance
(also: is there a better way to do this?)
haskell at gimbo.org.uk
Thu Sep 17 12:01:36 EDT 2009
On 17 Sep 2009, at 16:50, Daniel Fischer wrote:
> Yes, the second appearance of 'constructors' is at an unspecified
> instance (Enumerated a) => Target a where
> convert n
> | n < 0 = Nothing
> | otherwise = case drop n constructors of
> (x:_) -> Just x
> _ -> Nothing
> would make it compile.
Neat trick. It works: thanks!
> But there'd be a risk that Target is unusable, depending on how
> instance resolution is
Unusable? How so? Sorry, but I don't follow...
More information about the Haskell-Cafe