-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.ghci
26 lines (24 loc) · 1.03 KB
/
.ghci
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
-- Make sure the D module is always in scope.
:def! l (\arg -> return $ ":load " ++ arg ++ " D\n:module +D")
-- Interactive tools for Solkattu/Score/*.hs
:{
let _ghciKorvai arg = do
(realize, korvai) <- case words arg of
[realize, korvai] -> return (realize, korvai)
[korvai] -> (,) <$> return korvai <*> readFile realizeName
[] -> (,) <$> readFile realizeName <*> readFile korvaiName
_ -> error "usage: :K [realize] [korvai]"
-- Force the thunks because of stupid lazy readFile.
putStrLn $ unwords [realize, korvai]
writeFile realizeName realize
writeFile korvaiName korvai
return $ ":r\n" ++ unwords [realize, korvai]
where
gitRepo = "../data/solkattu-korvai"
korvaiName = gitRepo ++ "/korvai-name"
realizeName = gitRepo ++ "/realize-name"
:}
:def! K _ghciKorvai
-- Play is super heavyweight so only load when wanted.
-- :L has a feature where it adds its arguments to scope.
:def! PL (\_ -> return ":L Solkattu.Play")