[Haskell-cafe] Re: is there a way to pretty print a module?

Anatoly Yakovenko aeyakovenko at gmail.com
Thu Oct 30 20:18:40 EDT 2008


cool, i found this:

http://www.nabble.com/template-haskell----include-a-file--td19462913.html

$ cat test.hs
{-# LANGUAGE TemplateHaskell#-}
module Main where

import Language.Haskell.TH
import EmbedStr

me = $(embedStr $ readFile "./test.hs")

main = do
   print $ me

$ cat EmbedStr.hs
{-# LANGUAGE TemplateHaskell#-}
module EmbedStr where

import Language.Haskell.TH
import Language.Haskell.TH.Syntax (lift)

embedStr:: IO String -> ExpQ
embedStr str =  lift =<< runIO str


More information about the Haskell-Cafe mailing list