[Haskell-cafe] Splitting off many/some from Alternative
wren ng thornton
wren at freegeek.org
Tue Dec 20 00:11:48 CET 2011
On 12/14/11 9:52 PM, Brandon Allbery wrote:
> That's kinda where I am right now; I'm being told simultaneously that (a)
> it makes sense to have Applicative and Alternative for Maybe, and (b) it
> doesn't make sense to have many and some for Maybe, and (c) if you have
> Applicative and Alternative then many and some automatically follow.
> These statements are not mutually logically consistent, and leave me
> wondering if Applicative and/or Alternative have been fully thought out.
I think we can all safely agree that the Applicative instance for Maybe
is both sound and sensible. Afterall, it captures exactly the same idea
as the monad instance: (explicitly) partial functions.
The only difference is that the Applicative instance removes (in theory)
the ordering constraints imposed by Monad, and therefore allows a more
functional/applicative style of programming in lieu of the imperative
style a la do-notation. The loss of ordering restrictions is only in
theory because in order to propagate failures correctly we must use
call-by-value semantics--- or, rather, we must be explicit about when
we're not evaluating something (and so may safely discard its potential
for returning Nothing). So, we can get rid of all the ordering
differences between different call-by-value systems, but we're not
completely confluent.
--
Live well,
~wren
More information about the Haskell-Cafe
mailing list