Skip to content

Instantly share code, notes, and snippets.

@tokiwoousaka
Last active August 29, 2015 14:19
Show Gist options
  • Save tokiwoousaka/69165be983834d427416 to your computer and use it in GitHub Desktop.
Save tokiwoousaka/69165be983834d427416 to your computer and use it in GitHub Desktop.
THのlocation関数テスト
{-# LANGUAGE TemplateHaskell#-}
module Main where
import Language.Haskell.TH
$( do
location >>= runIO . (\loc -> do
putStrLn $ loc_filename loc -- THの書かれたファイル名
putStrLn $ loc_package loc -- パッケージ名
putStrLn $ loc_module loc -- モジュール名
print $ loc_start loc -- ソースコード上のマクロの開始位置(行, 列)
print $ loc_end loc -- マクロの終了位置(行, 列)
)
return []
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment