Skip to content

Instantly share code, notes, and snippets.

@KWMalik
Forked from supki/Pisya.hs
Created July 30, 2012 20:07
Show Gist options
  • Save KWMalik/3209738 to your computer and use it in GitHub Desktop.
Save KWMalik/3209738 to your computer and use it in GitHub Desktop.
Construct $name = putStrLn "$name" function via Template Haskell.
{-# LANGUAGE TemplateHaskell #-}
module Pisya where
import PisyaTH
$(anal ["pemis", "gnoi", "sosiska", "sobachka"])
{-# LANGUAGE TemplateHaskell #-}
module PisyaTH where
import Language.Haskell.TH
anal xs = mapM func xs
where func xs = funD (mkName xs) [clause [] (normalB $ appE (varE (mkName "putStrLn")) [e| xs |]) []]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment