[Haskell-cafe] Enum instantiation
Antoine Latter
aslatter at gmail.com
Fri May 21 22:37:21 EDT 2010
On Fri, May 21, 2010 at 8:59 PM, R J <rj248842 at hotmail.com> wrote:
> If I type "toEnum 5," the error I get is:
> <interactive>:1:0:
> Ambiguous type variable `a' in the constraint:
> `Enum a' arising from a use of `toEnum' at <interactive>:1:0-7
> Probable fix: add a type signature that fixes these type variable(s)
> *Main>
Here the problem is not in your instance of Enum, but that GHCi
doesn't know which instance of enum to use.
In most code this isn't a problem, because the surrounding context
often gives enough information for the type-checker to work with.
But when there isn't enough context, you'll need to provide a type signature.
Does "toEnum 5 :: Day" work?
Antoine
More information about the Haskell-Cafe
mailing list