bsc-leon-vatthauer/agda/bsc-thesis/Data.Irrelevant.html
2024-02-09 17:53:52 +01:00

56 lines
No EOL
12 KiB
HTML

<!DOCTYPE HTML>
<html><head><meta charset="utf-8"><title>Data.Irrelevant</title><link rel="stylesheet" href="Agda.css"></head><body><pre class="Agda"><a id="1" class="Comment">------------------------------------------------------------------------</a>
<a id="74" class="Comment">-- The Agda standard library</a>
<a id="103" class="Comment">--</a>
<a id="106" class="Comment">-- Wrapper for the proof irrelevance modality</a>
<a id="152" class="Comment">--</a>
<a id="155" class="Comment">-- This allows us to store proof irrelevant witnesses in a record and</a>
<a id="225" class="Comment">-- use projections to manipulate them without having to turn on the</a>
<a id="293" class="Comment">-- unsafe option --irrelevant-projections.</a>
<a id="336" class="Comment">-- Cf. Data.Refinement for a use case</a>
<a id="374" class="Comment">------------------------------------------------------------------------</a>
<a id="448" class="Symbol">{-#</a> <a id="452" class="Keyword">OPTIONS</a> <a id="460" class="Pragma">--cubical-compatible</a> <a id="481" class="Pragma">--safe</a> <a id="488" class="Symbol">#-}</a>
<a id="493" class="Keyword">module</a> <a id="500" href="Data.Irrelevant.html" class="Module">Data.Irrelevant</a> <a id="516" class="Keyword">where</a>
<a id="523" class="Keyword">open</a> <a id="528" class="Keyword">import</a> <a id="535" href="Level.html" class="Module">Level</a> <a id="541" class="Keyword">using</a> <a id="547" class="Symbol">(</a><a id="548" href="Agda.Primitive.html#742" class="Postulate">Level</a><a id="553" class="Symbol">)</a>
<a id="556" class="Keyword">private</a>
<a id="566" class="Keyword">variable</a>
<a id="579" href="Data.Irrelevant.html#579" class="Generalizable">a</a> <a id="581" href="Data.Irrelevant.html#581" class="Generalizable">b</a> <a id="583" href="Data.Irrelevant.html#583" class="Generalizable">c</a> <a id="585" class="Symbol">:</a> <a id="587" href="Agda.Primitive.html#742" class="Postulate">Level</a>
<a id="597" href="Data.Irrelevant.html#597" class="Generalizable">A</a> <a id="599" class="Symbol">:</a> <a id="601" href="Agda.Primitive.html#388" class="Primitive">Set</a> <a id="605" href="Data.Irrelevant.html#579" class="Generalizable">a</a>
<a id="611" href="Data.Irrelevant.html#611" class="Generalizable">B</a> <a id="613" class="Symbol">:</a> <a id="615" href="Agda.Primitive.html#388" class="Primitive">Set</a> <a id="619" href="Data.Irrelevant.html#581" class="Generalizable">b</a>
<a id="625" href="Data.Irrelevant.html#625" class="Generalizable">C</a> <a id="627" class="Symbol">:</a> <a id="629" href="Agda.Primitive.html#388" class="Primitive">Set</a> <a id="633" href="Data.Irrelevant.html#583" class="Generalizable">c</a>
<a id="636" class="Comment">------------------------------------------------------------------------</a>
<a id="709" class="Comment">-- Type</a>
<a id="718" class="Keyword">record</a> <a id="Irrelevant"></a><a id="725" href="Data.Irrelevant.html#725" class="Record">Irrelevant</a> <a id="736" class="Symbol">(</a><a id="737" href="Data.Irrelevant.html#737" class="Bound">A</a> <a id="739" class="Symbol">:</a> <a id="741" href="Agda.Primitive.html#388" class="Primitive">Set</a> <a id="745" href="Data.Irrelevant.html#579" class="Generalizable">a</a><a id="746" class="Symbol">)</a> <a id="748" class="Symbol">:</a> <a id="750" href="Agda.Primitive.html#388" class="Primitive">Set</a> <a id="754" href="Data.Irrelevant.html#745" class="Bound">a</a> <a id="756" class="Keyword">where</a>
<a id="764" class="Keyword">constructor</a> <a id="[_]"></a><a id="776" href="Data.Irrelevant.html#776" class="InductiveConstructor Operator">[_]</a>
<a id="782" class="Keyword">field</a> <a id="788" class="Symbol">.</a><a id="Irrelevant.irrelevant"></a><a id="789" href="Data.Irrelevant.html#789" class="Field">irrelevant</a> <a id="800" class="Symbol">:</a> <a id="802" href="Data.Irrelevant.html#737" class="Bound">A</a>
<a id="804" class="Keyword">open</a> <a id="809" href="Data.Irrelevant.html#725" class="Module">Irrelevant</a> <a id="820" class="Keyword">public</a>
<a id="828" class="Comment">------------------------------------------------------------------------</a>
<a id="901" class="Comment">-- Algebraic structure: Functor, Appplicative and Monad-like</a>
<a id="map"></a><a id="963" href="Data.Irrelevant.html#963" class="Function">map</a> <a id="967" class="Symbol">:</a> <a id="969" class="Symbol">(</a><a id="970" href="Data.Irrelevant.html#597" class="Generalizable">A</a> <a id="972" class="Symbol"></a> <a id="974" href="Data.Irrelevant.html#611" class="Generalizable">B</a><a id="975" class="Symbol">)</a> <a id="977" class="Symbol"></a> <a id="979" href="Data.Irrelevant.html#725" class="Record">Irrelevant</a> <a id="990" href="Data.Irrelevant.html#597" class="Generalizable">A</a> <a id="992" class="Symbol"></a> <a id="994" href="Data.Irrelevant.html#725" class="Record">Irrelevant</a> <a id="1005" href="Data.Irrelevant.html#611" class="Generalizable">B</a>
<a id="1007" href="Data.Irrelevant.html#963" class="Function">map</a> <a id="1011" href="Data.Irrelevant.html#1011" class="Bound">f</a> <a id="1013" href="Data.Irrelevant.html#776" class="InductiveConstructor Operator">[</a> <a id="1015" href="Data.Irrelevant.html#1015" class="Bound">a</a> <a id="1017" href="Data.Irrelevant.html#776" class="InductiveConstructor Operator">]</a> <a id="1019" class="Symbol">=</a> <a id="1021" href="Data.Irrelevant.html#776" class="InductiveConstructor Operator">[</a> <a id="1023" href="Data.Irrelevant.html#1011" class="Bound">f</a> <a id="1025" href="Data.Irrelevant.html#1015" class="Bound">a</a> <a id="1027" href="Data.Irrelevant.html#776" class="InductiveConstructor Operator">]</a>
<a id="pure"></a><a id="1030" href="Data.Irrelevant.html#1030" class="Function">pure</a> <a id="1035" class="Symbol">:</a> <a id="1037" href="Data.Irrelevant.html#597" class="Generalizable">A</a> <a id="1039" class="Symbol"></a> <a id="1041" href="Data.Irrelevant.html#725" class="Record">Irrelevant</a> <a id="1052" href="Data.Irrelevant.html#597" class="Generalizable">A</a>
<a id="1054" href="Data.Irrelevant.html#1030" class="Function">pure</a> <a id="1059" href="Data.Irrelevant.html#1059" class="Bound">x</a> <a id="1061" class="Symbol">=</a> <a id="1063" href="Data.Irrelevant.html#776" class="InductiveConstructor Operator">[</a> <a id="1065" href="Data.Irrelevant.html#1059" class="Bound">x</a> <a id="1067" href="Data.Irrelevant.html#776" class="InductiveConstructor Operator">]</a>
<a id="1070" class="Keyword">infixl</a> <a id="1077" class="Number">4</a> <a id="1079" href="Data.Irrelevant.html#1085" class="Function Operator">_&lt;*&gt;_</a>
<a id="_&lt;*&gt;_"></a><a id="1085" href="Data.Irrelevant.html#1085" class="Function Operator">_&lt;*&gt;_</a> <a id="1091" class="Symbol">:</a> <a id="1093" href="Data.Irrelevant.html#725" class="Record">Irrelevant</a> <a id="1104" class="Symbol">(</a><a id="1105" href="Data.Irrelevant.html#597" class="Generalizable">A</a> <a id="1107" class="Symbol"></a> <a id="1109" href="Data.Irrelevant.html#611" class="Generalizable">B</a><a id="1110" class="Symbol">)</a> <a id="1112" class="Symbol"></a> <a id="1114" href="Data.Irrelevant.html#725" class="Record">Irrelevant</a> <a id="1125" href="Data.Irrelevant.html#597" class="Generalizable">A</a> <a id="1127" class="Symbol"></a> <a id="1129" href="Data.Irrelevant.html#725" class="Record">Irrelevant</a> <a id="1140" href="Data.Irrelevant.html#611" class="Generalizable">B</a>
<a id="1142" href="Data.Irrelevant.html#776" class="InductiveConstructor Operator">[</a> <a id="1144" href="Data.Irrelevant.html#1144" class="Bound">f</a> <a id="1146" href="Data.Irrelevant.html#776" class="InductiveConstructor Operator">]</a> <a id="1148" href="Data.Irrelevant.html#1085" class="Function Operator">&lt;*&gt;</a> <a id="1152" href="Data.Irrelevant.html#776" class="InductiveConstructor Operator">[</a> <a id="1154" href="Data.Irrelevant.html#1154" class="Bound">a</a> <a id="1156" href="Data.Irrelevant.html#776" class="InductiveConstructor Operator">]</a> <a id="1158" class="Symbol">=</a> <a id="1160" href="Data.Irrelevant.html#776" class="InductiveConstructor Operator">[</a> <a id="1162" href="Data.Irrelevant.html#1144" class="Bound">f</a> <a id="1164" href="Data.Irrelevant.html#1154" class="Bound">a</a> <a id="1166" href="Data.Irrelevant.html#776" class="InductiveConstructor Operator">]</a>
<a id="1169" class="Keyword">infixl</a> <a id="1176" class="Number">1</a> <a id="1178" href="Data.Irrelevant.html#1184" class="Function Operator">_&gt;&gt;=_</a>
<a id="_&gt;&gt;=_"></a><a id="1184" href="Data.Irrelevant.html#1184" class="Function Operator">_&gt;&gt;=_</a> <a id="1190" class="Symbol">:</a> <a id="1192" href="Data.Irrelevant.html#725" class="Record">Irrelevant</a> <a id="1203" href="Data.Irrelevant.html#597" class="Generalizable">A</a> <a id="1205" class="Symbol"></a> <a id="1207" class="Symbol">(.</a><a id="1209" href="Data.Irrelevant.html#597" class="Generalizable">A</a> <a id="1211" class="Symbol"></a> <a id="1213" href="Data.Irrelevant.html#725" class="Record">Irrelevant</a> <a id="1224" href="Data.Irrelevant.html#611" class="Generalizable">B</a><a id="1225" class="Symbol">)</a> <a id="1227" class="Symbol"></a> <a id="1229" href="Data.Irrelevant.html#725" class="Record">Irrelevant</a> <a id="1240" href="Data.Irrelevant.html#611" class="Generalizable">B</a>
<a id="1242" href="Data.Irrelevant.html#776" class="InductiveConstructor Operator">[</a> <a id="1244" href="Data.Irrelevant.html#1244" class="Bound">a</a> <a id="1246" href="Data.Irrelevant.html#776" class="InductiveConstructor Operator">]</a> <a id="1248" href="Data.Irrelevant.html#1184" class="Function Operator">&gt;&gt;=</a> <a id="1252" href="Data.Irrelevant.html#1252" class="Bound">f</a> <a id="1254" class="Symbol">=</a> <a id="1256" href="Data.Irrelevant.html#1252" class="Bound">f</a> <a id="1258" href="Data.Irrelevant.html#1244" class="Bound">a</a>
<a id="1261" class="Comment">------------------------------------------------------------------------</a>
<a id="1334" class="Comment">-- Other functions</a>
<a id="zipWith"></a><a id="1354" href="Data.Irrelevant.html#1354" class="Function">zipWith</a> <a id="1362" class="Symbol">:</a> <a id="1364" class="Symbol">(</a><a id="1365" href="Data.Irrelevant.html#597" class="Generalizable">A</a> <a id="1367" class="Symbol"></a> <a id="1369" href="Data.Irrelevant.html#611" class="Generalizable">B</a> <a id="1371" class="Symbol"></a> <a id="1373" href="Data.Irrelevant.html#625" class="Generalizable">C</a><a id="1374" class="Symbol">)</a> <a id="1376" class="Symbol"></a> <a id="1378" href="Data.Irrelevant.html#725" class="Record">Irrelevant</a> <a id="1389" href="Data.Irrelevant.html#597" class="Generalizable">A</a> <a id="1391" class="Symbol"></a> <a id="1393" href="Data.Irrelevant.html#725" class="Record">Irrelevant</a> <a id="1404" href="Data.Irrelevant.html#611" class="Generalizable">B</a> <a id="1406" class="Symbol"></a> <a id="1408" href="Data.Irrelevant.html#725" class="Record">Irrelevant</a> <a id="1419" href="Data.Irrelevant.html#625" class="Generalizable">C</a>
<a id="1421" href="Data.Irrelevant.html#1354" class="Function">zipWith</a> <a id="1429" href="Data.Irrelevant.html#1429" class="Bound">f</a> <a id="1431" href="Data.Irrelevant.html#1431" class="Bound">a</a> <a id="1433" href="Data.Irrelevant.html#1433" class="Bound">b</a> <a id="1435" class="Symbol">=</a> <a id="1437" class="Symbol"></a> <a id="1439" href="Data.Irrelevant.html#1429" class="Bound">f</a> <a id="1441" href="Data.Irrelevant.html#1431" class="Bound">a</a> <a id="1443" href="Data.Irrelevant.html#1433" class="Bound">b</a> <a id="1445" class="Symbol"></a>
</pre></body></html>