on master help sign in
A bit more syntactic sugar for effect testing

May read better in many contexts.

commita9f184d642ec13ce9b7d7f9043a268394caf4c65 authorEdwin Brady <ecb10@st-andrews.ac.uk> dateWed 16 Oct 2013, 21:32 (13 years ago) parent6d9f01c
1 file changed+20
effects/Effects.idr+20
effects/Effects.idr+20
@@ -154,6 +154,26 @@ syntax if_valid then [e] else [t] =
154154syntax if_valid [lbl] then [e] else [t] =
155155 test_lbl {x=lbl} (tactics { applyTactic findEffElem 20; solve; }) t e
156156
157+syntax if_error then [t] else [e] =
158+ test (tactics { applyTactic findEffElem 20; solve; }) t e
159+
160+syntax if_error [lbl] then [t] else [e] =
161+ test_lbl {x=lbl} (tactics { applyTactic findEffElem 20; solve; }) t e
162+
163+-- These may read better in some contexts
164+
165+syntax if_right then [e] else [t] =
166+ test (tactics { applyTactic findEffElem 20; solve; }) t e
167+
168+syntax if_right [lbl] then [e] else [t] =
169+ test_lbl {x=lbl} (tactics { applyTactic findEffElem 20; solve; }) t e
170+
171+syntax if_left then [t] else [e] =
172+ test (tactics { applyTactic findEffElem 20; solve; }) t e
173+
174+syntax if_left [lbl] then [t] else [e] =
175+ test_lbl {x=lbl} (tactics { applyTactic findEffElem 20; solve; }) t e
176+
157177
158178-- for 'do' notation
159179