Updated editor binding to openEdit node function

This commit is contained in:
Paul Chiusano 2015-02-13 18:47:33 -05:00
parent 752b01e24a
commit 55a6650aeb
2 changed files with 23 additions and 11 deletions

View File

@ -110,6 +110,27 @@ metadatas host params =
let req host params = jsonGet (Encoder.list H.encode) host "metadata" params
in decodeResponse (Decoder.object MD.decodeMetadata) <~ Http.send (Signal.map2 req host params)
type alias OpenEdit =
{ current : Type
, admissible : Type
, locals : List Term
, focalApplications : List Int
, wellTypedLocals : List Term }
openEdit : Signal Host
-> Signal (Term, Path)
-> Signal (Response OpenEdit)
openEdit host params =
let body = Encoder.tuple2 E.encodeTerm Path.encodePath
req host params = jsonPost body host "open-edit" params
decode = Decoder.product5 OpenEdit
T.decodeType
T.decodeType
(Decoder.list E.decodeTerm)
(Decoder.list Decoder.int)
(Decoder.list E.decodeTerm)
in decodeResponse decode <~ Http.send (Signal.map2 req host params)
search : Signal Host
-> Signal (Maybe Type, Query)
-> Signal (Response (List Term))
@ -120,15 +141,6 @@ search host params =
decode = decodeResponse (Decoder.list E.decodeTerm)
in decode <~ Http.send (Signal.map2 req host params)
searchLocal : Signal Host
-> Signal (Hash, Path, Maybe Type)
-> Signal (Response (List Term))
searchLocal host params =
let body = Encoder.tuple3 H.encode Path.encodePath (Encoder.optional T.encodeType)
req host params = jsonGet body host "search-local" params
decode = Decoder.list E.decodeTerm
in decodeResponse decode <~ Http.send (Signal.map2 req host params)
terms : Signal Host -> Signal (List Hash) -> Signal (Response (M.Dict Hash Term))
terms host params =
let req host params = jsonGet (Encoder.list H.encode) host "terms" params

View File

@ -29,8 +29,8 @@ data Node m k t e = Node {
-- returns ( current type
-- , admissible type
-- , local vars
-- , matching local applications
-- , matching local expressions )
-- , well-typed applications of focus
-- , well-typed expressions involving local vars )
openEdit :: e -> P.Path -> Noted m (t, t, [e], [Int], [e]),
-- | Search for a term, optionally constrained to be of the given type
search :: Maybe t -> Query -> Noted m [e],