New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reflex-Dom-0.4 on Hackage #140

Open
mango314 opened this Issue Mar 22, 2017 · 19 comments

Comments

Projects
None yet
5 participants
@mango314
Contributor

mango314 commented Mar 22, 2017

Have you considered posting the latest Reflex Dom on Hackage? I noticed Hackage has only version 0.3
https://hackage.haskell.org/package/reflex-dom-0.3/candidate/docs/Reflex-Dom-Widget-Basic.html

Couldn't find the type and source of element

svg :: MonadWidget t m => m ()
svg =  do
  element "svg" (def & namespace .~ Just "http://www.w3.org/2000/svg") blank
  return ()
@3noch

This comment has been minimized.

Member

3noch commented Mar 22, 2017

Totally unrelated: @MonsieurCactus you appear to have gotten off to a good start!

@3noch

This comment has been minimized.

Member

3noch commented Mar 22, 2017

@MonsieurCactus What are you using to get your dependencies, such as reflex-dom? Nix, Stack, and Cabal are all able to build Haddock docs for you so you don't need to rely on Hackage.

@mango314

This comment has been minimized.

Contributor

mango314 commented Mar 22, 2017

@3noch All I did was clone github. I do not know how to use haddock

@3noch

This comment has been minimized.

Member

3noch commented Mar 22, 2017

@MonsieurCactus Provided you're on Linux or macOS, I'd recommend starting with https://github.com/reflex-frp/reflex-platform to build things with reflex-dom.

Once you're in a reflex shell (./try-reflex) you can run ghc-pkg field reflex-dom haddock-html to get the path to the docs for reflex-dom.

@qrilka

This comment has been minimized.

Contributor

qrilka commented Mar 22, 2017

Partial duplicate of #139 ?

@mango314

This comment has been minimized.

Contributor

mango314 commented Mar 22, 2017

@qrilka does #139 discuss Hackage?

@3noch I was able to find out using :info [1]

Prelude Reflex.Dom> :info element
class (Monad m, Reflex t, DomSpace (DomBuilderSpace m),
       MonadAdjust t m) =>
      DomBuilder t (m :: * -> *) | m -> t where
  ...
  ...
  element :: Data.Text.Internal.Text
             -> ElementConfig er t m
             -> m a
             -> m (Element er (DomBuilderSpace m) t, a)
  default element :: (Control.Monad.Trans.Control.MonadTransControl
                        f,
                      Control.Monad.Trans.Control.StT f a ~ a, m ~ f m',
                      DomBuilderSpace m' ~ DomBuilderSpace m, DomBuilder t m') =>
                     Data.Text.Internal.Text
                     -> ElementConfig er t m
                     -> m a
                     -> m (Element er (DomBuilderSpace m) t, a)
  ...
  	-- Defined in ‘Reflex.Dom.Builder.Class’
@qrilka

This comment has been minimized.

Contributor

qrilka commented Mar 22, 2017

@MonsieurCactus it doesn't say about it explicitly but it's just the most recent one about new reflex/reflex-dom releases (which should land on Hackage)
Just a sidenote, sorry for taking your time

@mango314

This comment has been minimized.

Contributor

mango314 commented Mar 23, 2017

@3noch I managed to get help with Haddock, but I get an error message in reflex-dom


src/Reflex/Dom/Xhr.hs:154:0:
     error: missing binary operator before token "("
     #if MIN_VERSION_aeson(1,0,0)
     ^

I am putting all my documentation into a folder called docs but it has stopped on Xhr.hs and refuses to continue. How can I fix this?

@katychuang

This comment has been minimized.

Collaborator

katychuang commented Mar 23, 2017

Could it be something to do with Aeson versions? You can use ghc-pkg list | grep aeson to find the current version that you have installed.

@katychuang

This comment has been minimized.

Collaborator

katychuang commented Mar 23, 2017

As for the original question, here's a workaround to find out the types using :t and :i in ghci

[nix-shell:~/reflex-platform]$ ghc-pkg list | grep reflex
    reflex-0.5.0
    reflex-dom-0.4
    reflex-dom-core-0.4
    reflex-todomvc-0.1
[nix-shell:~/reflex-platform]$ ghci
GHCi, version 8.0.2: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /Users/kat/proj/reflex-platform/.ghci
Prelude> import Reflex.Dom
Prelude Reflex.Dom> :t element
element
  :: DomBuilder t m =>
     Data.Text.Internal.Text
     -> ElementConfig er t m
     -> m a
     -> m (Element er (DomBuilderSpace m) t, a)
Prelude Reflex.Dom> :i element
class (Monad m, Reflex t, DomSpace (DomBuilderSpace m),
       MonadAdjust t m) =>
      DomBuilder t (m :: * -> *) | m -> t where
  ...
  ...
  element :: Data.Text.Internal.Text
             -> ElementConfig er t m
             -> m a
             -> m (Element er (DomBuilderSpace m) t, a)
  default element :: (Control.Monad.Trans.Control.MonadTransControl
                        f,
                      Control.Monad.Trans.Control.StT f a ~ a, m ~ f m',
                      DomBuilderSpace m' ~ DomBuilderSpace m, DomBuilder t m') =>
                     Data.Text.Internal.Text
                     -> ElementConfig er t m
                     -> m a
                     -> m (Element er (DomBuilderSpace m) t, a)
  ...
  	-- Defined in ‘Reflex.Dom.Builder.Class’
Prelude Reflex.Dom>

@katychuang katychuang closed this Mar 23, 2017

@katychuang katychuang reopened this Mar 23, 2017

@katychuang

This comment has been minimized.

Collaborator

katychuang commented Mar 23, 2017

(oops, accidentally hit close issue 😓 )

@mango314

This comment has been minimized.

Contributor

mango314 commented Mar 23, 2017

@katychuang LOL

$ ghc-pkg list | grep aeson
aeson-0.11.3.0 

I don't know what is aeson. Here is the relevant section of Xhf.hs Does the if clause have some sort of typo?

import Data.Aeson
#if MIN_VERSION_aeson(1,0,0)
import Data.Aeson.Text
#else
import Data.Aeson.Encode
#endif
@katychuang

This comment has been minimized.

Collaborator

katychuang commented Mar 23, 2017

Hmm.. no idea what version you should have. I have aeson v0.11.2.1 in my reflex platform (branch jsaddle, commit 0cebace Feb 25th).

Aeson is a library for parsing and encoding JSON. Docs. I looked up the code in src/Reflex/Dom/Xhr.hs:154:0 and saw that it was importing aeson. Found this thread on SO, which made me wonder if the version was causing an issue.

@mango314

This comment has been minimized.

Contributor

mango314 commented Mar 24, 2017

@katychuang StackOverflow says it's the C preprocessor -cpp

find -name '*.hs' | xargs cabal haddock --optghc=-cpp --html -o docs

http://stackoverflow.com/questions/42987302/haddock-breaks-down-on-if-else-endif-clauses

his suggestion doesn't actually work. He also mentioned my GHC version; I have 7.10.3, but maybe I should have GHC 8.0.1

@3noch all of this to say, I have attempted to generate the documentation and have been unable

@3noch

This comment has been minimized.

Member

3noch commented Mar 24, 2017

@MonsieurCactus Unfortunately debugging on GitHub issues is really slow. Perhaps you can hop on IRC (#haskell or #reflex-frp) and ask. I have many questions but this isn't the best medium.

@mango314

This comment has been minimized.

Contributor

mango314 commented Mar 25, 2017

@3noch Ryan (who is here in the room with me) showed me a few things

  • while I only have ghc 7.10.1, try reflex already has ghc 8.0.1 in the virtual environment

  • current docs for reflex-dom 0.4 are already on my computer (in a rather obscure location). Located with ghc-pkg describe reflex-dom -- these were automatically generated with try-reflex -- and I created a symbolic link.

@mango314 mango314 closed this Mar 25, 2017

@3noch

This comment has been minimized.

Member

3noch commented Mar 25, 2017

Awesome. I presume you mean Ryan Trinkle? He would most certainly know. :)

@nomeata

This comment has been minimized.

Collaborator

nomeata commented Jun 25, 2018

Why was this closed? reflex-dom-0.4 has not yet been uploaded to Hackage…

This also need reflex-0.5 on hackage, I presume, which would be this issue: reflex-frp/reflex#177

(I know that few people use reflex dom with plain cabal, because ghcjs is hard to install manually … but for those who do it would be useful.)

@nomeata

This comment has been minimized.

Collaborator

nomeata commented Jul 19, 2018

Until this package is in Hackage, I created a hackage overlay with this package: http://hackage-ghcjs-overlay.nomeata.de/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment