<div dir="ltr">You are even closer now!<div><br></div><div>What the type checker is trying to tell you is that it doesn't know how to raise <font face="monospace, monospace">Maybe Integer</font> to some power.</div><div><br></div><div>You apply the ^ operator to two values, <span style="font-size:12.8px"><font face="monospace, monospace">f2Maybe (n `div` 2)</font> and <font face="monospace, monospace">2</font>. Let us give them names:</span></div><div><span style="font-size:12.8px"><br></span></div><div><font face="monospace, monospace"><span style="font-size:12.8px">let a = </span><span style="font-size:12.8px">f2Maybe (n `div` 2) :: Maybe Integer</span></font></div><div><span style="font-size:12.8px"><font face="monospace, monospace">    b = 2 :: Int</font></span></div><div><span style="font-size:12.8px"><font face="monospace, monospace">in a ^ b</font></span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">You see that the type of <font face="monospace, monospace">a</font><font face="arial, helvetica, sans-serif"> is </font><font face="monospace, monospace">Maybe Integer</font><font face="arial, helvetica, sans-serif">. What does this mean? There are only 2 cases to consider. You have </font><font face="monospace, monospace">Just </font><font face="arial, helvetica, sans-serif">an integer or you have </font><font face="monospace, monospace">Nothing</font><font face="arial, helvetica, sans-serif">.</font></span></div><div><span style="font-size:12.8px"><font face="arial, helvetica, sans-serif"><br></font></span></div><div><span style="font-size:12.8px"><font face="arial, helvetica, sans-serif">You can use the </font><font face="monospace, monospace">case </font><font face="arial, helvetica, sans-serif">construct to write the code for both cases.</font></span></div><div><span style="font-size:12.8px"><font face="arial, helvetica, sans-serif"><br></font></span></div><div><font face="monospace, monospace"><span class="im" style="font-size:12.8px">f2Maybe :: Integer -> Maybe Integer<br>f2Maybe n<br>   | n > 0  = Nothing<br>   | n == 0  = Just 1<br></span><span style="font-size:12.8px">   | even n = case f2Maybe (n `div` 2) of</span></font></div><div><font face="monospace, monospace"><span style="font-size:12.8px">                Just x -> <fill in></span></font></div><div><font face="monospace, monospace">                Nothing -> <fill in><br style="font-size:12.8px"><span style="font-size:12.8px">   | odd n  = case f2Maybe (n `div` 2) of</span></font></div><div><font face="monospace, monospace"><span style="font-size:12.8px">                Just x -> <fill in></span></font><span style="font-size:12.8px"><font face="arial, helvetica, sans-serif"><br></font></span></div><div><font face="monospace, monospace"><span style="font-size:12.8px">                Nothing -> <fill in></span></font></div><div><br></div></div>