Skip to content

Build Error: Missing Imports for msum and liftM in StateFold.hs with GHC 9.6.7 #20

@Cesartwothousands

Description

@Cesartwothousands

Build Error: Missing Imports for msum and liftM in StateFold.hs with GHC 9.6.7

Description

When building feynopt with GHC 9.6.7, the build fails with compilation errors in src/Feynman/Optimization/StateFold.hs. The errors indicate that msum and liftM are not in scope, even though they are used in the code. This appears to be a compatibility issue with newer GHC versions where these functions are no longer automatically exported from Control.Monad.State.Strict.

Error Messages

src/Feynman/Optimization/StateFold.hs:200:26: error: [GHC-88464]
    Variable not in scope:
      msum
        :: [Maybe
              (Var, Var,
               Multilinear Var FF2 Feynman.Algebra.Polynomial.Multilinear.Mult)]
           -> Maybe (Var, Var, SBool Var)
    Suggested fix:
      Perhaps use one of these:
        'sum' (imported from Data.List),
        'U.sum' (imported from Feynman.Util.Unicode)
    |
200 | matchHH pp cand cutoff = msum . map go $ Set.toAscList cand where
    |                          ^^^^

src/Feynman/Optimization/StateFold.hs:211:22: error: [GHC-88464]
    Variable not in scope:
      msum :: [Maybe (Var, SBool Var)] -> Maybe (Var, SBool Var)
    |
211 | matchOmega pp cand = msum . map go $ Set.toAscList cand where
    |                      ^^^^

src/Feynman/Optimization/StateFold.hs:289:13: error: [GHC-88464]
    Variable not in scope:
      liftM
    |
289 |     v'   <- liftM ofVar $ allocTemp
    |             ^^^^^

src/Feynman/Optimization/StateFold.hs:456:19: error: [GHC-88464]
    Variable not in scope:
      liftM
    |
456 |   WSeq _ xs    -> liftM concat $ mapM (applyStmt d) xs
    |                   ^^^^^

Environment

  • GHC Version: 9.6.7 (installed via GHCup)
  • Cabal Version: 3.14.2.0 (installed via GHCup)
  • OS: Linux (Ubuntu 22.04, kernel 6.8.0-64-generic)
  • Architecture: x86_64

Workaround

Add an explicit import in src/Feynman/Optimization/StateFold.hs:

import Control.Monad (msum, liftM)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions