Created
September 6, 2016 01:54
-
-
Save jroesch/68d3fc08260d59fd479f33ee689f3835 to your computer and use it in GitHub Desktop.
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
definition position := nat | |
inductive result (I : Type) : Type -> Type | |
| fail : Π {R}, I -> list string -> string -> result R | |
| partial : Π {R}, (I -> result R) -> result R | |
| done : Π {R}, I -> R -> result R | |
open result | |
definition result.map {A B I : Type} (f : A → B) : result I A -> result I B | |
| result.map (fail input contexts msg) := (fail input contexts msg) | |
| result.map (partial k) := partial (fun x, result.map (k x)) | |
| result.map (done input res) := done input (f res) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment