Introduction_to_Haskell_2ed_source
Introduction_to_Haskell_2ed_source copied to clipboard
这是Haskell函数式编程入门第2版的源码
在用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...
`C08/LogicCalculator.hs`代码中,第57行的函数体有一处错误,可以尝试以下的测试样例: ```haskell ex5 :: Formula (Int, ()) ex5 = Exist [1, 2, 3] $ \n -> Body (n :=: Con 3) solutions ex5 ``` 代码应修改为: ```haskell solutions (Exist (x:xs) as)...
代码: ```haskell type family (n :: Nat) * (m :: Nat) :: Nat where Z * m = Z S n * m = (n * m) + m ```...