map
함수를 이해했는지 확인하기 위해 A-Z 범위의 모든 항목에 'a'문자를 추가하려고했습니다.목록의 모든 항목에 char을 어떻게 추가합니까?
Prelude> map (++ 'A')['A'..'Z']
<interactive>:46:9:
Couldn't match expected type ‘[a]’ with actual type ‘Char’
Relevant bindings include it :: [[a]] (bound at <interactive>:46:1)
In the second argument of ‘(++)’, namely ‘'A'’
In the first argument of ‘map’, namely ‘(++ 'A')’
In the expression: map (++ 'A') ['A' .. 'Z']
<interactive>:46:14:
Couldn't match expected type ‘[a]’ with actual type ‘Char’
Relevant bindings include it :: [[a]] (bound at <interactive>:46:1)
In the expression: 'A'
In the second argument of ‘map’, namely ‘['A' .. 'Z']’
In the expression: map (++ 'A') ['A' .. 'Z']
<interactive>:46:19:
Couldn't match expected type ‘[a]’ with actual type ‘Char’
Relevant bindings include it :: [[a]] (bound at <interactive>:46:1)
In the expression: 'Z'
In the second argument of ‘map’, namely ‘['A' .. 'Z']’
In the expression: map (++ 'A') ['A' .. 'Z']
Prelude>
이해가 ++ 문자열을 포함 목록에 대한 CONCAT 연산자 : 내가 출력으로 알아 보았 그나마 이러한 예외를 얻을 수 있기 때문에
는 음 appearently 내가 해달라고.
내 코드가 뭐니?
. 아마 당신은 문자열을 사용하기위한 것입니다. 큰 따옴표를 사용하십시오. –