git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Some documentation.
9b7790fjoneshf
psci/Commands.hs+48
@@ -1,18 +1,63 @@
1+-----------------------------------------------------------------------------
2+--
3+-- Module : Main
4+-- Copyright : (c) Phil Freeman 2014
5+-- License : MIT
6+--
7+-- Maintainer : Phil Freeman <paf31@cantab.net>
8+-- Stability : experimental
9+-- Portability :
10+--
11+-- |
12+-- Commands for PSCI.
13+--
14+-----------------------------------------------------------------------------
15+
1module Commands where
16module Commands where
2
17
3import Control.Applicative
18import Control.Applicative
4import System.Console.Haskeline
19import System.Console.Haskeline
5
20
21+-- |
22+-- Valid Meta-commands for PSCI
23+--
6data Command
24data Command
25+ -- |
26+ -- And empty line
27+ --
7 = Empty
28 = Empty
29+ -- |
30+ -- A purescript expression
31+ --
8 | Expression [String]
32 | Expression [String]
33+ -- |
34+ -- Show the help command
35+ --
9 | Help
36 | Help
37+ -- |
38+ -- Import a module from a loaded file
39+ --
10 | Import String
40 | Import String
41+ -- |
42+ -- Load a file for use with importing
43+ --
11 | LoadFile FilePath
44 | LoadFile FilePath
45+ -- |
46+ -- Exit PSCI
47+ --
12 | Quit
48 | Quit
49+ -- |
50+ -- Reload the current modules
51+ --
13 | Reload
52 | Reload
53+ -- |
54+ -- An attempt at a meta command that wasn't recognized.
55+ --
14 | Unknown deriving (Show, Eq)
56 | Unknown deriving (Show, Eq)
15
57
58+-- |
59+-- Parses the input and returns either a Metacommand or an expression.
60+--
16getCommand :: InputT IO Command
61getCommand :: InputT IO Command
17getCommand = do
62getCommand = do
18 firstLine <- getInputLine "> "
63 firstLine <- getInputLine "> "
@@ -32,6 +77,9 @@ getCommand = do
32 Nothing -> return $ reverse ls
77 Nothing -> return $ reverse ls
33 Just l' -> go (l' : ls)
78 Just l' -> go (l' : ls)
34
79
80+-- |
81+-- The help menu.
82+--
35help :: [[String]]
83help :: [[String]]
36help =
84help =
37 [ [":? ", "Show this help menu"]
85 [ [":? ", "Show this help menu"]
psci/Main.hs+1
@@ -9,6 +9,7 @@
9-- Portability :
9-- Portability :
10--
10--
11-- |
11-- |
12+-- PureScript Compiler Interactive.
12--
13--
13-----------------------------------------------------------------------------
14-----------------------------------------------------------------------------
14
15