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: Value from Monad (Alex Hammel)
----------------------------------------------------------------------
Message: 1
Date: Wed, 22 Apr 2015 13:37:39 -0700
From: Alex Hammel <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Value from Monad
Message-ID:
<ca+_xfeqvao+_spjxpq3cs0wjker_h4pvbf0xzgh2t+ba50p...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
> Even if you're sure it's not a Nothing, it might be better to use
>
> maybe (error "Impossible, because (...)") id
Which is the same thing as:
fromMaybe (error "Impossible, because (...)")
On Wed, Apr 22, 2015 at 1:23 PM, Marcin Mrotek <[email protected]>
wrote:
> Hello,
>
> Well, you CAN use fromJust, but bear in mind that you should only use
> it if you are absolutely, positively, 100% sure the Maybe value you
> are calling fromJust on is of the form (Just something), because your
> program will error out if you call fromJust on a Nothing. Even if
> you're sure it's not a Nothing, it might be better to use
>
> maybe (error "Impossible, because (...)") id
>
> instead, so that you at the very least get a meaningful error message
> in case "impossible" happens ;) Other than that, it's recomennded to
> either use the maybe function, or pattern matching:
>
> case foo of
> Just x -> ...
> Nothing -> ...
>
> instead.
>
> Best regards,
> Marcin Mrotek
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150422/41f6ab8a/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 82, Issue 31
*****************************************