I am using Data.Sequence
instead lists for better performance. With lists we can do the following
foo :: [Int] -> Int
foo [] m = m
foo (x:xs) m = ...
How can this be accomplished with Data.Sequence
. I have tried the following:
foo:: S.Seq Int -> Int
foo S.empty m = m
foo (x S.<: xs) m = ...
I think the solution involves using S.viewl
and S.viewr
, but cannot seem to figure out how.