Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: Monad question (Kim-Ee Yeoh)
----------------------------------------------------------------------
Message: 1
Date: Fri, 26 Nov 2021 01:55:42 +0700
From: Kim-Ee Yeoh <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Monad question
Message-ID:
<CAPY+ZdTLQ=9ERFAx=97qcsx5yjrujizow8fqqc-thvrx7md...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Hi Mike,
On Fri, Nov 26, 2021 at 12:12 AM mike h <[email protected]> wrote:
>
> I have
> data Expr a = Var a | Add (Expr a) (Expr a)
>
> and would like to write
>
> convert :: Expr (Maybe a) -> Maybe (Expr a)
With the requisite setup, convert has a one word definition. But more on
that later.
Yehoshua has already given you a nudge in the right direction. Others will
surely chime in if you get stuck grinding out something the compiler will
type check.
What we could discuss is higher level. Where would use this convert
function? What utility could you obtain from it?
>
> which returns Nothing if there is an occurrence of Nothing inside the
> input expression e, otherwise it returns Just e', where e'
> is a new expression where the internal values of type a are not wrapped in
> Just.
> You should use the functionality of the Maybe monad to implement
> the convert function.
>
>
> Thanks
> Mike
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
--
-- Kim-Ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20211126/d812f699/attachment-0001.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 160, Issue 2
*****************************************