Search code examples
haskellghcjs

Importing documentCreateElement function from Webkit


I am trying to import documentGetElementById function for use in Reflex FRP. I tried the import below but can't find the function (which according to hackage should be there):

GHCi, version 8.0.1: http://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Main             ( Test.hs, interpreted )
Ok, modules loaded: Main.
*Main> import Graphics.UI.Gtk.WebKit.DOM.Document
*Main Graphics.UI.Gtk.WebKit.DOM.Document> :t documentGetElementById
<interactive>:1:1: error:
   Variable not in scope: documentGetElementById

I will appreciate help with resolving this. I am running latest Reflex platform build with ghc 8.0.1 on mac where webkit works now. I see the same problem on Linux as well. So, it doesn't seem to be platform-specific.

I also did github code search on ghcjs-dom but documentGetElementById doesn't show up. So, perhaps it has been moved somewhere else?


Solution

  • documentGetElementById has been renamed to getElementById after ghcjs-dom refactoring. So, an import like below would work:

    *Main> import Graphics.UI.Gtk.WebKit.DOM.Document
    *Main Graphics.UI.Gtk.WebKit.DOM.Document> :t getElementById 
    getElementById
      :: (DocumentClass self, System.Glib.UTFString.GlibString string,
          MonadIO m) =>
         self -> string -> m (Maybe Graphics.UI.Gtk.WebKit.Types.Element)