4

I am working my way through the book real world haskell, this far I always found a way to adapt the code snippets to make them run but this time I am stuck.

I have to install the gtk and glade bindings in order to run the GUI example in chapter 23.

This is what I have done:

~/prog/Haskell/realWorldHaskell/chapter23 $ cabal sanbox init
~/prog/Haskell/realWorldHaskell/chapter23 $ cabal install gtk2hs-buildtools
~/prog/Haskell/realWorldHaskell/chapter23 $ cabal install gtk

which worked, but when I did:

~/prog/Haskell/realWorldHaskell/chapter23 $ cabal install glade

I get:

Resolving dependencies...
Notice: installing into a sandbox located at
/home/fayong/prog/Haskell/realWorldHaskell/chapter23/.cabal-sandbox
Configuring utf8-string-0.3.8...
Building utf8-string-0.3.8...
Installed utf8-string-0.3.8
Configuring cairo-0.12.5.3...
Configuring glib-0.12.5.4...
Failed to install cairo-0.12.5.3
Build log ( /home/fayong/prog/Haskell/realWorldHaskell/chapter23/.cabal-sandbox/logs/cairo-0.12.5.3.log ):
[1 of 2] Compiling SetupWrapper     ( /tmp/cairo-0.12.5.3-13890/cairo-0.12.5.3/SetupWrapper.hs, /tmp/cairo-0.12.5.3-13890/cairo-0.12.5.3/dist/dist-sandbox-96c39190/setup/SetupWrapper.o )
[2 of 2] Compiling Main             ( /tmp/cairo-0.12.5.3-13890/cairo-0.12.5.3/dist/dist-sandbox-96c39190/setup/setup.hs, /tmp/cairo-0.12.5.3-13890/cairo-0.12.5.3/dist/dist-sandbox-96c39190/setup/Main.o )
Linking /tmp/cairo-0.12.5.3-13890/cairo-0.12.5.3/dist/dist-sandbox-96c39190/setup/setup ...
[1 of 2] Compiling Gtk2HsSetup      ( Gtk2HsSetup.hs, dist/setup-wrapper/Gtk2HsSetup.o )

Gtk2HsSetup.hs:169:28:
    Couldn't match expected type `IO
                                    (Distribution.InstalledPackageInfo.InstalledPackageInfo_
                                       ModuleName)'
                with actual type `FilePath
                                  -> PackageDB
                                  -> IO Distribution.InstalledPackageInfo.InstalledPackageInfo'
    In the return type of a call of `generateRegistrationInfo'
    Probable cause: `generateRegistrationInfo' is applied to too few arguments
    In a stmt of a 'do' block:
      installedPkgInfoRaw <- generateRegistrationInfo
                               verbosity pkg lib lbi clbi inplace distPref
    In the expression:
      do { installedPkgInfoRaw <- generateRegistrationInfo
                                    verbosity pkg lib lbi clbi inplace distPref;
           dllsInScope <- getSearchPath >>= (filterM doesDirectoryExist)
                          >>= getDlls;
           let libs = fixLibs dllsInScope (extraLibraries installedPkgInfoRaw)
               installedPkgInfo = ...;
           case () of {
             _ | modeGenerateRegFile -> die "Generate Reg File not supported"
               | modeGenerateRegScript -> die "Generate Reg Script not supported"
               | otherwise
               -> registerPackage
                    verbosity installedPkgInfo pkg lbi inplace packageDbs } }

Gtk2HsSetup.hs:170:63:
    Couldn't match type `[Char]' with `Bool'
    Expected type: Bool
      Actual type: FilePath
    In the 7th argument of `generateRegistrationInfo', namely
      `distPref'
    In a stmt of a 'do' block:
      installedPkgInfoRaw <- generateRegistrationInfo
                               verbosity pkg lib lbi clbi inplace distPref
    In the expression:
      do { installedPkgInfoRaw <- generateRegistrationInfo
                                    verbosity pkg lib lbi clbi inplace distPref;
           dllsInScope <- getSearchPath >>= (filterM doesDirectoryExist)
                          >>= getDlls;
           let libs = fixLibs dllsInScope (extraLibraries installedPkgInfoRaw)
               installedPkgInfo = ...;
           case () of {
             _ | modeGenerateRegFile -> die "Generate Reg File not supported"
               | modeGenerateRegScript -> die "Generate Reg Script not supported"
               | otherwise
               -> registerPackage
                    verbosity installedPkgInfo pkg lbi inplace packageDbs } }
Failed to install glib-0.12.5.4
Build log ( /home/fayong/prog/Haskell/realWorldHaskell/chapter23/.cabal-sandbox/logs/glib-0.12.5.4.log ):
[1 of 2] Compiling SetupWrapper     ( /tmp/glib-0.12.5.4-13890/glib-0.12.5.4/SetupWrapper.hs, /tmp/glib-0.12.5.4-13890/glib-0.12.5.4/dist/dist-sandbox-96c39190/setup/SetupWrapper.o )
[2 of 2] Compiling Main             ( /tmp/glib-0.12.5.4-13890/glib-0.12.5.4/dist/dist-sandbox-96c39190/setup/setup.hs, /tmp/glib-0.12.5.4-13890/glib-0.12.5.4/dist/dist-sandbox-96c39190/setup/Main.o )
Linking /tmp/glib-0.12.5.4-13890/glib-0.12.5.4/dist/dist-sandbox-96c39190/setup/setup ...
[1 of 2] Compiling Gtk2HsSetup      ( Gtk2HsSetup.hs, dist/setup-wrapper/Gtk2HsSetup.o )

Gtk2HsSetup.hs:161:28:
    Couldn't match expected type `IO
                                    (Distribution.InstalledPackageInfo.InstalledPackageInfo_
                                       ModuleName)'
                with actual type `FilePath
                                  -> PackageDB
                                  -> IO Distribution.InstalledPackageInfo.InstalledPackageInfo'
    In the return type of a call of `generateRegistrationInfo'
    Probable cause: `generateRegistrationInfo' is applied to too few arguments
    In a stmt of a 'do' block:
      installedPkgInfoRaw <- generateRegistrationInfo
                               verbosity pkg lib lbi clbi inplace distPref
    In the expression:
      do { installedPkgInfoRaw <- generateRegistrationInfo
                                    verbosity pkg lib lbi clbi inplace distPref;
           dllsInScope <- getSearchPath >>= (filterM doesDirectoryExist)
                          >>= getDlls;
           let libs = fixLibs dllsInScope (extraLibraries installedPkgInfoRaw)
               installedPkgInfo = ...;
           case () of {
             _ | modeGenerateRegFile -> die "Generate Reg File not supported"
               | modeGenerateRegScript -> die "Generate Reg Script not supported"
               | otherwise
               -> registerPackage
                    verbosity installedPkgInfo pkg lbi inplace packageDbs } }

Gtk2HsSetup.hs:162:63:
    Couldn't match type `[Char]' with `Bool'
    Expected type: Bool
      Actual type: FilePath
    In the 7th argument of `generateRegistrationInfo', namely
      `distPref'
    In a stmt of a 'do' block:
      installedPkgInfoRaw <- generateRegistrationInfo
                               verbosity pkg lib lbi clbi inplace distPref
    In the expression:
      do { installedPkgInfoRaw <- generateRegistrationInfo
                                    verbosity pkg lib lbi clbi inplace distPref;
           dllsInScope <- getSearchPath >>= (filterM doesDirectoryExist)
                          >>= getDlls;
           let libs = fixLibs dllsInScope (extraLibraries installedPkgInfoRaw)
               installedPkgInfo = ...;
           case () of {
             _ | modeGenerateRegFile -> die "Generate Reg File not supported"
               | modeGenerateRegScript -> die "Generate Reg Script not supported"
               | otherwise
               -> registerPackage
                    verbosity installedPkgInfo pkg lbi inplace packageDbs } }
cabal: Error: some packages failed to install:
cairo-0.12.5.3 failed during the configure step. The exception was:
ExitFailure 1
gio-0.12.5.3 depends on glib-0.12.5.4 which failed to install.
glade-0.12.5.0 depends on glib-0.12.5.4 which failed to install.
glib-0.12.5.4 failed during the configure step. The exception was:
ExitFailure 1
gtk-0.12.5.7 depends on glib-0.12.5.4 which failed to install.
pango-0.12.5.3 depends on glib-0.12.5.4 which failed to install.

I am doing anything wrong? I am quite new to haskell and cabal (and to programing in general)

I am using ghc 7.6.3 and cabal 1.22.3.0

Display Name is missing
  • 6,197
  • 3
  • 34
  • 46
fayong lin
  • 214
  • 2
  • 15
  • Did you manage to fix this? – Michael Chav Aug 09 '15 at 01:43
  • No I am still stuck. It's a shame because Real World Haskell is a great book. – fayong lin Aug 09 '15 at 15:53
  • Do you really need Glade? Can't you use `Graphics.UI.Gtk.Builder` instead? Glade is deprecated in the 0.13 line AFAIK. – Cactus Aug 12 '15 at 23:56
  • No I don't, but it's just I have little experience with GUI libraries and I was looking forward to use the glade chapter in RWH to learn one, since I made it to this point in the book. Is there any good resources to learn how to use `Graphics.UI.Gtk.Builder`? – fayong lin Aug 13 '15 at 09:39

0 Answers0