Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/Text/Parsec/Token.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MonoLocalBinds #-} -- MicroHs always has MonoLocalBinds, this helps GHC catch those problems
{-# LANGUAGE PolymorphicComponents #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE Safe #-}

-----------------------------------------------------------------------------
Expand Down Expand Up @@ -348,7 +350,7 @@ data GenTokenParser s u m
-- > reserved = P.reserved lexer
-- > ...

makeTokenParser :: (Stream s m Char)
makeTokenParser :: forall s m u . (Stream s m Char)
=> GenLanguageDef s u m -> GenTokenParser s u m
{-# INLINABLE makeTokenParser #-}
makeTokenParser languageDef
Expand Down Expand Up @@ -390,6 +392,8 @@ makeTokenParser languageDef
-----------------------------------------------------------
-- Bracketing
-----------------------------------------------------------
parens, braces, angles, brackets
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why these signatures are required, but not any others in the where block?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because MicroHs has MonoLocalBinds always on, and these need polymorphic types.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add {-# LANGUAGE MonoLocalBinds #-} to module header, and an explaining comment that we need it to allow GHC to catch problematic for MHS code.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added it

:: forall a. ParsecT s u m a -> ParsecT s u m a
parens p = between (symbol "(") (symbol ")") p
braces p = between (symbol "{") (symbol "}") p
angles p = between (symbol "<") (symbol ">") p
Expand All @@ -400,6 +404,8 @@ makeTokenParser languageDef
dot = symbol "."
colon = symbol ":"

commaSep, semiSep, commaSep1, semiSep1
:: forall a. ParsecT s u m a -> ParsecT s u m [a]
commaSep p = sepBy p comma
semiSep p = sepBy p semi

Expand Down Expand Up @@ -681,6 +687,7 @@ makeTokenParser languageDef
symbol name
= lexeme (string name)

lexeme :: forall a. ParsecT s u m a -> ParsecT s u m a
lexeme p
= do{ x <- p; whiteSpace; return x }

Expand Down