[Haskell-cafe] Alternative name for return

Alberto G. Corona agocorona at gmail.com
Wed Aug 7 11:18:01 CEST 2013


One of the surprising things of Haskell is how little effort is done in
order to confer meaning to the names. That happens also in the case of the
mathematical language. Often they have a single letter. The reason is that
their meaning is completely defined by their signature and their
properties. And this is possible because Haskell has a strong and
polymorphic type system. In other languages, either this is not possible or
the libraries have little polymorphism, so the names can be more concrete.


return :: (Monad m) => a -> m a

The meaning is in the signature. We can opt between keeping the name as a
short mnemonic of the signature or else we can adhere to the C tradition:

return === monad_m___a__m_a

or the Java Tradition

return
=MonadFactory.liftSomethingSometimesPureButInSomeCasesTheResultIsAlsoPure


2013/8/7 Richard A. O'Keefe <ok at cs.otago.ac.nz>

>
> On 7/08/2013, at 2:10 PM, damodar kulkarni wrote:
>
> > I bet you can find an abundance of C programmers who think that
> > "strcmp" is an intuitive name for string comparison (rather than
> compression, say).
> >
> > But at least, 'strcmp' is not a common English language term, to have
> acquired some unintentional 'intuition' by being familiar with it even in
> our daily life. The Haskell terms, say, 'return' and 'lift', on the other
> hand, do have usage in common English, so even a person with _no_
> programming background would have acquired some unintentional 'intuition'
> by being familiar with them.
>
> "Lift" is - a brand of soft drink, the thing Americans call an elevator,
> a thing put in your shoes seem taller, and a free ride, amongst other
> things.
> As a verb, it can mean to kick something.
>
> To find "lift" intuitive, you have to be familiar with the *mathematical*
> idiom of "lifting" a value from one space to another via some sort of
> injection.  Fair enough, but this *still* counts as an example of
> "intuitive = familiar", because this is *not* a sense of "lift" that is
> familiar to undergraduate and masters computing students unless they have
> taken rather more mathematics papers than most of them have.
>
> If you're familiar with *English* rather than, say, the C family of
> programming languages, "return" isn't _that_ bad, there is certainly
> nothing about the word that suggests providing a value.  I once tried
> to propose a C-style 'return' statement to some people who were
> designing a programming language, before I or they had ever heard of
> C, and they flatly rejected it.  Months later I found out that this
> was because they were looking for something that did not just resume
> the caller but also provided a value, and when I protested that that's
> exactly what 'return' did in the languages I proposed stealing from,
> they -- being familiar with Fortran -- said that it had never occurred
> to them that 'return' could have anything to with providing a value.
>
> "It is intuitive" has no other discernable meaning than "*I* am familiar
> with it,
> or something very much like it."
>
> _That's_ the point I want to make.  *Whatever* anyone uses for Haskell's
> "return", many people are bound to find it unintuitive.  Choose a name
> on any grounds but that.
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



-- 
Alberto.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130807/05094f23/attachment.htm>


More information about the Haskell-Cafe mailing list