Я наткнулся на кое-что, что показалось мне любопытным, когда я играл с Haskell. интерактивная подсказка (ghci )Следующий код, запущенный в ghci 7.0.4
[minBound..1]
, выдает следующее исключение:
<interactive>:1:12:
Ambiguous type variable `t0' in the constraints:
(Num t0) arising from the literal `1' at <interactive>:1:12
(Enum t0) arising from the arithmetic sequence `minBound.. 1'
at <interactive>:1:1-13
(Bounded t0) arising from a use of `minBound'
at <interactive>:1:2-9
Probable fix: add a type signature that fixes these type variable(s)
In the expression: 1
In the expression: [minBound.. 1]
In an equation for `it': it = [minBound.. 1]
Я знаю, что запись выше как [minBound..1 ::Int] прояснит ситуацию. что '1' здесь означает Int , но мой вопрос в том, в чем заключается двусмысленность? '1' можно интерпретировать как Int , Integer ,Float или Double , но ни один из них, кроме Int , не принадлежит классуBounded . Итак, существует ли другой класс, под который может маскироваться литерал 1? Если нет, то что?