[Haskell-beginners] can I use "pure" all the time instead of "return" now?
silent.leaf0 at gmail.com
Sun May 15 15:37:28 UTC 2016
It might not be the one intended, but I always saw "pure" as meaning
something like "input just wrapped" (echoing Maybe ofc), "input without
effects", i think is the terminology. In other terms, to me "pure", there,
is not an absolute description of the "type" of input (especially since the
name of a function traditionally mostly defines the output, not the input),
as in "non-monadic values are impure", but is a relative description
visavis the input, aka, "the output is the undiluted, uneffectful monadic
version of the input". Dunno if that was what you meant by "unadorned".
In other terms "pure" makes me see the function as a sort of identity that
does not dilute or otherwise modify the input value, solely "wraps" it
(more or less metaphorically), makes it monadic without modification. I
don't see it as meaning that its input values are of a purer "kind" than
the corresponding outputs because those latter are (more) monadic. And we
can feed monadic values to pure anyway.
As for echoing "purely functional language", well ... i don't really see
the link (but i might very well miss something), but at any rate isn't it
true in the first place (Haskell being pure, barring uses of
Le dimanche 15 mai 2016, Doug McIlroy <doug at cs.dartmouth.edu> a écrit :
>> the name [return] "stains" the functional semantics in Monadic code,
>> in my opinion
> Amusing. For me, the term "pure" stains monads as impure or diluted.
> The moral overtones of "pure", as in "purely functional language",
> drive out more benign interpretatations such as "unadorned". Not
> a felicitous coinage.
> Doug McIlroy
> Beginners mailing list
> Beginners at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners