Haskell Makefile EDSL

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
module Makefile where


type Target = String
type Dependency = String
type Dependencies = [Dependency]
type Action = IO ()

data Rule = Rule { 
	target :: Target,
	dependsOn :: Dependencies,
	action :: Action
}

build :: Rule -> IO ()
build (Rule t d a) = do 
			putStrLn ("Check if " ++ (show t) ++ " depends on any of " ++ (show d)) 
			a



import Makefile

r1 = Rule {
	target = "file1",
	dependsOn = ["file2"],
	action = do 
			putStrLn "Hello"
			putStrLn "World"
}

main=build r1