Skip to content

Instantly share code, notes, and snippets.

@mrdomino
mrdomino / quine.hs
Last active December 12, 2015 06:59
e '\\' = "\\\\"
e '\n' = "\\n"
e '\"' = "\\\""
e x = [x]
q = concatMap e
m s = s ++ "\"" ++ q s ++ "\""
main = putStrLn $ m s
where s = "e '\\\\' = \"\\\\\\\\\"\ne '\\n' = \"\\\\n\"\ne '\\\"' = \"\\\\\\\"\"\ne x = [x]\nq = concatMap e\nm s = s ++ \"\\\"\" ++ q s ++ \"\\\"\"\nmain = putStrLn $ m s\n where s = "