One thing you can always do is write a direct translation of the imperative code into Haskell:
import qualified Data.Vector as V
twoPointers :: Int -> [Int] -> Maybe [Int]
twoPointers x xs = go 0 0 0 where
arr = V.fromList xs
n = V.length arr
go s l r
| r == n = Nothing
| s' == x = Just (V.toList (V.slice l (r + 1 - l) arr))
| s' <= x = go s' l (r + 1)
| otherwise = go (s - arr V.! l) (l + 1) r
where
s' = s + arr V.! r
Edit: The following functional solution is not yet O(n), sorry.
For a more functional solution, I would derive it as follows. You already suggested scanl and takeWhile, I would combine it with tails to get a list of all the sums of each subsequence:
ghci> map (takeWhile (<= 5) . scanl (+) 0) (tails [1,2,3])
[[0,1,3],[0,2,5],[0,3],[0]]
(Note you can write it with the monadic bind instead: takeWHile (<= 5) . scanl (+) 0 =<< tails [1,2,3] which I think looks better)
With this we can easily solve the decision problem version where we just want to determine if there is a subsequence with a specific sum:
subseqSumDecision :: Int -> [Int] -> Bool
subseqSumDecision x xs = x `elem` concatMap (takeWhile (<= x) . scanl (+) 0) (tails xs)
To get the actual subsequence, I think the easiest way is to change the arguments of scanl to also build up the subsequences:
ghci> concatMap (takeWhile ((<= 5) . fst) . scanl (\(s, xs) x -> (s + x, x : xs)) (0, [])) (tails [1,2,3])
[(0,[]),(1,[1]),(3,[2,1]),(0,[]),(2,[2]),(5,[3,2]),(0,[]),(3,[3]),(0,[])]
Now we can simply use the lookup function to find the subsequence:
subseqSumReversed :: Int -> [Int] -> Maybe [Int]
subseqSumReversed x xs = lookup x
$ concatMap
(takeWhile ((<= x) . fst) . scanl (\(s, xs) x -> (s + x, x : xs))
(0, []))
$ tails xs
And you might notice that this returns the subsequence reversed, so you can simply reverse it again at the end:
subseqSum :: Int -> [Int] -> Maybe [Int]
subseqSum x xs = fmap reverse
$ lookup x
$ concatMap
(takeWhile ((<= x) . fst) . scanl (\(s, xs) x -> (s + x, x : xs))
(0, []))
$ tails xs