From 092ebd1f798d324a36213bb8327c43ad9d7afbdf Mon Sep 17 00:00:00 2001 From: emmabastas Date: Fri, 9 Jul 2021 18:18:05 +0200 Subject: [PATCH] Fix compiler warnings --- elm-format-lib/src/Parse/ParsecAdapter.hs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/elm-format-lib/src/Parse/ParsecAdapter.hs b/elm-format-lib/src/Parse/ParsecAdapter.hs index 36426675b..ce39671d9 100644 --- a/elm-format-lib/src/Parse/ParsecAdapter.hs +++ b/elm-format-lib/src/Parse/ParsecAdapter.hs @@ -80,7 +80,7 @@ import Parse.Primitives (Row, Col) import qualified Parse.Primitives as EP import Parse.State (State(..)) -import qualified Control.Applicative as Applicative ( Applicative(..), Alternative(..) ) +import qualified Control.Applicative as Applicative import Control.Monad (MonadPlus(..), mzero, liftM) import qualified Control.Monad.Fail as Fail @@ -93,9 +93,8 @@ import qualified Data.Char as C import qualified Data.ByteString as B import qualified Data.ByteString.Internal as B -import Foreign.Ptr (Ptr, plusPtr) -import Foreign.Storable (peek) -import Foreign.ForeignPtr (ForeignPtr, touchForeignPtr) +import Foreign.Ptr (plusPtr) +import Foreign.ForeignPtr (touchForeignPtr) import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr) @@ -216,7 +215,7 @@ try (EP.Parser parser) = -- with a single `many_` call? many :: Parser a -> Parser [a] many (EP.Parser p) = - EP.Parser $ \s cok eok cerr eerr -> + EP.Parser $ \s cok eok cerr _ -> let many_ acc x s' = p @@ -236,7 +235,7 @@ many (EP.Parser p) = skipMany ::Parser a -> Parser () skipMany (EP.Parser p) = - EP.Parser $ \s cok eok cerr eerr -> + EP.Parser $ \s cok _ cerr _ -> let skipMany_ s' = p @@ -251,6 +250,7 @@ skipMany (EP.Parser p) = -- Note that causing a runtime crash when using `many` or `skipMany` with a -- parser that does not consume is the same behaviour as it was with parsec. +parserDoesNotConsumeErr :: a parserDoesNotConsumeErr = error "Text.Parsec.Prim.many: combinator 'many' is applied to a parser that accepts an empty string." @@ -336,7 +336,7 @@ getState = updateState :: (State -> State) -> Parser () updateState f = - do updateParserState + do _ <- updateParserState (\(EP.State src pos end indent row col sourceName newline) -> let (State newline') = f (State newline) @@ -453,7 +453,7 @@ setErrorMessage msg (ParseError sourceName row col msgs) mergeError :: ParseError -> ParseError -> ParseError -mergeError e1@(ParseError sn1 r1 c1 msgs1) e2@(ParseError sn2 r2 c2 msgs2) +mergeError e1@(ParseError sn1 r1 c1 msgs1) e2@(ParseError _ r2 c2 msgs2) -- prefer meaningful errors | null msgs2 && not (null msgs1) = e1 | null msgs1 && not (null msgs2) = e2 @@ -579,7 +579,6 @@ eof :: Parser () eof = notFollowedBy anyToken "end of input" - -- Text.Parsec.Char