jtdaugherty / vty

A high-level ncurses alternative written in Haskell
BSD 3-Clause "New" or "Revised" License
319 stars 57 forks source link

build failure on GHC 9.4 due to removed instance MonadFail (ST s) #248

Closed frasertweedale closed 2 years ago

frasertweedale commented 2 years ago

base that will ship with GHC 9.4 has removed instance MonadFail (ST s). See https://downloads.haskell.org/ghc/9.4.1-alpha1/docs/html/libraries/base/Control-Monad-ST.html#t:ST.

vty currently uses this instance, causing compile failure:

src/Graphics/Vty/PictureToSpans.hs:86:22: error:
    • No instance for (MonadFail (ST s)) arising from a use of ‘fail’
    • In the expression: fail "empty picture"
      In a case alternative: [] -> fail "empty picture"
      In a stmt of a 'do' block:
        case layerOps of
          [] -> fail "empty picture"
          [ops] -> substituteSkips (picBackground pic) ops
          topOps : lowerOps
            -> do ops <- foldM mergeUnder topOps lowerOps
                  substituteSkips (picBackground pic) ops
   |
86 |             []    -> fail "empty picture"
   |                      ^^^^
src/Graphics/Vty/PictureToSpans.hs:116:23: error:
    • No instance for (MonadFail (ST s)) arising from a use of ‘fail’
    • In the first argument of ‘($)’, namely ‘fail’
      In the expression:
        fail $ "invalid background character " ++ show backgroundChar
      In a case alternative:
          w | w == 0
            -> fail $ "invalid background character " ++ show backgroundChar
            | w == 1 -> do forM_ [0 .. MVector.length ops - 1] $ \ row -> ...
            | otherwise
            -> do forM_ [0 .. MVector.length ops - 1] $ \ row -> ...
    |
116 |         w | w == 0 -> fail $ "invalid background character " ++ show backgroundChar
    |                       ^^^^
src/Graphics/Vty/PictureToSpans.hs:299:36: error:
    • No instance for (MonadFail (ST s)) arising from a use of ‘fail’
    • In the first argument of ‘($)’, namely ‘fail’
      In the second argument of ‘($)’, namely
        ‘fail $ name ++ " with remaining <= 0"’
      In a stmt of a 'do' block:
        when (state ^. remaining <= 0)
          $ fail $ name ++ " with remaining <= 0"
    |
299 |     when (state^.remaining <= 0) $ fail $ name ++ " with remaining <= 0"
    |                                    ^^^^
src/Graphics/Vty/PictureToSpans.hs:347:16: error:
    • No instance for (MonadFail (ST s)) arising from a use of ‘fail’
    • In the first argument of ‘($)’, namely ‘fail’
      In the second argument of ‘($)’, namely
        ‘fail $ "row " ++ show row ++ " now exceeds region width"’
      In a stmt of a 'do' block:
        when (spanOpsAffectedColumns ops' > regionWidth theRegion)
          $ fail $ "row " ++ show row ++ " now exceeds region width"
    |
347 |              $ fail $ "row " ++ show row ++ " now exceeds region width"
    |                ^^^^
jtdaugherty commented 2 years ago

Thank you!

frasertweedale commented 1 year ago

@jtdaugherty would you be able to cut a new release soon, now that GHC 9.4 was released?

jtdaugherty commented 1 year ago

This is now released in 5.37.

frasertweedale commented 1 year ago

Thank you!

Bodigrim commented 1 year ago

As a Hackage trustee I revised https://hackage.haskell.org/package/vty-5.36/revisions/ and earlier to make unbuildable configurations explicitly prohibited.

jtdaugherty commented 1 year ago

Thanks!