Solution (source code)

= Solution

\b[Yes.] Define the combining <function> as follows:
``
takeP :: (a -> Bool) -> [a] -> [a]
takeP p = foldr step []
  where
    step x rest = if p x then x : rest else []
``
For the fusion derivation use the identity reconstruction `foldr (:) []`, take $f=\operatorname{takeWhile}\ p$, and choose the displayed `step` as $h$. The <function> $f$ is strict in the input <list>, $f([])=[]$, and its cons equation is exactly $f(x:xs)=h\ x\ (f(xs))$. Fusion gives the implementation. On a false test, `step` does not demand the folded tail, so the implementation can terminate after a finite <list prefix> even when the remaining <list> is infinite or undefined. An undefined <predicate> result at a tested element makes both definitions undefined.