We know 1:2:[]
will returns [1,2]
.
I just tried 1:2
, this gives me an error.
<interactive>:48:1: error:
? Non type-variable argument in the constraint: Num [a]
(Use FlexibleContexts to permit this)
? When checking the inferred type
it :: forall a. (Num a, Num [a]) => [a]
I know this may be not a proper example since the :
operation cons an element and a list. But I'm just wondering how it works in 1:2:[]