rachel.cafe/agda/Data.Maybe.Base.html

140 lines
37 KiB
HTML
Raw Permalink Normal View History

2022-06-23 22:12:24 +02:00
<!DOCTYPE HTML>
<html><head><meta charset="utf-8"><title>Data.Maybe.Base</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">-- The Maybe type and some operations</a>
<a id="144" class="Comment">------------------------------------------------------------------------</a>
<a id="218" class="Comment">-- The definitions in this file are reexported by Data.Maybe.</a>
<a id="281" class="Symbol">{-#</a> <a id="285" class="Keyword">OPTIONS</a> <a id="293" class="Pragma">--without-K</a> <a id="305" class="Pragma">--safe</a> <a id="312" class="Symbol">#-}</a>
<a id="317" class="Keyword">module</a> <a id="324" href="Data.Maybe.Base.html" class="Module">Data.Maybe.Base</a> <a id="340" class="Keyword">where</a>
<a id="347" class="Keyword">open</a> <a id="352" class="Keyword">import</a> <a id="359" href="Level.html" class="Module">Level</a>
<a id="365" class="Keyword">open</a> <a id="370" class="Keyword">import</a> <a id="377" href="Data.Bool.Base.html" class="Module">Data.Bool.Base</a> <a id="392" class="Keyword">using</a> <a id="398" class="Symbol">(</a><a id="399" href="Agda.Builtin.Bool.html#163" class="Datatype">Bool</a><a id="403" class="Symbol">;</a> <a id="405" href="Agda.Builtin.Bool.html#188" class="InductiveConstructor">true</a><a id="409" class="Symbol">;</a> <a id="411" href="Agda.Builtin.Bool.html#182" class="InductiveConstructor">false</a><a id="416" class="Symbol">;</a> <a id="418" href="Data.Bool.Base.html#932" class="Function">not</a><a id="421" class="Symbol">)</a>
<a id="423" class="Keyword">open</a> <a id="428" class="Keyword">import</a> <a id="435" href="Data.Unit.Base.html" class="Module">Data.Unit.Base</a> <a id="450" class="Keyword">using</a> <a id="456" class="Symbol">(</a><a id="457" href="Agda.Builtin.Unit.html#164" class="Record"></a><a id="458" class="Symbol">)</a>
<a id="460" class="Keyword">open</a> <a id="465" class="Keyword">import</a> <a id="472" href="Data.These.Base.html" class="Module">Data.These.Base</a> <a id="488" class="Keyword">using</a> <a id="494" class="Symbol">(</a><a id="495" href="Data.These.Base.html#528" class="Datatype">These</a><a id="500" class="Symbol">;</a> <a id="502" href="Data.These.Base.html#586" class="InductiveConstructor">this</a><a id="506" class="Symbol">;</a> <a id="508" href="Data.These.Base.html#614" class="InductiveConstructor">that</a><a id="512" class="Symbol">;</a> <a id="514" href="Data.These.Base.html#642" class="InductiveConstructor">these</a><a id="519" class="Symbol">)</a>
<a id="521" class="Keyword">open</a> <a id="526" class="Keyword">import</a> <a id="533" href="Data.Product.html" class="Module">Data.Product</a> <a id="546" class="Symbol">as</a> <a id="549" class="Module">Prod</a> <a id="554" class="Keyword">using</a> <a id="560" class="Symbol">(</a><a id="561" href="Data.Product.html#1167" class="Function Operator">_×_</a><a id="564" class="Symbol">;</a> <a id="566" href="Agda.Builtin.Sigma.html#236" class="InductiveConstructor Operator">_,_</a><a id="569" class="Symbol">)</a>
<a id="571" class="Keyword">open</a> <a id="576" class="Keyword">import</a> <a id="583" href="Function.Base.html" class="Module">Function.Base</a>
<a id="597" class="Keyword">open</a> <a id="602" class="Keyword">import</a> <a id="609" href="Relation.Nullary.Reflects.html" class="Module">Relation.Nullary.Reflects</a>
<a id="635" class="Keyword">open</a> <a id="640" class="Keyword">import</a> <a id="647" href="Relation.Nullary.html" class="Module">Relation.Nullary</a>
<a id="665" class="Keyword">private</a>
<a id="675" class="Keyword">variable</a>
<a id="688" href="Data.Maybe.Base.html#688" class="Generalizable">a</a> <a id="690" href="Data.Maybe.Base.html#690" class="Generalizable">b</a> <a id="692" href="Data.Maybe.Base.html#692" class="Generalizable">c</a> <a id="694" class="Symbol">:</a> <a id="696" href="Agda.Primitive.html#597" class="Postulate">Level</a>
<a id="706" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="708" class="Symbol">:</a> <a id="710" href="Agda.Primitive.html#326" class="Primitive">Set</a> <a id="714" href="Data.Maybe.Base.html#688" class="Generalizable">a</a>
<a id="720" href="Data.Maybe.Base.html#720" class="Generalizable">B</a> <a id="722" class="Symbol">:</a> <a id="724" href="Agda.Primitive.html#326" class="Primitive">Set</a> <a id="728" href="Data.Maybe.Base.html#690" class="Generalizable">b</a>
<a id="734" href="Data.Maybe.Base.html#734" class="Generalizable">C</a> <a id="736" class="Symbol">:</a> <a id="738" href="Agda.Primitive.html#326" class="Primitive">Set</a> <a id="742" href="Data.Maybe.Base.html#692" class="Generalizable">c</a>
<a id="745" class="Comment">------------------------------------------------------------------------</a>
<a id="818" class="Comment">-- Definition</a>
<a id="833" class="Keyword">open</a> <a id="838" class="Keyword">import</a> <a id="845" href="Agda.Builtin.Maybe.html" class="Module">Agda.Builtin.Maybe</a> <a id="864" class="Keyword">public</a>
<a id="873" class="Keyword">using</a> <a id="879" class="Symbol">(</a><a id="880" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a><a id="885" class="Symbol">;</a> <a id="887" href="Agda.Builtin.Maybe.html#174" class="InductiveConstructor">just</a><a id="891" class="Symbol">;</a> <a id="893" href="Agda.Builtin.Maybe.html#195" class="InductiveConstructor">nothing</a><a id="900" class="Symbol">)</a>
<a id="903" class="Comment">------------------------------------------------------------------------</a>
<a id="976" class="Comment">-- Some operations</a>
<a id="boolToMaybe"></a><a id="996" href="Data.Maybe.Base.html#996" class="Function">boolToMaybe</a> <a id="1008" class="Symbol">:</a> <a id="1010" href="Agda.Builtin.Bool.html#163" class="Datatype">Bool</a> <a id="1015" class="Symbol"></a> <a id="1017" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="1023" href="Agda.Builtin.Unit.html#164" class="Record"></a>
<a id="1025" href="Data.Maybe.Base.html#996" class="Function">boolToMaybe</a> <a id="1037" href="Agda.Builtin.Bool.html#188" class="InductiveConstructor">true</a> <a id="1043" class="Symbol">=</a> <a id="1045" href="Agda.Builtin.Maybe.html#174" class="InductiveConstructor">just</a> <a id="1050" class="Symbol">_</a>
<a id="1052" href="Data.Maybe.Base.html#996" class="Function">boolToMaybe</a> <a id="1064" href="Agda.Builtin.Bool.html#182" class="InductiveConstructor">false</a> <a id="1070" class="Symbol">=</a> <a id="1072" href="Agda.Builtin.Maybe.html#195" class="InductiveConstructor">nothing</a>
<a id="is-just"></a><a id="1081" href="Data.Maybe.Base.html#1081" class="Function">is-just</a> <a id="1089" class="Symbol">:</a> <a id="1091" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="1097" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="1099" class="Symbol"></a> <a id="1101" href="Agda.Builtin.Bool.html#163" class="Datatype">Bool</a>
<a id="1106" href="Data.Maybe.Base.html#1081" class="Function">is-just</a> <a id="1114" class="Symbol">(</a><a id="1115" href="Agda.Builtin.Maybe.html#174" class="InductiveConstructor">just</a> <a id="1120" class="Symbol">_)</a> <a id="1123" class="Symbol">=</a> <a id="1125" href="Agda.Builtin.Bool.html#188" class="InductiveConstructor">true</a>
<a id="1130" href="Data.Maybe.Base.html#1081" class="Function">is-just</a> <a id="1138" href="Agda.Builtin.Maybe.html#195" class="InductiveConstructor">nothing</a> <a id="1147" class="Symbol">=</a> <a id="1149" href="Agda.Builtin.Bool.html#182" class="InductiveConstructor">false</a>
<a id="is-nothing"></a><a id="1156" href="Data.Maybe.Base.html#1156" class="Function">is-nothing</a> <a id="1167" class="Symbol">:</a> <a id="1169" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="1175" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="1177" class="Symbol"></a> <a id="1179" href="Agda.Builtin.Bool.html#163" class="Datatype">Bool</a>
<a id="1184" href="Data.Maybe.Base.html#1156" class="Function">is-nothing</a> <a id="1195" class="Symbol">=</a> <a id="1197" href="Data.Bool.Base.html#932" class="Function">not</a> <a id="1201" href="Function.Base.html#1031" class="Function Operator"></a> <a id="1203" href="Data.Maybe.Base.html#1081" class="Function">is-just</a>
<a id="decToMaybe"></a><a id="1212" href="Data.Maybe.Base.html#1212" class="Function">decToMaybe</a> <a id="1223" class="Symbol">:</a> <a id="1225" href="Relation.Nullary.html#1511" class="Record">Dec</a> <a id="1229" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="1231" class="Symbol"></a> <a id="1233" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="1239" href="Data.Maybe.Base.html#706" class="Generalizable">A</a>
<a id="1241" href="Data.Maybe.Base.html#1212" class="Function">decToMaybe</a> <a id="1252" class="Symbol">(</a> <a id="1254" href="Agda.Builtin.Bool.html#188" class="InductiveConstructor">true</a> <a id="1259" href="Relation.Nullary.html#1559" class="InductiveConstructor Operator">because</a> <a id="1267" href="Data.Maybe.Base.html#1267" class="Bound">[a]</a><a id="1270" class="Symbol">)</a> <a id="1272" class="Symbol">=</a> <a id="1274" href="Agda.Builtin.Maybe.html#174" class="InductiveConstructor">just</a> <a id="1279" class="Symbol">(</a><a id="1280" href="Relation.Nullary.Reflects.html#1031" class="Function">invert</a> <a id="1287" href="Data.Maybe.Base.html#1267" class="Bound">[a]</a><a id="1290" class="Symbol">)</a>
<a id="1292" href="Data.Maybe.Base.html#1212" class="Function">decToMaybe</a> <a id="1303" class="Symbol">(</a><a id="1304" href="Agda.Builtin.Bool.html#182" class="InductiveConstructor">false</a> <a id="1310" href="Relation.Nullary.html#1559" class="InductiveConstructor Operator">because</a> <a id="1319" class="Symbol">_</a> <a id="1321" class="Symbol">)</a> <a id="1323" class="Symbol">=</a> <a id="1325" href="Agda.Builtin.Maybe.html#195" class="InductiveConstructor">nothing</a>
<a id="1334" class="Comment">-- A dependent eliminator.</a>
<a id="maybe"></a><a id="1362" href="Data.Maybe.Base.html#1362" class="Function">maybe</a> <a id="1368" class="Symbol">:</a> <a id="1370" class="Symbol"></a> <a id="1372" class="Symbol">{</a><a id="1373" href="Data.Maybe.Base.html#1373" class="Bound">A</a> <a id="1375" class="Symbol">:</a> <a id="1377" href="Agda.Primitive.html#326" class="Primitive">Set</a> <a id="1381" href="Data.Maybe.Base.html#688" class="Generalizable">a</a><a id="1382" class="Symbol">}</a> <a id="1384" class="Symbol">{</a><a id="1385" href="Data.Maybe.Base.html#1385" class="Bound">B</a> <a id="1387" class="Symbol">:</a> <a id="1389" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="1395" href="Data.Maybe.Base.html#1373" class="Bound">A</a> <a id="1397" class="Symbol"></a> <a id="1399" href="Agda.Primitive.html#326" class="Primitive">Set</a> <a id="1403" href="Data.Maybe.Base.html#690" class="Generalizable">b</a><a id="1404" class="Symbol">}</a> <a id="1406" class="Symbol"></a>
<a id="1416" class="Symbol">((</a><a id="1418" href="Data.Maybe.Base.html#1418" class="Bound">x</a> <a id="1420" class="Symbol">:</a> <a id="1422" href="Data.Maybe.Base.html#1373" class="Bound">A</a><a id="1423" class="Symbol">)</a> <a id="1425" class="Symbol"></a> <a id="1427" href="Data.Maybe.Base.html#1385" class="Bound">B</a> <a id="1429" class="Symbol">(</a><a id="1430" href="Agda.Builtin.Maybe.html#174" class="InductiveConstructor">just</a> <a id="1435" href="Data.Maybe.Base.html#1418" class="Bound">x</a><a id="1436" class="Symbol">))</a> <a id="1439" class="Symbol"></a> <a id="1441" href="Data.Maybe.Base.html#1385" class="Bound">B</a> <a id="1443" href="Agda.Builtin.Maybe.html#195" class="InductiveConstructor">nothing</a> <a id="1451" class="Symbol"></a> <a id="1453" class="Symbol">(</a><a id="1454" href="Data.Maybe.Base.html#1454" class="Bound">x</a> <a id="1456" class="Symbol">:</a> <a id="1458" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="1464" href="Data.Maybe.Base.html#1373" class="Bound">A</a><a id="1465" class="Symbol">)</a> <a id="1467" class="Symbol"></a> <a id="1469" href="Data.Maybe.Base.html#1385" class="Bound">B</a> <a id="1471" href="Data.Maybe.Base.html#1454" class="Bound">x</a>
<a id="1473" href="Data.Maybe.Base.html#1362" class="Function">maybe</a> <a id="1479" href="Data.Maybe.Base.html#1479" class="Bound">j</a> <a id="1481" href="Data.Maybe.Base.html#1481" class="Bound">n</a> <a id="1483" class="Symbol">(</a><a id="1484" href="Agda.Builtin.Maybe.html#174" class="InductiveConstructor">just</a> <a id="1489" href="Data.Maybe.Base.html#1489" class="Bound">x</a><a id="1490" class="Symbol">)</a> <a id="1492" class="Symbol">=</a> <a id="1494" href="Data.Maybe.Base.html#1479" class="Bound">j</a> <a id="1496" href="Data.Maybe.Base.html#1489" class="Bound">x</a>
<a id="1498" href="Data.Maybe.Base.html#1362" class="Function">maybe</a> <a id="1504" href="Data.Maybe.Base.html#1504" class="Bound">j</a> <a id="1506" href="Data.Maybe.Base.html#1506" class="Bound">n</a> <a id="1508" href="Agda.Builtin.Maybe.html#195" class="InductiveConstructor">nothing</a> <a id="1517" class="Symbol">=</a> <a id="1519" href="Data.Maybe.Base.html#1506" class="Bound">n</a>
<a id="1522" class="Comment">-- A non-dependent eliminator.</a>
<a id="maybe"></a><a id="1554" href="Data.Maybe.Base.html#1554" class="Function">maybe</a> <a id="1561" class="Symbol">:</a> <a id="1563" class="Symbol">(</a><a id="1564" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="1566" class="Symbol"></a> <a id="1568" href="Data.Maybe.Base.html#720" class="Generalizable">B</a><a id="1569" class="Symbol">)</a> <a id="1571" class="Symbol"></a> <a id="1573" href="Data.Maybe.Base.html#720" class="Generalizable">B</a> <a id="1575" class="Symbol"></a> <a id="1577" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="1583" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="1585" class="Symbol"></a> <a id="1587" href="Data.Maybe.Base.html#720" class="Generalizable">B</a>
<a id="1589" href="Data.Maybe.Base.html#1554" class="Function">maybe</a> <a id="1596" class="Symbol">=</a> <a id="1598" href="Data.Maybe.Base.html#1362" class="Function">maybe</a>
<a id="1605" class="Comment">-- A defaulting mechanism</a>
<a id="fromMaybe"></a><a id="1632" href="Data.Maybe.Base.html#1632" class="Function">fromMaybe</a> <a id="1642" class="Symbol">:</a> <a id="1644" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="1646" class="Symbol"></a> <a id="1648" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="1654" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="1656" class="Symbol"></a> <a id="1658" href="Data.Maybe.Base.html#706" class="Generalizable">A</a>
<a id="1660" href="Data.Maybe.Base.html#1632" class="Function">fromMaybe</a> <a id="1670" class="Symbol">=</a> <a id="1672" href="Data.Maybe.Base.html#1554" class="Function">maybe</a> <a id="1679" href="Function.Base.html#615" class="Function">id</a>
<a id="1683" class="Comment">-- A safe variant of &quot;fromJust&quot;. If the value is nothing, then the</a>
<a id="1750" class="Comment">-- return type is the unit type.</a>
<a id="1784" class="Keyword">module</a> <a id="1791" href="Data.Maybe.Base.html#1791" class="Module">_</a> <a id="1793" class="Symbol">{</a><a id="1794" href="Data.Maybe.Base.html#1794" class="Bound">a</a><a id="1795" class="Symbol">}</a> <a id="1797" class="Symbol">{</a><a id="1798" href="Data.Maybe.Base.html#1798" class="Bound">A</a> <a id="1800" class="Symbol">:</a> <a id="1802" href="Agda.Primitive.html#326" class="Primitive">Set</a> <a id="1806" href="Data.Maybe.Base.html#1794" class="Bound">a</a><a id="1807" class="Symbol">}</a> <a id="1809" class="Keyword">where</a>
<a id="1818" href="Data.Maybe.Base.html#1818" class="Function">From-just</a> <a id="1828" class="Symbol">:</a> <a id="1830" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="1836" href="Data.Maybe.Base.html#1798" class="Bound">A</a> <a id="1838" class="Symbol"></a> <a id="1840" href="Agda.Primitive.html#326" class="Primitive">Set</a> <a id="1844" href="Data.Maybe.Base.html#1794" class="Bound">a</a>
<a id="1848" href="Data.Maybe.Base.html#1818" class="Function">From-just</a> <a id="1858" class="Symbol">(</a><a id="1859" href="Agda.Builtin.Maybe.html#174" class="InductiveConstructor">just</a> <a id="1864" class="Symbol">_)</a> <a id="1867" class="Symbol">=</a> <a id="1869" href="Data.Maybe.Base.html#1798" class="Bound">A</a>
<a id="1873" href="Data.Maybe.Base.html#1818" class="Function">From-just</a> <a id="1883" href="Agda.Builtin.Maybe.html#195" class="InductiveConstructor">nothing</a> <a id="1892" class="Symbol">=</a> <a id="1894" href="Level.html#400" class="Record">Lift</a> <a id="1899" href="Data.Maybe.Base.html#1794" class="Bound">a</a> <a id="1901" href="Agda.Builtin.Unit.html#164" class="Record"></a>
<a id="1906" href="Data.Maybe.Base.html#1906" class="Function">from-just</a> <a id="1916" class="Symbol">:</a> <a id="1918" class="Symbol">(</a><a id="1919" href="Data.Maybe.Base.html#1919" class="Bound">x</a> <a id="1921" class="Symbol">:</a> <a id="1923" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="1929" href="Data.Maybe.Base.html#1798" class="Bound">A</a><a id="1930" class="Symbol">)</a> <a id="1932" class="Symbol"></a> <a id="1934" href="Data.Maybe.Base.html#1818" class="Function">From-just</a> <a id="1944" href="Data.Maybe.Base.html#1919" class="Bound">x</a>
<a id="1948" href="Data.Maybe.Base.html#1906" class="Function">from-just</a> <a id="1958" class="Symbol">(</a><a id="1959" href="Agda.Builtin.Maybe.html#174" class="InductiveConstructor">just</a> <a id="1964" href="Data.Maybe.Base.html#1964" class="Bound">x</a><a id="1965" class="Symbol">)</a> <a id="1967" class="Symbol">=</a> <a id="1969" href="Data.Maybe.Base.html#1964" class="Bound">x</a>
<a id="1973" href="Data.Maybe.Base.html#1906" class="Function">from-just</a> <a id="1983" href="Agda.Builtin.Maybe.html#195" class="InductiveConstructor">nothing</a> <a id="1992" class="Symbol">=</a> <a id="1994" class="Symbol">_</a>
<a id="1997" class="Comment">-- Functoriality: map</a>
<a id="map"></a><a id="2020" href="Data.Maybe.Base.html#2020" class="Function">map</a> <a id="2024" class="Symbol">:</a> <a id="2026" class="Symbol">(</a><a id="2027" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="2029" class="Symbol"></a> <a id="2031" href="Data.Maybe.Base.html#720" class="Generalizable">B</a><a id="2032" class="Symbol">)</a> <a id="2034" class="Symbol"></a> <a id="2036" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="2042" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="2044" class="Symbol"></a> <a id="2046" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="2052" href="Data.Maybe.Base.html#720" class="Generalizable">B</a>
<a id="2054" href="Data.Maybe.Base.html#2020" class="Function">map</a> <a id="2058" href="Data.Maybe.Base.html#2058" class="Bound">f</a> <a id="2060" class="Symbol">=</a> <a id="2062" href="Data.Maybe.Base.html#1362" class="Function">maybe</a> <a id="2068" class="Symbol">(</a><a id="2069" href="Agda.Builtin.Maybe.html#174" class="InductiveConstructor">just</a> <a id="2074" href="Function.Base.html#1031" class="Function Operator"></a> <a id="2076" href="Data.Maybe.Base.html#2058" class="Bound">f</a><a id="2077" class="Symbol">)</a> <a id="2079" href="Agda.Builtin.Maybe.html#195" class="InductiveConstructor">nothing</a>
<a id="2088" class="Comment">-- Applicative: ap</a>
<a id="ap"></a><a id="2108" href="Data.Maybe.Base.html#2108" class="Function">ap</a> <a id="2111" class="Symbol">:</a> <a id="2113" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="2119" class="Symbol">(</a><a id="2120" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="2122" class="Symbol"></a> <a id="2124" href="Data.Maybe.Base.html#720" class="Generalizable">B</a><a id="2125" class="Symbol">)</a> <a id="2127" class="Symbol"></a> <a id="2129" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="2135" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="2137" class="Symbol"></a> <a id="2139" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="2145" href="Data.Maybe.Base.html#720" class="Generalizable">B</a>
<a id="2147" href="Data.Maybe.Base.html#2108" class="Function">ap</a> <a id="2150" href="Agda.Builtin.Maybe.html#195" class="InductiveConstructor">nothing</a> <a id="2159" class="Symbol">=</a> <a id="2161" href="Function.Base.html#636" class="Function">const</a> <a id="2167" href="Agda.Builtin.Maybe.html#195" class="InductiveConstructor">nothing</a>
<a id="2175" href="Data.Maybe.Base.html#2108" class="Function">ap</a> <a id="2178" class="Symbol">(</a><a id="2179" href="Agda.Builtin.Maybe.html#174" class="InductiveConstructor">just</a> <a id="2184" href="Data.Maybe.Base.html#2184" class="Bound">f</a><a id="2185" class="Symbol">)</a> <a id="2187" class="Symbol">=</a> <a id="2189" href="Data.Maybe.Base.html#2020" class="Function">map</a> <a id="2193" href="Data.Maybe.Base.html#2184" class="Bound">f</a>
<a id="2196" class="Comment">-- Monad: bind</a>
<a id="2212" class="Keyword">infixl</a> <a id="2219" class="Number">1</a> <a id="2221" href="Data.Maybe.Base.html#2227" class="Function Operator">_&gt;&gt;=_</a>
<a id="_&gt;&gt;=_"></a><a id="2227" href="Data.Maybe.Base.html#2227" class="Function Operator">_&gt;&gt;=_</a> <a id="2233" class="Symbol">:</a> <a id="2235" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="2241" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="2243" class="Symbol"></a> <a id="2245" class="Symbol">(</a><a id="2246" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="2248" class="Symbol"></a> <a id="2250" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="2256" href="Data.Maybe.Base.html#720" class="Generalizable">B</a><a id="2257" class="Symbol">)</a> <a id="2259" class="Symbol"></a> <a id="2261" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="2267" href="Data.Maybe.Base.html#720" class="Generalizable">B</a>
<a id="2269" href="Agda.Builtin.Maybe.html#195" class="InductiveConstructor">nothing</a> <a id="2277" href="Data.Maybe.Base.html#2227" class="Function Operator">&gt;&gt;=</a> <a id="2281" href="Data.Maybe.Base.html#2281" class="Bound">f</a> <a id="2283" class="Symbol">=</a> <a id="2285" href="Agda.Builtin.Maybe.html#195" class="InductiveConstructor">nothing</a>
<a id="2293" href="Agda.Builtin.Maybe.html#174" class="InductiveConstructor">just</a> <a id="2298" href="Data.Maybe.Base.html#2298" class="Bound">a</a> <a id="2301" href="Data.Maybe.Base.html#2227" class="Function Operator">&gt;&gt;=</a> <a id="2305" href="Data.Maybe.Base.html#2305" class="Bound">f</a> <a id="2307" class="Symbol">=</a> <a id="2309" href="Data.Maybe.Base.html#2305" class="Bound">f</a> <a id="2311" href="Data.Maybe.Base.html#2298" class="Bound">a</a>
<a id="2314" class="Comment">-- Alternative: &lt;&gt;</a>
<a id="_&lt;&gt;_"></a><a id="2335" href="Data.Maybe.Base.html#2335" class="Function Operator">_&lt;&gt;_</a> <a id="2341" class="Symbol">:</a> <a id="2343" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="2349" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="2351" class="Symbol"></a> <a id="2353" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="2359" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="2361" class="Symbol"></a> <a id="2363" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="2369" href="Data.Maybe.Base.html#706" class="Generalizable">A</a>
<a id="2371" href="Agda.Builtin.Maybe.html#174" class="InductiveConstructor">just</a> <a id="2376" href="Data.Maybe.Base.html#2376" class="Bound">x</a> <a id="2379" href="Data.Maybe.Base.html#2335" class="Function Operator">&lt;&gt;</a> <a id="2383" href="Data.Maybe.Base.html#2383" class="Bound">my</a> <a id="2386" class="Symbol">=</a> <a id="2388" href="Agda.Builtin.Maybe.html#174" class="InductiveConstructor">just</a> <a id="2393" href="Data.Maybe.Base.html#2376" class="Bound">x</a>
<a id="2395" href="Agda.Builtin.Maybe.html#195" class="InductiveConstructor">nothing</a> <a id="2403" href="Data.Maybe.Base.html#2335" class="Function Operator">&lt;&gt;</a> <a id="2407" href="Data.Maybe.Base.html#2407" class="Bound">my</a> <a id="2410" class="Symbol">=</a> <a id="2412" href="Data.Maybe.Base.html#2407" class="Bound">my</a>
<a id="2416" class="Comment">-- Just when the boolean is true</a>
<a id="when"></a><a id="2450" href="Data.Maybe.Base.html#2450" class="Function">when</a> <a id="2455" class="Symbol">:</a> <a id="2457" href="Agda.Builtin.Bool.html#163" class="Datatype">Bool</a> <a id="2462" class="Symbol"></a> <a id="2464" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="2466" class="Symbol"></a> <a id="2468" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="2474" href="Data.Maybe.Base.html#706" class="Generalizable">A</a>
<a id="2476" href="Data.Maybe.Base.html#2450" class="Function">when</a> <a id="2481" href="Data.Maybe.Base.html#2481" class="Bound">b</a> <a id="2483" href="Data.Maybe.Base.html#2483" class="Bound">c</a> <a id="2485" class="Symbol">=</a> <a id="2487" href="Data.Maybe.Base.html#2020" class="Function">map</a> <a id="2491" class="Symbol">(</a><a id="2492" href="Function.Base.html#636" class="Function">const</a> <a id="2498" href="Data.Maybe.Base.html#2483" class="Bound">c</a><a id="2499" class="Symbol">)</a> <a id="2501" class="Symbol">(</a><a id="2502" href="Data.Maybe.Base.html#996" class="Function">boolToMaybe</a> <a id="2514" href="Data.Maybe.Base.html#2481" class="Bound">b</a><a id="2515" class="Symbol">)</a>
<a id="2518" class="Comment">------------------------------------------------------------------------</a>
<a id="2591" class="Comment">-- Aligning and zipping</a>
<a id="alignWith"></a><a id="2616" href="Data.Maybe.Base.html#2616" class="Function">alignWith</a> <a id="2626" class="Symbol">:</a> <a id="2628" class="Symbol">(</a><a id="2629" href="Data.These.Base.html#528" class="Datatype">These</a> <a id="2635" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="2637" href="Data.Maybe.Base.html#720" class="Generalizable">B</a> <a id="2639" class="Symbol"></a> <a id="2641" href="Data.Maybe.Base.html#734" class="Generalizable">C</a><a id="2642" class="Symbol">)</a> <a id="2644" class="Symbol"></a> <a id="2646" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="2652" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="2654" class="Symbol"></a> <a id="2656" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="2662" href="Data.Maybe.Base.html#720" class="Generalizable">B</a> <a id="2664" class="Symbol"></a> <a id="2666" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="2672" href="Data.Maybe.Base.html#734" class="Generalizable">C</a>
<a id="2674" href="Data.Maybe.Base.html#2616" class="Function">alignWith</a> <a id="2684" href="Data.Maybe.Base.html#2684" class="Bound">f</a> <a id="2686" class="Symbol">(</a><a id="2687" href="Agda.Builtin.Maybe.html#174" class="InductiveConstructor">just</a> <a id="2692" href="Data.Maybe.Base.html#2692" class="Bound">a</a><a id="2693" class="Symbol">)</a> <a id="2695" class="Symbol">(</a><a id="2696" href="Agda.Builtin.Maybe.html#174" class="InductiveConstructor">just</a> <a id="2701" href="Data.Maybe.Base.html#2701" class="Bound">b</a><a id="2702" class="Symbol">)</a> <a id="2704" class="Symbol">=</a> <a id="2706" href="Agda.Builtin.Maybe.html#174" class="InductiveConstructor">just</a> <a id="2711" class="Symbol">(</a><a id="2712" href="Data.Maybe.Base.html#2684" class="Bound">f</a> <a id="2714" class="Symbol">(</a><a id="2715" href="Data.These.Base.html#642" class="InductiveConstructor">these</a> <a id="2721" href="Data.Maybe.Base.html#2692" class="Bound">a</a> <a id="2723" href="Data.Maybe.Base.html#2701" class="Bound">b</a><a id="2724" class="Symbol">))</a>
<a id="2727" href="Data.Maybe.Base.html#2616" class="Function">alignWith</a> <a id="2737" href="Data.Maybe.Base.html#2737" class="Bound">f</a> <a id="2739" class="Symbol">(</a><a id="2740" href="Agda.Builtin.Maybe.html#174" class="InductiveConstructor">just</a> <a id="2745" href="Data.Maybe.Base.html#2745" class="Bound">a</a><a id="2746" class="Symbol">)</a> <a id="2748" href="Agda.Builtin.Maybe.html#195" class="InductiveConstructor">nothing</a> <a id="2757" class="Symbol">=</a> <a id="2759" href="Agda.Builtin.Maybe.html#174" class="InductiveConstructor">just</a> <a id="2764" class="Symbol">(</a><a id="2765" href="Data.Maybe.Base.html#2737" class="Bound">f</a> <a id="2767" class="Symbol">(</a><a id="2768" href="Data.These.Base.html#586" class="InductiveConstructor">this</a> <a id="2773" href="Data.Maybe.Base.html#2745" class="Bound">a</a><a id="2774" class="Symbol">))</a>
<a id="2777" href="Data.Maybe.Base.html#2616" class="Function">alignWith</a> <a id="2787" href="Data.Maybe.Base.html#2787" class="Bound">f</a> <a id="2789" href="Agda.Builtin.Maybe.html#195" class="InductiveConstructor">nothing</a> <a id="2798" class="Symbol">(</a><a id="2799" href="Agda.Builtin.Maybe.html#174" class="InductiveConstructor">just</a> <a id="2804" href="Data.Maybe.Base.html#2804" class="Bound">b</a><a id="2805" class="Symbol">)</a> <a id="2807" class="Symbol">=</a> <a id="2809" href="Agda.Builtin.Maybe.html#174" class="InductiveConstructor">just</a> <a id="2814" class="Symbol">(</a><a id="2815" href="Data.Maybe.Base.html#2787" class="Bound">f</a> <a id="2817" class="Symbol">(</a><a id="2818" href="Data.These.Base.html#614" class="InductiveConstructor">that</a> <a id="2823" href="Data.Maybe.Base.html#2804" class="Bound">b</a><a id="2824" class="Symbol">))</a>
<a id="2827" href="Data.Maybe.Base.html#2616" class="Function">alignWith</a> <a id="2837" href="Data.Maybe.Base.html#2837" class="Bound">f</a> <a id="2839" href="Agda.Builtin.Maybe.html#195" class="InductiveConstructor">nothing</a> <a id="2848" href="Agda.Builtin.Maybe.html#195" class="InductiveConstructor">nothing</a> <a id="2857" class="Symbol">=</a> <a id="2859" href="Agda.Builtin.Maybe.html#195" class="InductiveConstructor">nothing</a>
<a id="zipWith"></a><a id="2868" href="Data.Maybe.Base.html#2868" class="Function">zipWith</a> <a id="2876" class="Symbol">:</a> <a id="2878" class="Symbol">(</a><a id="2879" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="2881" class="Symbol"></a> <a id="2883" href="Data.Maybe.Base.html#720" class="Generalizable">B</a> <a id="2885" class="Symbol"></a> <a id="2887" href="Data.Maybe.Base.html#734" class="Generalizable">C</a><a id="2888" class="Symbol">)</a> <a id="2890" class="Symbol"></a> <a id="2892" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="2898" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="2900" class="Symbol"></a> <a id="2902" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="2908" href="Data.Maybe.Base.html#720" class="Generalizable">B</a> <a id="2910" class="Symbol"></a> <a id="2912" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="2918" href="Data.Maybe.Base.html#734" class="Generalizable">C</a>
<a id="2920" href="Data.Maybe.Base.html#2868" class="Function">zipWith</a> <a id="2928" href="Data.Maybe.Base.html#2928" class="Bound">f</a> <a id="2930" class="Symbol">(</a><a id="2931" href="Agda.Builtin.Maybe.html#174" class="InductiveConstructor">just</a> <a id="2936" href="Data.Maybe.Base.html#2936" class="Bound">a</a><a id="2937" class="Symbol">)</a> <a id="2939" class="Symbol">(</a><a id="2940" href="Agda.Builtin.Maybe.html#174" class="InductiveConstructor">just</a> <a id="2945" href="Data.Maybe.Base.html#2945" class="Bound">b</a><a id="2946" class="Symbol">)</a> <a id="2948" class="Symbol">=</a> <a id="2950" href="Agda.Builtin.Maybe.html#174" class="InductiveConstructor">just</a> <a id="2955" class="Symbol">(</a><a id="2956" href="Data.Maybe.Base.html#2928" class="Bound">f</a> <a id="2958" href="Data.Maybe.Base.html#2936" class="Bound">a</a> <a id="2960" href="Data.Maybe.Base.html#2945" class="Bound">b</a><a id="2961" class="Symbol">)</a>
<a id="2963" href="Data.Maybe.Base.html#2868" class="CatchallClause Function">zipWith</a><a id="2970" class="CatchallClause"> </a><a id="2971" class="CatchallClause Symbol">_</a><a id="2972" class="CatchallClause"> </a><a id="2973" class="CatchallClause Symbol">_</a><a id="2974" class="CatchallClause"> </a><a id="2982" class="CatchallClause Symbol">_</a> <a id="2991" class="Symbol">=</a> <a id="2993" href="Agda.Builtin.Maybe.html#195" class="InductiveConstructor">nothing</a>
<a id="align"></a><a id="3002" href="Data.Maybe.Base.html#3002" class="Function">align</a> <a id="3008" class="Symbol">:</a> <a id="3010" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="3016" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="3018" class="Symbol"></a> <a id="3020" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="3026" href="Data.Maybe.Base.html#720" class="Generalizable">B</a> <a id="3028" class="Symbol"></a> <a id="3030" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="3036" class="Symbol">(</a><a id="3037" href="Data.These.Base.html#528" class="Datatype">These</a> <a id="3043" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="3045" href="Data.Maybe.Base.html#720" class="Generalizable">B</a><a id="3046" class="Symbol">)</a>
<a id="3048" href="Data.Maybe.Base.html#3002" class="Function">align</a> <a id="3054" class="Symbol">=</a> <a id="3056" href="Data.Maybe.Base.html#2616" class="Function">alignWith</a> <a id="3066" href="Function.Base.html#615" class="Function">id</a>
<a id="zip"></a><a id="3070" href="Data.Maybe.Base.html#3070" class="Function">zip</a> <a id="3074" class="Symbol">:</a> <a id="3076" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="3082" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="3084" class="Symbol"></a> <a id="3086" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="3092" href="Data.Maybe.Base.html#720" class="Generalizable">B</a> <a id="3094" class="Symbol"></a> <a id="3096" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="3102" class="Symbol">(</a><a id="3103" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="3105" href="Data.Product.html#1167" class="Function Operator">×</a> <a id="3107" href="Data.Maybe.Base.html#720" class="Generalizable">B</a><a id="3108" class="Symbol">)</a>
<a id="3110" href="Data.Maybe.Base.html#3070" class="Function">zip</a> <a id="3114" class="Symbol">=</a> <a id="3116" href="Data.Maybe.Base.html#2868" class="Function">zipWith</a> <a id="3124" href="Agda.Builtin.Sigma.html#236" class="InductiveConstructor Operator">_,_</a>
<a id="3129" class="Comment">------------------------------------------------------------------------</a>
<a id="3202" class="Comment">-- Injections.</a>
<a id="thisM"></a><a id="3218" href="Data.Maybe.Base.html#3218" class="Function">thisM</a> <a id="3224" class="Symbol">:</a> <a id="3226" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="3228" class="Symbol"></a> <a id="3230" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="3236" href="Data.Maybe.Base.html#720" class="Generalizable">B</a> <a id="3238" class="Symbol"></a> <a id="3240" href="Data.These.Base.html#528" class="Datatype">These</a> <a id="3246" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="3248" href="Data.Maybe.Base.html#720" class="Generalizable">B</a>
<a id="3250" href="Data.Maybe.Base.html#3218" class="Function">thisM</a> <a id="3256" href="Data.Maybe.Base.html#3256" class="Bound">a</a> <a id="3258" class="Symbol">=</a> <a id="3260" href="Data.Maybe.Base.html#1554" class="Function">maybe</a> <a id="3267" class="Symbol">(</a><a id="3268" href="Data.These.Base.html#642" class="InductiveConstructor">these</a> <a id="3274" href="Data.Maybe.Base.html#3256" class="Bound">a</a><a id="3275" class="Symbol">)</a> <a id="3277" class="Symbol">(</a><a id="3278" href="Data.These.Base.html#586" class="InductiveConstructor">this</a> <a id="3283" href="Data.Maybe.Base.html#3256" class="Bound">a</a><a id="3284" class="Symbol">)</a>
<a id="thatM"></a><a id="3287" href="Data.Maybe.Base.html#3287" class="Function">thatM</a> <a id="3293" class="Symbol">:</a> <a id="3295" href="Agda.Builtin.Maybe.html#136" class="Datatype">Maybe</a> <a id="3301" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="3303" class="Symbol"></a> <a id="3305" href="Data.Maybe.Base.html#720" class="Generalizable">B</a> <a id="3307" class="Symbol"></a> <a id="3309" href="Data.These.Base.html#528" class="Datatype">These</a> <a id="3315" href="Data.Maybe.Base.html#706" class="Generalizable">A</a> <a id="3317" href="Data.Maybe.Base.html#720" class="Generalizable">B</a>
<a id="3319" href="Data.Maybe.Base.html#3287" class="Function">thatM</a> <a id="3325" class="Symbol">=</a> <a id="3327" href="Data.Maybe.Base.html#1554" class="Function">maybe</a> <a id="3334" href="Data.These.Base.html#642" class="InductiveConstructor">these</a> <a id="3340" href="Data.These.Base.html#614" class="InductiveConstructor">that</a>
</pre></body></html>