을 표시 할 때 code 다음 문자열 주위에 따옴표를 억제 :하스켈 :
data HelloWorld = HelloWorld;
instance Show HelloWorld where show _ = "hello world";
hello_world = "hello world"
main = putStr $ show $ (HelloWorld, hello_world)
인쇄 :
(hello world,"hello world")
내가 인쇄에 싶습니다
이(hello world,hello world)
즉 내가 동작을 원하지 다음과 같이 입력하십시오 :
제가 위에서 설명한f
처럼 작동하는 기능이 있는가
show "hello world" = "\"hello world\""
:
불행하게도, show
는,이 만족하지 않는 이유는 무엇입니까?
번역을 위해 새로운 typeclass (예 : 'PPrint')를 만드는 것이 좋습니다. 인간이 읽을 수있는'String'으로 변환합니다. –
@Clinton이 답변을 도움이 되었습니까? –