{-# LANGUAGE ViewPatterns #-} import qualified Data.Set as S foo :: S.Set a -> a foo (S.elems -> [x]) = x