ghci> 3:[True, False]
<interactive>:14:1: error:
? No instance for (Num Bool) arising from the literal ‘3’
? In the first argument of ‘(:)’, namely ‘3’
In the expression: 3 : [True, False]
In an equation for ‘it’: it = 3 : [True, False]
-------------------------------------------------------------------------
? No instance for (Num Bool) arising from the literal ‘3’
리터럴 3의 타입이 Num인데, 3:[True, False]에서 3 자리에 오기로 기대된 타입은 Bool이기 때문에, Num을 Bool로 형변환 시도한것같음
(Num Bool)은 아마 Num :: Bool -> Num같은 함수(생성자?)를 뜻한게 아닌가 하는 생각이 들지만 확신이 서진 않음
? In the first argument of ‘(:)’, namely ‘3’
(:) 함수의 인자로 온 3에서 문제가 생겼음
In the expression: 3 : [True, False]
그것보다 더 큰 맥락에선 3 : [True, False]라는 식에서 문제가 생겼음
3:[True, False]를 (:) 3 [True, False]로 읽는다는 사실을 암시함
In an equation for ‘it’: it = 3 : [True, False]
그것보다 더 큰 맥락에선 it = 3 : [True, False]에서 문제가 생겼음
GHCi가 연산 결과를 자동으로 식별자 it에 담기 때문에 내가 적지 않았더라도 저 문장으로 해석되었음
첫번째줄 에러 해석에서 들은 의문 풀고싶어서 몇번 식 써봤는데 에러만 내서 골치아프네
ghci> :ty Num
<interactive>:1:1: error:
? Illegal term-level use of the type constructor ‘Num’
imported from ‘Prelude’ (and originally defined in ‘GHC.Num’)
? In the expression: Num
하스켈에서 type constructor는 함수가 아님?