[Haskell-cafe] Does this function have a name?

Paul Brauner polux2001 at gmail.com
Fri Apr 7 08:42:07 UTC 2017

Hello Haskell Cafe,

I had to write the following function and I was wondering if it (or its
generalization to Alternative or Traversable) was exposed by some library
under a different name:

first [] = Nothing
first (t:ts) = fmap (:ts) (s t) <|> fmap (t:) (first ts)

Somehow it is to "traverse" as "any" is to "all".

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170407/4af92388/attachment.html>

More information about the Haskell-Cafe mailing list