searchComp :: ([ByteString] -> (Match,[ByteString])) -> FileState [Match]
searchComp pred = do
  rest <- get
  case rest of
    [] -> return []
    lns -> do
      let (match, rst) = pred lns
      put rst
      otherMatches <- searchComp pred
      case match of
        [] -> return otherMatches
        _ ->  return (match: otherMatches)

--The most basic predicate that matches an applicative instance declaration and grabs the next two lines
searchComp :: ([ByteString] -> (Match,[ByteString])) -> FileState [Match]
searchComp pred = do
  rest <- get
  case rest of
    [] -> return []
    lns -> do
      let (match, rst) = pred lns
      put rst
      otherMatches <- searchComp pred
      case match of
        [] -> return otherMatches
        _ ->  return (match: otherMatches)

--The most basic predicate that matches an applicative instance declaration and grabs the next two lines
searchComp pred = do
  rest <- get
  case rest of
    [] -> return []
    lns -> do
      let (match, rst) = pred lns
      put rst
      otherMatches <- searchComp pred
      case match of
        [] -> return otherMatches
        _ ->  return (match: otherMatches)

--The most basic predicate that matches an applicative instance declaration and grabs the next two lines