-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #845 from ejgallego/payload
[coq] Abstract the feedback / error payloads better.
- Loading branch information
Showing
13 changed files
with
87 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,14 @@ | ||
(** Messages from Coq *) | ||
type 'l t = 'l option * Lang.Diagnostic.Severity.t * Pp.t | ||
module Payload = struct | ||
type 'l t = | ||
{ range : 'l option | ||
; msg : Pp.t | ||
} | ||
|
||
let make ?range msg = { range; msg } | ||
let map ~f { range; msg } = { range = Option.map f range; msg } | ||
end | ||
|
||
type 'l t = Lang.Diagnostic.Severity.t * 'l Payload.t | ||
|
||
let map ~f (lvl, pl) = (lvl, Payload.map ~f pl) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,22 @@ | ||
(** Messages from Coq *) | ||
type 'l t = 'l option * Lang.Diagnostic.Severity.t * Pp.t | ||
|
||
(** Coq provides payload to our layer via two different mechanisms: | ||
- feedback messages | ||
- error exceptions | ||
In both cases, the payload is the same, and it comes via different ways due | ||
to historical reasons. We abstract the payload as to better handle the | ||
common paths. *) | ||
module Payload : sig | ||
type 'l t = | ||
{ range : 'l option | ||
; msg : Pp.t | ||
} | ||
|
||
val make : ?range:'l -> Pp.t -> 'l t | ||
val map : f:('l -> 'm) -> 'l t -> 'm t | ||
end | ||
|
||
type 'l t = Lang.Diagnostic.Severity.t * 'l Payload.t | ||
|
||
val map : f:('l -> 'm) -> 'l t -> 'm t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters