Mark partial functions as such

Eric Mertens emertens at gmail.com
Fri Aug 31 02:19:00 UTC 2018


I think this comes down to just documenting things like how strict functions are and how they behave on various classes of inputs. These are good things to document. It doesn’t just have to be about a boolean flag “partial” paste on a bunch of definitions.

> On Aug 30, 2018, at 7:16 PM, Daniel Díaz Casanueva <dhelta.diaz at gmail.com> wrote:
> 
> Why not? I don't think mentioning that length doesn't work with infinite lists will do any harm.
> 
> I think many people make a distinction between partiality due to endless evaluation and partiality due to a call to "error". But I still think documenting either of both things can be helpful.
> 
> Best,
> Daniel
> 
> Am Fr., 31. Aug. 2018 um 04:09 Uhr schrieb David Feuer <david.feuer at gmail.com <mailto:david.feuer at gmail.com>>:
> Yes, I think so. What about functions like length? length (repeat ()) is bottom. repeat () is not bottom. Ergo, length is partial. But I don't think we want to say that!
> 
> On Thu, Aug 30, 2018, 10:05 PM Daniel Díaz Casanueva <dhelta.diaz at gmail.com <mailto:dhelta.diaz at gmail.com>> wrote:
> +1 from me too. The partiality of a function seems to me like something that should be documented.
> 
> Best,
> Daniel
> 
> Am Fr., 31. Aug. 2018 um 02:10 Uhr schrieb Richard Eisenberg <rae at cs.brynmawr.edu <mailto:rae at cs.brynmawr.edu>>:
> Proposal: Mark partial functions in `base` as partial
> 
> Motivation: I'm about to teach Haskell to a classful of beginners. In my experience, they will soon reach for functions like `head` and `tail`, because pattern-matching is foreign to them. I would love just to be able to say "Don't use partial functions", but many students will not easily be able to tell partial functions from total ones.
> 
> I do expect this problem to work itself out rather quickly, and then students will be able to identify partial functions, but loudly marking partial functions as partial seems like a small service to everyone and a bigger one to newbies. I don't see any downsides.
> 
> Thoughts?
> 
> Thanks,
> Richard
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org <mailto:Libraries at haskell.org>
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries <http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org <mailto:Libraries at haskell.org>
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries <http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20180830/db0a2129/attachment.html>


More information about the Libraries mailing list