<div dir="auto">I can't actually cheok right now,<div dir="auto">but </div><div dir="auto">```</div><div dir="auto">convert (Var mv) = do</div><div dir="auto">    v <- mv</div><div dir="auto">     return $ Var v</div><div dir="auto">```</div><div dir="auto"><br></div><div dir="auto">is the "do notation" which should work.</div><div dir="auto">(and similarly for the other expression)</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Nov 25, 2021, 19:13 mike h <<a href="mailto:mike_k_houghton@yahoo.co.uk" target="_blank" rel="noreferrer">mike_k_houghton@yahoo.co.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
This isn’t homework! I’ve been staring at this for several hours - and that usually works.<br>
I also tried typed holes to no avail.  I thinks it is  quite simple really but I’ve gone past seeing it!<br>
<br>
I have <br>
data Expr a = Var a | Add (Expr a) (Expr a) <br>
<br>
and would like to write<br>
<br>
convert :: Expr (Maybe a) -> Maybe (Expr a)<br>
<br>
which returns Nothing if there is an occurrence of Nothing inside the<br>
input expression e, otherwise it returns Just e', where e'<br>
is a new expression where the internal values of type a are not wrapped in Just.<br>
You should use the functionality of the Maybe monad to implement<br>
the convert function. <br>
<br>
<br>
Thanks <br>
Mike<br>
_______________________________________________<br>
Beginners mailing list<br>
<a rel="noreferrer noreferrer">Beginners@haskell.org</a><br>
<a rel="noreferrer noreferrer noreferrer">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div>