Introduction_to_Haskell_2ed_source icon indicating copy to clipboard operation
Introduction_to_Haskell_2ed_source copied to clipboard

C12 StackCalc

Open YaoFANGUK opened this issue 6 years ago • 0 comments

在用GHC 8.6编译这个项目会报错

Calculator.hs:92:17: error: • No instance for (Fail.MonadFail Data.Functor.Identity.Identity) arising from a do statement with the failable pattern ‘Right top’

原因是 GHC 8.6 默认开启了MonadFailDesugaring extension,详见https://gitlab.haskell.org/ghc/ghc/wikis/migration/8.6#MonadFailDesugaringbydefault

用do语法糖来写的代码,现在都被desugar了

暂时的解决方案是:在用ghci load之前:set -XMonadFailDesugaring 或者在Main.hs 加上{-# LANGUAGE NoMonadFailDesugaring #-}

如果要 desugaring the pattern match应该怎么改代码?

YaoFANGUK avatar Dec 09 '19 01:12 YaoFANGUK