Skip to content

Instantly share code, notes, and snippets.

@naoto-ogawa
Created January 27, 2018 04:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naoto-ogawa/2e5da169b59523657205fe3aeca480a4 to your computer and use it in GitHub Desktop.
Save naoto-ogawa/2e5da169b59523657205fe3aeca480a4 to your computer and use it in GitHub Desktop.
Haskell Escape
>> "a"
"a"
>> "\a"
"\a"
>> "\\a"
"\\a"
>> "\\\a"
"\\\a"
>> P.length ("a"::String)
1
>> P.length ("\a"::String)
1
>> P.length ("\\a"::String)
2
>> P.length ("\\\a"::String)
2
>> mapM_ print ("a"::String)
'a'
>> mapM_ print ("\a"::String)
'\a'
>> mapM_ print ("\\a"::String)
'\\'
'a'
>> mapM_ print ("\\\a"::String)
'\\'
'\a'
>> "a" == "\a"
False
>> "a\\" == "\\\a"
False
>> show "a"
"\"a\""
>> show "\a"
"\"\\a\""
>> show "\\a"
"\"\\\\a\""
>> show "\\\a"
"\"\\\\\\a\""
>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment