首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Cabal无法安装日期和半组

Cabal无法安装日期和半组
EN

Stack Overflow用户
提问于 2018-06-02 23:52:37
回答 1查看 149关注 0票数 0

如果我执行$ cabal install semigroup,我会得到以下错误

代码语言:javascript
复制
Data/Semigroup.hs:29:22: error:
Ambiguous occurrence ‘Semigroup’
It could refer to either ‘Prelude.Semigroup’,
                         imported from ‘Prelude’ at Data/Semigroup.hs:2:8-21
                         (and originally defined in ‘GHC.Base’)
                      or ‘Data.Semigroup.Semigroup’,
                         defined at Data/Semigroup.hs:22:1
   |
29 | instance Monoid a => Semigroup (Identity a) where
   |                      ^^^^^^^^^

(在其他几个事件中重复自己)

类似地,如果我使用$ cabal install dates

代码语言:javascript
复制
Data/Dates/Types.hs:62:10: error:
• No instance for (Semigroup DateTime)
    arising from the superclasses of an instance declaration
• In the instance declaration for ‘Monoid DateTime’
   |
62 | instance Monoid DateTime where
   |          ^^^^^^^^^^^^^^^
cabal: Leaving directory '/tmp/cabal-tmp-16926/dates-0.2.2.1'
cabal: Error: some packages failed to install:
dates-0.2.2.1-ILbYRzHuQkwCfqySpiVks0 failed during the building phase. The
exception was:
ExitFailure 1

这是一个bug吗?如何解决这个问题?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-06-03 01:19:55

在GHC 8.4.x中,Semigroup类现在是基础的一部分:

代码语言:javascript
复制
class Semigroup a where
  (<>) :: a -> a -> a
  GHC.Base.sconcat :: GHC.Base.NonEmpty a -> a
  GHC.Base.stimes :: Integral b => b -> a -> a
  {-# MINIMAL (<>) #-}
        -- Defined in ‘GHC.Base’

但在旧版本的GHC中,它不是base的一部分,最初存在于semigroups包中。比semigroups更老的是semigroup,你正在尝试安装它,它与现在base的一部分有类似的冲突(感谢@Li-yao的评论)。因此,半组包不应该与较新的ghc/base一起使用。

您的第二个问题是dates的版本没有针对新的基础进行更新,这要求所有么半群实例也是Semigroup的实例:

代码语言:javascript
复制
class Semigroup a => Monoid a where
  mempty :: a
  mappend :: a -> a -> a
  mconcat :: [a] -> a
  {-# MINIMAL mempty #-}
        -- Defined in ‘GHC.Base’

您可以向dates包提交一个问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50658624

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档