0

I have a problem with Gtk2Hs, I want to set a cellRenderer activatable. For that, I need to set it's property cellMode to CellRendererModeActivatable by using :

set render [ cellMode:= CellRendererModeActivatable ]

But I have the following error when compiling

Not in scope: data constructor `CellRendererModeActivatable'

I'm using Gtk2Hs 0.12.3 on my Debian Wheezy with GHC 7.4.1.

I looked in Hackage if the constructor exist (in the correct version of the documentation) and ... it does.

I tried to explicity load the module

import Graphics.UI.Gtk.ModelView.CellRenderer

but the compilation error remain the same.

Do you have an idea where the error come from?

JeanJouX
  • 2,555
  • 1
  • 25
  • 37

1 Answers1

2

This looks as a bug in that old Haskell library: from its source code

module Graphics.UI.Gtk.ModelView.CellRenderer (
  -- snip
  CellRendererMode,

The above is not exporting the constructors. Newer versions do:

module Graphics.UI.Gtk.ModelView.CellRenderer (
  -- snip
  CellRendererMode(..),

You may try to update the Haskell library to a newer version. That should fix it.


Alternative. The type has an Enum instance even in the old version, so as a quick & dirty workaround you can use toEnum 1 :: CellRendererMode instead of the constructor.

data CellRendererMode = CellRendererModeInert         -- 0
                      | CellRendererModeActivatable   -- 1
                      | CellRendererModeEditable      -- 2
                      deriving (Enum,Eq)
chi
  • 111,837
  • 3
  • 133
  • 218