decker-edu / decker

A markdown based tool for slide deck creation.
GNU General Public License v3.0
60 stars 15 forks source link

GHC2021 extensions not part of ghc9.2.5 on Windows 10 #27

Closed salbeira closed 11 months ago

salbeira commented 1 year ago

Without specifying all the language extensions in the package.yaml that we had before some versions of stack seem unable to recognise the language: GHC2021 option.

src\Text\Decker\Filter\Footnotes.hs:16:45: error:
    * Ambiguous type variable `a0' arising from a use of `walkM'
      prevents the constraint `(Walkable a0 Block)' from being solved.
      Probable fix: use a type annotation to specify what `a0' should be.
      These potential instances exist:
        instance Walkable Block Block -- Defined in `Text.Pandoc.Walk'
        instance Walkable Inline Block -- Defined in `Text.Pandoc.Walk'
        instance Walkable [Block] Block -- Defined in `Text.Pandoc.Walk'
        ...plus one other
        (use -fprint-potential-instances to see them all)
    * In the first argument of `runState', namely
        `(walkM scan (Div nullAttr blocks))'
      In the expression:
        runState (walkM scan (Div nullAttr blocks)) (0, [])
      In a pattern binding:
        (Div _ noted, (_, notes))
          = runState (walkM scan (Div nullAttr blocks)) (0, [])
   |
16 |   let (Div _ noted, (_, notes)) = runState (walkM scan (Div nullAttr blocks)) (0, [])
   |                                             ^^^^^

src\Text\Decker\Filter\Footnotes.hs:20:5: error:
    * Non type-variable argument
        in the constraint: MonadState (a, [[Block]]) m
      (Use FlexibleContexts to permit this)
    * When checking the inferred type
        scan :: forall {m :: * -> *} {a}.
                (MonadState (a, [[Block]]) m, Num a, Show a) =>
                Inline -> m Inline
      In an equation for `renderFootnotes':
          renderFootnotes blocks
            = let
                (Div _ noted, (_, notes))
                  = runState (walkM scan (Div nullAttr blocks)) ...
                footnotes = Div ... ...
              in if not (null notes) then noted <> [footnotes] else noted
            where
                scan note@(Note blocks)
                  = do (n, notes) <- get
                       ....
                scan inline = return inline
   |
20 |     scan note@(Note blocks) = do
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...

--  While building package decker-0.13.0 (scroll up to its section to see the error) using:
      C:\Users\Hauer\Git\github\decker\.stack-work\dist\8a54c84f\setup\setup --builddir=.stack-work\dist\8a54c84f build lib:decker exe:decker --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1
C:\Users\Hauer\Git\github\decker\package.yaml: Ignoring unrecognized field $.language

After recent updates to develop I am unable to build it using .\bin\build.ps1 -local

There are several more errors, all reporting certain options to be missing. Returning all the language extensions from before the ghc language version update fixes all errors.

salbeira commented 1 year ago

Solved by upgrading stack version to 2.9.3. Seems the 2.7.X version I had before did not recognize the language: GHC2021 tag.

We should add to the dependencies the smallest stack version that supports that compilation hint (as it was clearly not connected to the ghc version stack itself downloaded).

monofon commented 1 year ago

Yes, add this to the docs and close the issue.

kno10 commented 11 months ago

Debian and Ubuntu currently only include haskell-stack 2.7.5.

salbeira commented 11 months ago

I put in a hint about upgrading your haskell-stack version with stack upgarde after installing from your package manager in the readme.