When I run
sudo pacman -S xmonad

I get this error:

warning: xmonad-0.10-3 is up to date -- reinstalling
resolving dependencies...
looking for inter-conflicts...

Targets (1): xmonad-0.10-3

Total Installed Size:   6.82 MiB
Net Upgrade Size:       0.00 MiB

Proceed with installation? [Y/n] 
(1/1) checking package integrity                                       [#######################################] 100%
(1/1) loading package files                                            [#######################################] 100%
(1/1) checking for file conflicts                                      [#######################################] 100%
(1/1) checking available disk space                                    [#######################################] 100%
ghc-pkg: cannot find package xmonad-0.10
error: command failed to execute correctly
(1/1) upgrading xmonad                                                 [#######################################] 100%
Reading package info from stdin ... done.
xmonad-0.10: Warning: haddock-interfaces: /usr/share/doc/xmonad-0.10/html/xmonad.haddock doesn't exist or isn't a file
xmonad-0.10: Warning: haddock-html: /usr/share/doc/xmonad-0.10/html doesn't exist or isn't a directory
xmonad-0.10: dependency "X11-1.5.0.1-23969a606024c8baf35a42f59a8da104" doesn't exist (use --force to override)
xmonad-0.10: dependency "mtl-2.0.1.0-db19dd8a7700e3d3adda8aa8fe5bf53d" doesn't exist (use --force to override)
xmonad-0.10: dependency "utf8-string-0.3.7-ca3bc669f78a10f8e42ef22439bcf83c" doesn't exist (use --force to override)
error: command failed to execute correctly

I get similar errors when I try to install haskell-http,mtl,network,parsec,random,text,transformers etc. These are all the packages that I installed previously, which worked fine and I somehow removed them. I don't know how I did that. They do not show up in ghc-pkg list. And that is the error that's being reported. From the above message I gather that these packages are not actually installed, pacman thinks they are and ghc thinks they are not. I should make pacman think they are not installed and reinstall them again.

Or it might be other way around. They are actually present (most probably indicated by the Net Upgrade Size: 0.00 MiB). Pacman could be right but those packages are not registered with ghc. Then I should find a way to register those packages with ghc. I think, the register.sh, unregister.sh in /usr/share/haskell folder allow me to do that. But before I realized this, I deleted the whole folder thinking it'd regenerate itself when I install them again. I know that was stupid.

I tried removing those packages using pacman -R haskell-http etc. They won't get removed. Same error.

I have one solution in mind, install cabal-install and install all those packages via cabal-install. Then, they'd get registered with ghc-pkg and removing them or reinstalling them via pacman would be possible. But I'm sure there's a better way. Can you tell me which one it is?

P.S: I think (I'm not sure) this situation got created when I ran pacman -S ghc after I installed all these pacakges. Could this be the problem or I'm talking nonsense?


--
Warm Regards,

AbdulSattar Mohammed