Search for a value in tuple of lists/vectors I guess there is some smarter way to implement such simple piece of code, but I couldn't figure out other solution by myself. Could it be done recursively without some sort of if's?

import           Data.Vector (Vector)
import qualified Data.Vector

type SeqV = (Vector Integer, Vector Integer, Vector Integer)

seqv :: SeqV
seqv = (Data.Vector.fromList[1..5], Data.Vector.fromList[10..15], Data.Vector.fromList[20..25])

-- | searchs for n in SeqV from left to right
-- returns first found value
find :: Integer -&gt; SeqV -&gt; Maybe Integer
find n (a,b,c) =
  case f a of
       Just v -&gt; Just v
       Nothing -&gt; case f b of
         Just v  -&gt; Just v
         Nothing -&gt; f c

  where f v = let f = Data.Vector.filter (==n) v
                  in if Data.Vector.length f &gt; 0 then
                                               Just (Data.Vector.head f)
                                               else Nothing
find :: Integer -&gt; SeqV -&gt; Maybe Integer
find n (a,b,c) | elem n a || elem n b || elem n c = Just n
find _ _ = Nothing


There's also (&lt;|&gt;) :: Maybe a -&gt; Maybe a -&gt; Maybe a and asum :: [Maybe a] -&gt; Maybe a, but if you simplified your question and find above doesn't unsimplify, post the whole code and there might be an unreasonably short answer again. I also have the feeling wherever you use find could be simplified further since find only really returns a boolean.