-
Notifications
You must be signed in to change notification settings - Fork 1
/
repl-snippets.txt
37 lines (23 loc) · 1.74 KB
/
repl-snippets.txt
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
:l Arrowsmith.Repo Arrowsmith.Types Arrowsmith.Project Arrowsmith.ElmFile Arrowsmith.Edit
:m + Arrowsmith.Repo Arrowsmith.Types Arrowsmith.Project Arrowsmith.ElmFile Data.Either Arrowsmith.Edit
let ri = RepoInfo {backend = "github", user = "lachenmayer", project = "secret-sauce"}
p' <- createProject ri
let Right p = p'
let Just b = Data.HashMap.Strict.lookup ["Bar", "Baz"] (elmFiles p)
Right l <- getLatest b
Right f <- compile (head $ sources p)
performEdit f (AddDefinition ("wateva", Just "String", "wateva = \"unoit\""))
["AddDefinition",["wateva","String","wateva = \"unoit babez\""]]
"[\"AddDefinition\",[\"wateva\",\"String\",\"wateva = \\\"unoit\\\"\"]]"
client = require('rest').wrap(require('rest/interceptor/mime')
client(method: 'POST', path: 'http://localhost:8000/github/lachenmayer/secret-sauce/Foo/edit', entity: "[\"AddDefinition\",[\"wateva\",\"String\",\"wateva = \\\"unoit\\\"\"]]").then((x) -> console.log x)
import Arrowsmith.Module
import qualified Data.ByteString.Lazy as BS
src <- readFile "repos/github/lachenmayer/secret-sauce/src/Alias.elm"
f <- BS.readFile "tmp/github/lachenmayer/secret-sauce/daae43398ff8332f1226a8248369ebe22a8a08ad/Alias.elma"
let Just ast = fromAstFile f
moduleSourceDefs src ast
map (defFromSource src) (definitions ast)
let f = ElmFile {filePath = "src/Bar/Baz.elm", fileName = ["Bar","Baz"], source = "module Bar.Baz where\n\nbuzz = \"sure.\"asdfasdfasdf", compiledCode = Just "nope", modul = Just (Module {name = ["Bar","Baz"], imports = [], adts = [], defs = [("buzz",Nothing,"buzz = \"sure.\"",(3,1),(3,15))], errors = []}), inRepo = RepoInfo {backend = "github", user = "lachenmayer", project = "secret-sauce"}}
s <- readFile "repos/github/lachenmayer/secret-sauce/src/Foo.elm"
breakSource s (13,1) (14,18)