T5362.hs 536 Bytes
Newer Older
Simon Peyton Jones's avatar
Simon Peyton Jones committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
{-# LANGUAGE TemplateHaskell #-}

module T5362() where

import System.IO
import Language.Haskell.TH

$(
     do fName <- newName "f"
        gName <- newName "g"
        let gExp = varE gName

        sdf <- sigD fName [t| () |]
        sdg <- sigD gName [t| () |]
        fdf <- funD fName [clause [] (normalB [| undefined $gExp |]) []]
        fdg <- funD gName [clause [] (normalB [| undefined       |]) []]
        let ds = [sdf, fdf, sdg, fdg]
        runIO $ do { putStrLn (pprint ds); hFlush stdout }
        return ds
     )