
2 May
2009
2 May
'09
3:22 p.m.
Rahul Kapoor
*Main> toEnum 2
ghci does not know what type of enum you want to create from the number 2. Try: toEnum 2 :: DayOfWeek
That said, I would expect "toEnum 2" to give an error like: 'Ambiguous type variable `a'....'. So I am not sure why your error message says: '** Exception: Prelude.Enum.().toEnum: bad argument'
Wild guess: The dread monomorphism restriction uses () as a reasonable type, and it only has one element. Does 'toEnum 0' give '()' as the result? (I couldn't reproduce it with my version of GHCi - I get the ambigous type error message) -k -- If I haven't seen further, it is by standing in the footprints of giants