Consider what happens when you try to expand some [1]
:
some [3443] == some_v
== liftA2 (:) [3443] many_v -- definition of some_v
== [x:y | x <- [3443], y <- many_v] -- definition of liftA2
== [x:y | x <- [3443], y <- some_v ++ pure []] -- definition of many_v
Here's I've immediately replaced <|>
with (++)
. Because (++)
is strict in its first argument, you have to evaluate some_v
before proceeding, but that gets us into an infinite loop.
Alternative
is described as a monoid for applicative functors. If I understand correctly, some xs
would be the infinite list of non-empty lists you could create by taking one element from xs
at a time.
some [3443] == [[3443], [3443, 3443], [3443, 3443, 3443], ...]
and many xs
would be the infinite list of (possibly empty) lists (essentially, just []:some xs
.) Because of the strictness of (++)
, though, the result is not computed lazily, so you never actually terminate.