forked from simonmichael/hledger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.ghci
51 lines (42 loc) · 1.76 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
:set prompt "ghci> "
import System.Environment
setEnv "NO_COLOR" "1"
-- TEMP
-- :m +*Hledger.Cli.Commands
-- https://github.com/cdepillabout/pretty-simple
-- If not using a cabal environment file with pretty-simple added, this adds itK here:
-- :set -package pretty-simple
:set -interactive-print=Text.Pretty.Simple.pPrintNoColor
-- ghci commands to be run once at ghci startup
-- http://www.haskell.org/ghc/docs/7.6.3/html/users_guide/ghci-commands.html
-- set up context (handled by make ghci/stack ghci/cabal repl now)
-- :set -ihledger-lib -ihledger -ihledger-web
-- :l hledger/hledger-cli.hs
-- import Hledger
-- -- :reload and run commands in .ghci2
-- :def R \_ -> return ":reload\n:script .ghci2"
-- Reload (to pick up code changes and flush cached unsafePerformIO values) and run main with the given args
:def rmain \args -> return $ ":reload\n:main "<>args
-- -- run commands from a file, .ghci2 by default
-- :def s \f -> readFile $ if null f then ".ghci2" else f
-- -- reset hledger's sticky global debug level flag so :main --debug=N works
-- :def resetdebug \_ -> return ":!touch hledger-lib/Hledger/Utils.hs\n:reload\n"
-- -- http://www.reddit.com/r/haskell/comments/24kpyu/watching_for_changes_and_rerunning_tests_in_ghci/
-- :{
-- {-
-- import System.FSNotify
-- import Data.String
-- import Control.Concurrent.MVar
-- import Control.Concurrent
-- :def test const (withManager (\manager ->
-- do putStrLn "Listening to changes, press any key to stop..."
-- lock <- newEmptyMVar
-- watchTree manager (fromString ".") (const True) (const $ putMVar lock True)
-- forkIO (getLine >> putMVar lock False)
-- rerun <- readMVar lock
-- return $ if rerun
-- then ":reload \n :main \n :test"
-- else ""
-- ))
-- -}
-- :}