Skip to content

Instantly share code, notes, and snippets.

@halcat0x15a
Last active October 23, 2015 23:57
Show Gist options
  • Select an option

  • Save halcat0x15a/a3e9bfc140c10ff34741 to your computer and use it in GitHub Desktop.

Select an option

Save halcat0x15a/a3e9bfc140c10ff34741 to your computer and use it in GitHub Desktop.
CPP
{-# OPTIONS_GHC -cpp -pgmPgcc -optP-E #-}
#define SHOW_RESULT(a) (showResult #a (a))
showResult :: Show a => String -> a -> String
showResult expr value = expr ++ " = " ++ show value
main :: IO ()
main = putStrLn SHOW_RESULT(1 + 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment