[Haskell-beginners] mayBe stuck

Colin Paul Adams colin at colina.demon.co.uk
Fri Aug 6 04:40:05 EDT 2010


>>>>> "Brent" == Brent Yorgey <byorgey at seas.upenn.edu> writes:

    Brent> On Thu, Aug 05, 2010 at 06:20:06PM -0500, aditya siram wrote:
    >> Normally yes, but here we are guaranteed to get a 'Just ...'
    >> value because of the 'isNothing' guard.  -deech

    Brent> You are correct, but that's not the point.  Every time you
    Brent> use fromJust (or head, or unsafePerformIO...) you shift the
    Brent> burden of proving that it is safe from the compiler onto
    Brent> yourself.

But the compiler could indeed prove that it's safe, if the typing system
reflected the precondition. Since Haskell allows programming with
partial functions, you always have this burden at present.
-- 
Colin Adams
Preston Lancashire
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments


More information about the Beginners mailing list