Skip to main content
The 2026 Annual Developer Survey is live— take the Survey today!
Source Link
ZhekaKozlov

import Data.Foldable (find)
import Data.Maybe (isJust)
import Control.Monad (join)

firstJust = join . find isJust

Usage:

> firstJust [Nothing, Just 1, Nothing, Just 2]
Just 1

> firstJust [Nothing, Nothing]
Nothing
lang-hs