Git Product home page Git Product logo

reflex-dom-contrib's Introduction

reflex-dom-contrib's People

Contributors

adamconnersax avatar adrianparvino avatar ajchapman avatar alexfmpe avatar ariep avatar bergey avatar dalaing avatar eskimor avatar goolord avatar hamishmack avatar hansroland avatar imalsogreg avatar jappeace avatar luigy avatar marisakirisame avatar matthewbauer avatar mightybyte avatar montagy avatar mulderr avatar qrilka avatar roberth avatar schell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reflex-dom-contrib's Issues

Better type signature for routeSite

In the docs for Reflex.Dom.Contrib.Router, the routeSite function has a pretty scary type signature.

routeSite :: (String -> Widget Spider (Gui Spider (WithWebView SpiderHost) SpiderHostFrame) (Event Spider String)) -> IO ()

That overly specific type could be turned into an abstract one.

routeSite :: (forall t m. MonadWidget t m => String -> m (Event t String)) -> IO ()

New release to hackage?

The version on hackage is too old and does not build with newer GHC. It would be great if a new release is make and uploaded to hackage. Thanks.

Why only absolute URIs?

I was trying to port our app using previous version of reflex-dom-contrib which was using just Text for URIs and now in Reflex.Dom.Contrib.Router I see

type URI = U.URIRef U.Absolute

At the same time we use servant-router and Link from Servant.Utils.Links supports only relative links because Servant knows nothing about the current scheme/authority/host/port. And actually history.pushState can't use URLs outside of the current domain.
Shouldn't we switch to relative URis or I miss something here?

How to use this in my own package?

Sorry in advance for asking probably basic question, but I am new to nix and to reflex.

So I have a package created using the method suggested in reflex-platform, and I clone the directory, workon and built it.

Now, how do I use this? The closest I can find is some cryptic pkgs.fetchFromGitHub stuff.. Is that how we are supposed to use it?

Publish 0.4.2 on Hackage

I see that the github repo successfully compiles with webkit, but the 0.4.1 release on Hackage does not. This is a pretty big program for those who use stack, and don't want to depend on a git repo.

Using MonadRouted

How to use routeApp to add routing to my webpage.

testApp :: MonadWidget t m => m ()
testApp = do
  routeApp "app" $ do
    withPathSegment go
  pure ()
  where
    go ::  (MonadWidget t m, MonadRouted t m) => Dynamic t (Maybe PathSegment) -> m ()
    go dPathSeg = do
      (dyn . ffor dPathSeg) $ \ps -> do
        case maybe "a" id ps of
          "a" -> do
            evt <- button "switch to View B"
            redirectInternal $ ("b" <$ evt)
            text "View A"
          "b" -> do
            evt <- button "switch to View A"
            redirectInternal $ ("a" <$ evt)
            text "View B"
      pure ()

I get this error while running the code:

Could not deduce (NotReady t (RouteT t m))
        arising from a use of ‘go’
      from the context: MonadWidget t m
        bound by the type signature for:
                   testApp :: MonadWidget t m => m ()

request for function: alertEvents

this function will take a -> [String] instead of a -> String, and for ever String it create, it will popup a dialog sequentially (that is, after one is closed). I am planning to use it as some kind of user manual.

Using router

I couldn't figure out how to use route to create a simple SPA webapp. (I've just started out using reflex). Any help appreciated. :)
Lets say I have the following views:

viewA :: MonadWidget t m => m (Event t Text)
viewA = do
  el "div" $ text "view A"
  gotoB <- button "GoTo B"
  return $ fmap (const "B") gotoB

viewB :: MonadWidget t m => m (Event t Text)
viewB = do
  el "div" $ text "view B"
  gotoC <- button "GoTo C"
  return $ fmap (const "C") gotoC

viewC :: MonadWidget t m => m (Event t Text)
viewC = do
  el "div" $ text "view C"
  gotoA <- button "GoTo A"
  return $ fmap (const "A") gotoA

Say my page starts at viewA, how do I use route to switch between these views?

Get rid of default.nix

The current default.nix is out of date (as far as I can tell) and it's unlikely to stay up to-date over time. With nixpkgs.callCabal2nix and reflex-platform.cabal2nixResult, it's not difficult to generate the correct default.nix automatically as part of a larger nix derivation. This will always be more reliable. Should we just delete the file?

Any docs/examples for this package (e.g. router)?

I wanted to checkout Router but from the haddock page it's not quite clear how it's supposed to be used.
Are there any projects maybe which use reflex-dom-contrib which could be checked out to get the idea?

Does not build with the latest reflex-platform

Adding this because the reflex-platform is mentioned in the README as the preferred way to build.

To repro:

  1. clone the reflex platform (as of de5dee7)
  2. run ./try-reflex
  3. observe successful build
  4. add reflex-dom-contrib to the 'general packages' section of packages.nix
  5. run ./try-reflex

expected: successful build and reflex shell
actual: dependency failure

output:

Configuring reflex-dom-contrib-0.4.1...
Setup: Encountered missing dependencies:
aeson >=0.8 && <0.11,
base >=4.6 && <4.9,
bifunctors >=4.0 && <5.3,
data-default ==0.5.*,
ghcjs-dom ==0.2.*,
lens >=4.9 && <4.14,
reflex >=0.2 && <0.5,
reflex-dom >=0.2 && <0.4
builder for ‘/nix/store/5m2wdc60i8hr4wvyngn3nlx1h7i4jwlm-reflex-dom-contrib-0.4.1.drv’ failed with exit code 1
cannot build derivation ‘/nix/store/ndjmzi9jy6cr5yzbmnc639pdwbgbcqxw-ghc-8.0.2-with-packages.drv’: 1 dependencies couldn't be built
error: build of ‘/nix/store/ndjmzi9jy6cr5yzbmnc639pdwbgbcqxw-ghc-8.0.2-with-packages.drv’ failed
/run/current-system/sw/bin/nix-shell: failed to build all dependencies

Incorrect constraints in cabal file

It appears that the library doesn't work with reflex-dom-0.3 anymore:

    /home/qrilka/ws/some/project/.stack-work/downloaded/MaRcALGDSgMN/src/Reflex/Dom/Contrib/Widgets/Svg.hs:34:15: error:
        • Couldn't match type ‘Text’ with ‘[Char]’
          Expected type: Text
                         -> Dynamic t (Map Text Text) -> m a -> m (El t, a)
            Actual type: String
                         -> Dynamic t (Map String String) -> m a -> m (El t, a)
        • In the expression:
            elDynAttrNS' (Just "http://www.w3.org/2000/svg")
          In an equation for ‘svgDynAttr'’:
              svgDynAttr' = elDynAttrNS' (Just "http://www.w3.org/2000/svg")

and yet cabal file says:

    reflex-dom   >= 0.2  && < 0.5,

Semigroup / Monoid problems with GHC 8.4.3

I've run into this while building reflex-dom-contrib with GHC 8.4.3:

src/Reflex/Dom/Contrib/CssClass.hs:50:22: error:
    • No instance for (Semigroup CssClass)
        arising from the 'deriving' clause of a data type declaration
      Possible fix:
        use a standalone 'deriving instance' declaration,
          so you can specify the instance context yourself
    • When deriving the instance for (Monoid CssClass)
   |
50 |   deriving (Eq, Ord, Monoid, Show)
   |

I'll try to come up with a fix that works with a variety of GHCs if I get time in the next few days.

cannot build it

I am new user. I do not understand it at all.
after I run
~/reflex-platform/scripts/work-on ghcjs ./.
it shows
error: anonymous function at /Users/sxw/reflex-platform/reflex-dom-contrib/default.nix:4:1 called with unexpected argument 'mkDerivation', at /nix/store/7p1v9hfkiwa4ymxfjx5kwbz1k63rx66p-source/pkgs/development/haskell-modules/make-package-set.nix:87:27

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.