English 中文(简体)
如何通过GHCup+cabal管理X Monad(和xmobar,以及与它相关的任何东西)?
原标题:How to manage XMonad (and xmobar and anything else related to it) via GHCup+cabal?

而执行《公约》就足够了。

cabal install --package-env=$HOME/.config/xmonad --lib base xmonad xmonad-contrib

但我不理解的是:

  • why did this work?
  • Why updating GHC via GHCup "breaks" the modules?
  • When I write "breaks", given the original question below, should I say "hides"?
  • What is a hidden package?
  • Is executing cabal install --lib the-stuff-that-hls-claims-hidden wrong?
  • What is the correct way of updating with GHCup? (As apparently just running ghcup tui and doing i and s on new stuff and u on old stuff leaves things in a bad state.)

我认为,它们都到了某个点:我对全球升温潜能值和整个哈萨克尔生态系统的误解。


Orignal question

当我开始使用XMonad时,我有很强的运行时间,原因是我通过<代码>pacman<>/code>安装了像任何其他方案一样的编号,因为I m安装在Archi,但我还有ghc安装在我的家中,安装在ghcup上,并通过PATH。 最后,我在Arch64/1/a>论坛,并设法解决问题。

当时,我选择通过<代码>cabal安装(通过<代码>gcup填写)。 我之所以选择,是因为我喜欢。 GHCup和我发现ghcup tui是一种非常方便的方式,可采用最近建议的HLS版本,即最新版本的卡布拉语,即最新推荐和增强能力的新GHC版本。

我认为,我知道通过<代码>cabal安装的XMonad的含义是什么。

但是,显然我错了:我刚刚通过GHCup0.1.20.0更新至GHC9.4.8, Cabal 3.10.2.1,以及HLS 2.5.0.0.。

......而且现在我可以重复X Monad,这一错误与“我找不到一件事”的行文相同,因为你可以看到:

Errors detected while compiling xmonad config: /home/enlico/.config/xmonad/xmonad.hs
$ ghc --make xmonad.hs -i -ilib -fforce-recomp -main-is main -v0 -outputdir /home/enlico/.cache/xmonad/build-x86_64-linux -o /home/enlico/.cache/xmonad/xmonad-x86_64-linux

xmonad.hs:2:1: error:
    Could not find module ‘XMonad’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
2 | import XMonad
  | ^^^^^^^^^^^^^

xmonad.hs:3:1: error:
    Could not find module ‘XMonad.Hooks.DynamicLog’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
3 | import XMonad.Hooks.DynamicLog
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

xmonad.hs:4:1: error:
    Could not find module ‘XMonad.Hooks.EwmhDesktops’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
4 | import XMonad.Hooks.EwmhDesktops
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

xmonad.hs:5:1: error:
    Could not find module ‘XMonad.Hooks.StatusBar’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
5 | import XMonad.Hooks.StatusBar
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

xmonad.hs:6:1: error:
    Could not find module ‘XMonad.Hooks.StatusBar.PP’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
6 | import XMonad.Hooks.StatusBar.PP
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

xmonad.hs:7:1: error:
    Could not find module ‘XMonad.Layout.NoBorders’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
7 | import XMonad.Layout.NoBorders
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

xmonad.hs:8:1: error:
    Could not find module ‘XMonad.Layout.Spacing’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
8 | import XMonad.Layout.Spacing
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

xmonad.hs:9:1: error:
    Could not find module ‘XMonad.Util.EZConfig’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
9 | import XMonad.Util.EZConfig (additionalKeysP)
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

xmonad.hs:10:1: error:
    Could not find module ‘XMonad.Util.Loggers’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
10 | import XMonad.Util.Loggers
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^

xmonad.hs:11:1: error:
    Could not find module ‘XMonad.Util.Ungrab’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
11 | import XMonad.Util.Ungrab
   | ^^^^^^^^^^^^^^^^^^^^^^^^^

xmonad.hs:12:1: error:
    Could not find module ‘XMonad.StackSet’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
12 | import qualified XMonad.StackSet as W
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

试图确定事情的失败之处是:

cabal install --overwrite-policy=always --package-env=$HOME/.config/xmonad xmonad xmonad-contrib

以上错误是XMonad重新编造的,但我知道,为了将错误带往这里,我再进行再婚,因此,我不相信在我管理上述<条码>后X Monad权利重新编造时,错误是完全相同的。


顺便提一下的是,当我通过GHCup进行更新时,与一些单元相比,情况是错误的。

例如,现在,我就开启了用于 ha笑挑战或某种东西的星号卷宗一。

import Flow ((|>))

校正

但在重载HLS时,另一行显示有错误:

import qualified Data.Map.Strict as M

我现在宣读的错误是:

Could not load module ‘Data.Map.Strict’
It is a member of the hidden package ‘containers-0.6.7’.
You can run ‘:set -package containers’ to expose it.
(Note: this unloads all the modules in the current scope.)

和执行<条码> bal 装置—— 平衡集装箱 固定装置是正确的步骤?

最佳回答
  • why did this work?
  • Why updating GHC via GHCup "breaks" the modules?

GHC不仅通过图书馆版本,而且通过汇编版本,对图书馆进行版本的版本:每个独立汇编者都有自己的成套资料存放处,没有任何方式相互协调。 因此,即将发生的错误的简短说法是,当盖羊安装了新版本的GHC时,唯一的一揽子方案就是GHC,直到你做一些改变。

  • When I write "breaks", given the original question below, should I say "hides"?
  • What is a hidden package?

无,肯定不说“hides”,因为这是GHC一揽子计划数据库已经要求的技术术语。 在一揽子数据库中,包件可以是“已掌握的”或“隐藏的”;如果你直接使用GHC(即不通过卡巴-内斯特勒)或直接发射(即不是通过<代码>卡巴勒/格式>)的新东西,则你只能直接依靠暴露包件(尽管允许你过境依赖隐藏的包件)。

  • Is executing cabal install --lib the-stuff-that-hls-claims-hidden wrong?

既然你已经发现并正在使用一揽子环境,我认为这是错误的。 稍有改进的是,将你的Xmonad config 变成了自己的bal包——即:有<条码>,<> > /条码> ,其中列出包件依赖和版本限制等——和操作<条码> bal build;和 纸(卡瓦尔清单-宾xmonad)和带; 你们需要xmonad可执行;。 这种做法的一个显著优势是,你可以撰写一份项目文件,具体列出全球健康指数的具体版本;如果你安装了更新的全球健康标准,减少建设时间,加强稳定,那么今后将努力使用这一版本。 如果你想尝试的话,你可以使用<代码>cabal configure-w ghc-9.2(或类似)为你撰写项目文件。

  • What is the correct way of updating with GHCup? (As apparently just running ghcup tui and doing i and s on new stuff and u on old stuff leaves things in a bad state.)

第一次更新了GHC,然后更新了GHC的成套数据库cabal。 除非你处于磁盘空间,否则不需要安装旧式GHC,如果你撰写上文所讨论的项目文件,甚至可能不可取。

问题回答

引证意见:

Also, with "Is executing cabal install --lib the-stuff-that-hls-claims-hidden wrong?" I was not referring to xmonad only, but in general to any package.

Opinions may vary, and I m open to be corrected on this take, but I understand cabal install --lib as a way to approximate how things used to work in the old days of cabal-install v1 (that is, making things available in a shared environment). With that, however, the old cabal-install v1 problems tend to return (namely, running into version conflicts once you install or update enough stuff). Furthermore, as you have already noticed, cabal install --lib relies on sneaky per-directory state (the environment files) that can be easy to forget about.

相反,我的现行做法是提供自己的附属和<代码>.cabal文档,甚至快速试验。 这可能像许多仪式一样,但确实必须如此。 页: 1 纸面文件极低。 除了通过相互干预来保持你的基础外,通过制定你的法典项目,你还相信能够在稍后阶段成功建立这一体系。 在<代码>.cabal<>/code>档案中明确宣布依赖性,是朝此方向迈出的良好的第一步;视你对某些特定法典的可再生性的关注程度,你可以进一步,并增加各种额外信息。

I suspect the answer would still be "make you cabal config file". I tried cabal init in xmonad.hs s dir, but I m unsure how to proceed [...]

http://github.com/duplode/xmonad-duplode/blob/50dab2e13302942f13deeb6135b7206891b37b36/xmonad-duplode.cabal”rel=“nofollow noreferer”

cabal-version:       3.0
name:                xmonad-duplode
version:             0.1.0.0

executable xmonad
  main-is:             xmonad.hs
  build-depends:       base >= 4.13
                     , xmonad >= 0.16
                     , xmonad-contrib >= 0.16
                     , directory
                     , filepath

对于这种供个人使用的法典,这取决于你们是否对附属公司有约束性,以及它们如何紧凑。 例如,如果你开始使用一个只从某种版本获得的特征,那么你会发现它会在一定程度上增加下限。

(对于某些类型的个人使用代码也具有意义的一种不同做法是,不给任何版本的束缚,而是使用<条码>冻结<>/代码”生成冻结文件,其中含有所有物品的确切版本。) 然后,当你感到需要更新安全总局或任何附属公司时,删除冻结档案,并在你重新更新后再制作。

组合名称 为什么不“x子”? 问题 “Xmonad”的名称已经用在另一个关于Hackage的包裹中。 你们是否想选择不同的名称(y/n)? 我认为我做的是错的。

在上文引用的C.cabal文档中,包装名称为xmonad-duplode,可执行名称为xmonad。 你的项目将取决于<条码>xmonad的包件,这样避免冲突确实有意义。

但是,如果我打算永远更新最新的“再分配的+hls-powered”GHC版本(从根本上讲,因为我没有任何哈萨克尔项目会遭受过太多的磨擦;加上“再分配”的 does子会感到ble倒,因此我完全冒着风险)并保持 x合,......在《全球健康宪章》每次更新之后, updating子和花bal的建设将从根本上说与我迄今为止采用的方法相同。

如果你唯一的项目组合是最低限度的“密码>.cabal <>/ 编号”文件,如上所述,那么你将在《全球健康标准》设定的违约情况下建造X Monad。 虽然这很可能是你最方便的选择,但它有少数小的倒数——例如,如果在新的GHCup的品牌中对“m> Base <>>>>/em”做了某些改动,你必须先打上“xmonad.hs 的标签,然后才能重新编造。

compil缩汇编版本的一个容易的方法是,与<代码>.cabal文档一起,备有<代码>cabal.project文档,其中可参看:

packages: .

with-compiler: ghc-9.4.8

(在公开项目中,<代码>与-compiler的设定将更好地放在单独的cabalproject. local。 声称你不会对公共存放处做出承诺,但在此,它可能不会有任何问题。

有了<代码>cabal.project文档,你可以像往常一样管理你的GHCup版本,你的X Monad将保持使用特定的GHC版本,不管你做什么。 当你觉得自己想与你的XMonad config一道尝试不同的全球健康标准时,仅仅改动了<代码>和-compil领域。

<代码>cabal.project 如果你想尝试xmonadxmonad-contrib的ble首版本,那么文档也是有益的,因为它可以用于pull Dependencies from the development reposries,而不是Hackage


这里采用一种方式,在<代码>~/xmonad上设立XMonad项目。 我们一直在讨论的内容。 开始采用以下方式:xmonad.hs,.cabal file,如果你愿意,cabal.project file in ~/.xmonad。 然后,。 Daniel Wagner 建议,从.xmonad. 名录(替换~/. local/bin, 目的地是您在PATH:

cabal build && cp "$(cabal list-bin xmonad)" ~/.local/bin

以上将设置一个“boot”栏目。 可在<代码>~/. local/bin上执行(将用.oxitrc)。 对应的是第二个<代码>卡瓦尔安装。 在中,我倾向于这样做,因为为了目前的目的,没有必要或没有好处让全球咖啡店参与。

其次,在<条码>上创建(并可以执行)<条码>。 以下文字从

#!/bin/sh
cd "$HOME/.xmonad" && cabal build || exit
ln -sfT "$(cabal list-bin xmonad)" "$1"

有了这种安排,“boot锁”双筒(开端)和双筒(当你使用再补给指挥时)都将建立双双管的可执行和相互连接,由卡巴斯特制作,到X Monad(通过 1,)预期目的地。





相关问题
Euler Problem in Haskell -- Can Someone Spot My Error

I m trying my hand at Euler Problem 4 in Haskell. It asks for that largest palindrome formed by multiplying two three-digit numbers. The problem was simple enough, and I thought my Haskell-fu was up ...

How does foldr work?

Can anybody explain how does foldr work? Take these examples: Prelude> foldr (-) 54 [10, 11] 53 Prelude> foldr (x y -> (x+y)/2) 54 [12, 4, 10, 6] 12.0 I am confused about these executions....

Efficient queue in Haskell

How can I efficiently implement a list data structure where I can have 2 views to the head and end of the list, that always point to a head a tail of a list without expensive calls to reverse. i.e: ...

Problem detecting cyclic numbers in Haskell

I am doing problem 61 at project Euler and came up with the following code (to test the case they give): p3 n = n*(n+1) `div` 2 p4 n = n*n p5 n = n*(3*n -1) `div` 2 p6 n = n*(2*n -1) p7 n = n*(5*n -3)...

Ways to get the middle of a list in Haskell?

I ve just started learning about Functional Programming, using Haskel. I m slowly getting through Erik Meijer s lectures on Channel 9 (I ve watched the first 4 so far) and in the 4th video Erik ...

haskell grouping problem

group :: Ord a => [(a, [b])] -> [(a, [b])] I want to look up all pairs that have the same fst, and merge them, by appending all the list of bs together where they have the same a and discarding ...

Closest equivalent to subprocess.communicate in Haskell

I want to do a popen() / python s subprocess.communicate from Haskell - start a program, give it stdin, and get its stdout/stderr. What s the most direct / Haskellish way to do this?

热门标签