I have the following code to count the occurrence of an element in a Haskell list:
data Elem = Vanilla | Choco deriving (Eq,Show) maxStarSeq :: [Elem] ->
You can use group and maximum
group
maximum
import Data.List maxSeqLength :: Eq a => [a] -> Int maxSeqLength [] = 0 maxSeqLength xs = (maximum . map length . group) xs