1{- | This module aims to make it easier to create dev tools for Elm.
3 It provides the ability to:
5 * Detect problems in a program
6 * Figure out types of particular expressions
7 * Canonicalize variables
8 * Convert expressions to JS and HTML
10 This module gives limeted access to the structure of an Elm Program.
11 Giving full access would expose many internal details that are likely to
12 change as Elm progresses. These details have been hidden to avoid breaking
15module Language.Elm.DevTools where
19-- | Parse an Elm program into an AST.
20parse :: String -> Either [Problem] Program
22-- | Get the type of a region of the program. Lets you look
23-- up the type of particular values and expressions.
24typeOf :: Program -> Region -> Either [Problem] String
26-- | Canonicalize a variable. So in a normal module `map` would be canonicalized
28canonicalize :: Program -> Region -> [String]
30-- | Any problem that may come up while parsing or typing a program.
31-- All problems come with a region that is causing the problem.
32data Problem = Problem { message :: String, region :: Region }
37-- | Represents a region, spanning two points in the source code.
38data Region = Region { start :: (Row,Column), end :: (Row,Column) }
40-- | Takes a specific point in the source code, such as the cursor position.
41-- It then determines the region that best represents that point. When the
42-- cursor is within a variable, it chooses the variable. When the cursor is
43-- on parentheses, it selects the region within the parentheses. When the
44-- cursor is on keywords like let, it chooses the whole let-expression.
45region :: (Row,Column) -> Region
46region pos = Region pos pos
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list