jgm / cheapskate

Experimental markdown processor in Haskell
BSD 3-Clause "New" or "Revised" License
107 stars 18 forks source link

Compatibility with mtl-2.3 #37

Open sjakobi opened 2 years ago

sjakobi commented 2 years ago

With --allow-newer=mtl I'm seeing some errors:

Building library for cheapskate-0.1.1.2..
[1 of 8] Compiling Cheapskate.ParserCombinators ( Cheapskate/ParserCombinators.hs, dist/build/Cheapskate/ParserCombinators.o, dist/build/Cheapskate/ParserCombinators.dyn_o )

Cheapskate/ParserCombinators.hs:116:3: warning: [-Wnoncanonical-monad-instances]
    Noncanonical ‘return’ definition detected
    in the instance declaration for ‘Monad Parser’.
    ‘return’ will eventually be removed in favour of ‘pure’
    Either remove definition for ‘return’ (recommended) or define as ‘return = pure’
    See also: https://gitlab.haskell.org/ghc/ghc/-/wikis/proposal/monad-of-no-return
    |
116 |   return x = Parser $ \st -> Right (st, x)
    |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2 of 8] Compiling Cheapskate.Types ( Cheapskate/Types.hs, dist/build/Cheapskate/Types.o, dist/build/Cheapskate/Types.dyn_o )
[3 of 8] Compiling Cheapskate.Html  ( Cheapskate/Html.hs, dist/build/Cheapskate/Html.o, dist/build/Cheapskate/Html.dyn_o )

Cheapskate/Html.hs:10:1: warning: [-Wunused-imports]
    The import of ‘Data.Monoid’ is redundant
      except perhaps to import instances from ‘Data.Monoid’
    To import instances alone, use: import Data.Monoid()
   |
10 | import Data.Monoid
   | ^^^^^^^^^^^^^^^^^^
[4 of 8] Compiling Cheapskate.Util  ( Cheapskate/Util.hs, dist/build/Cheapskate/Util.o, dist/build/Cheapskate/Util.dyn_o )
[5 of 8] Compiling Cheapskate.Inlines ( Cheapskate/Inlines.hs, dist/build/Cheapskate/Inlines.o, dist/build/Cheapskate/Inlines.dyn_o )

Cheapskate/Inlines.hs:16:1: warning: [-Wunused-imports]
    The import of ‘Data.Monoid’ is redundant
      except perhaps to import instances from ‘Data.Monoid’
    To import instances alone, use: import Data.Monoid()
   |
16 | import Data.Monoid
   | ^^^^^^^^^^^^^^^^^^
[6 of 8] Compiling Cheapskate.Parse ( Cheapskate/Parse.hs, dist/build/Cheapskate/Parse.o, dist/build/Cheapskate/Parse.dyn_o )

Cheapskate/Parse.hs:139:8: error:
    Variable not in scope: guard :: Bool -> Parser a7
    |
139 |   <|> (guard (not lastLineIsText) *> (IndentedCode <$ char ' ' <* nfb scanBlankline))
    |        ^^^^^

Cheapskate/Parse.hs:140:8: error:
    Variable not in scope: guard :: Bool -> Parser a6
    |
140 |   <|> (guard (not lastLineIsText) *> (RawHtmlBlock <$ parseHtmlBlockStart))
    |        ^^^^^

Cheapskate/Parse.hs:141:8: error:
    Variable not in scope: guard :: Bool -> Parser a5
    |
141 |   <|> (guard (not lastLineIsText) *> (Reference <$ scanReference))
    |        ^^^^^

Cheapskate/Parse.hs:412:12: error:
    • Variable not in scope:
        replicateM
          :: Int
             -> ContainerM ()
             -> RWST
                  () ReferenceMap ContainerStack Data.Functor.Identity.Identity a8
    • Perhaps you meant one of these:
        ‘Seq.replicateM’ (imported from Data.Sequence),
        ‘replicate’ (imported from Prelude),
        ‘Seq.replicate’ (imported from Data.Sequence)
      Perhaps you want to add ‘replicateM’ to the import list
      in the import of ‘Data.Sequence’ (Cheapskate/Parse.hs:17:1-61).
    |
412 |            replicateM numUnmatched closeContainer
    |            ^^^^^^^^^^

Cheapskate/Parse.hs:459:9: error:
    Variable not in scope: guard :: Bool -> Parser a4
    |
459 |    <|> (guard lastLineIsText *> (SetextHeader <$> parseSetextHeaderLine <*> pure mempty))
    |         ^^^^^

Cheapskate/Parse.hs:519:3: error:
    Variable not in scope: guard :: Bool -> Parser a3
    |
519 |   guard $ T.length cs >= 3
    |   ^^^^^

Cheapskate/Parse.hs:532:11: error:
    Variable not in scope: guard :: Bool -> Parser a2
    |
532 |           guard $ f $ fst t
    |           ^^^^^

Cheapskate/Parse.hs:564:3: error:
    Variable not in scope: guard :: Bool -> Parser a1
    |
564 |   guard $ padding' > 0
    |   ^^^^^

Cheapskate/Parse.hs:581:3: error:
    Variable not in scope: unless :: Bool -> Scanner -> Parser a0
    |
581 |   unless (c == '+')
    |   ^^^^^^

This is just FYI – I don't know whether there are any users for whom compatibility with mtl >= 2.3 would be important.