GithubHelp home page GithubHelp logo

purescript-turbine's People

Contributors

andrew-lei avatar dewey92 avatar kurtmilam avatar paldepind 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  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

purescript-turbine's Issues

Update zip code example

The zip code example doesn't compile. It needs to be updated to the latest version of its dependencies.

Support for a "list" function with mutable elements?

Hello!

Please see the following example:

module Main where

import Prelude

import Data.FunctorWithIndex (mapWithIndex)
import Data.String as String
import Data.Tuple (Tuple(..))
import Data.Tuple as Tuple
import Effect (Effect)
import Turbine ((</>))
import Turbine as T
import Turbine.HTML as TH

-- | The entry-point application component, whose primary function it is to switch around
-- | between the login / registration / main activities.
app :: T.Component {} {}
app = T.component \o -> do
    let 
      splitify :: String -> Array (Tuple Int String)
      splitify s = mapWithIndex (\i c -> Tuple i (String.singleton c)) (String.toCodePointArray s)
    (
      (TH.input {} `T.use` (\oo -> {the_string: oo.value}))
        </>
      (TH.ul {} (T.list (show >>> TH.text >>> TH.li {}) (splitify <$> o.the_string) Tuple.fst))
    ) `T.output` {}
    

main :: Effect Unit
main = T.runComponent "#mount" app

Once loaded, try typing in the text field, then editing the typed string. Notice how the list not a proper function of the input behavior.

The current signature of list (especially given the getKey parameter) would suggest that the individual components are updated as the list changes, but this currently only happens when the key itself changes. Especially to newcomers to FRP (like me), this is very confusing.

Proposed solution: Add a new function that provides a Behavior a instead of a a to the coponent generator function.

Examples broken by change to Component _ Output

Didn't notice this when testing (bower must not actually be installing from the local directory), but now that the version number has been updated, the examples are now broken again. Probably caused by moving all the types in Elements.purs from o to Output. For example, here is the error from the todomvc:

Error found:
in module Main
at src/Main.purs line 121, column 3 - line 130, column 4

  Could not match type
                                     
    ( blur :: Stream FocusEvent      
    , click :: Stream Unit           
    , dblclick :: Stream Unit        
    , keydown :: Stream KeyboardEvent
    , keyup :: Stream KeyboardEvent  
    )                                
                                     
  with type
                                                    
    ( addItem :: Stream String                      
    , items :: Behavior                             
                 (Array                             
                    { isComplete :: Behavior Boolean
                    , name :: Behavior String       
                    , isEditing :: Behavior Boolean 
                    , delete :: Stream Int          
                    }                               
                 )                                  
    )                                               
                                                    

while trying to match type { click :: Stream Unit           
                           , dblclick :: Stream Unit        
                           , keydown :: Stream KeyboardEvent
                           , keyup :: Stream KeyboardEvent  
                           , blur :: Stream FocusEvent      
                           }                                
  with type { addItem :: Stream String                      
            , items :: Behavior                             
                         (Array                             
                            { isComplete :: Behavior Boolean
                            , name :: Behavior String       
                            , isEditing :: Behavior Boolean 
                            , delete :: Stream Int          
                            }                               
                         )                                  
            }                                               
while checking that expression (section { "class": ...                 
                                        }                              
                               )                                       
                               ((header { "class": ...                 
                                        }                              
                                )                                      
                                ((merge (...)) (todoFooter { todos: ...
                                                           }           
                                               )                       
                                )                                      
                               )                                       
  has type Component                                         
             { addItem :: Stream String                      
             , items :: Behavior                             
                          (Array                             
                             { isComplete :: Behavior Boolean
                             , name :: Behavior String       
                             , isEditing :: Behavior Boolean 
                             , delete :: Stream Int          
                             }                               
                          )                                  
             }                                               
             { addItem :: Stream String                      
             , items :: Behavior                             
                          (Array                             
                             { isComplete :: Behavior Boolean
                             , name :: Behavior String       
                             , isEditing :: Behavior Boolean 
                             , delete :: Stream Int          
                             }                               
                          )                                  
             }                                               
in value declaration todoAppView

psc-package support

I'm currently evaluating a number of FRP-based purescript libraries but couldn't install purescript-turbine using psc-package which is, in my experience, way better than bower.

purescript-hareactive and purescript-turbine both do not exist in psc-package's package set. Will you consider adding psc-package support for both of these libraries?

BTW, from reading the README(s) (including JS/TS libraries), the maintainers've done an excellent job. Hope support does not die away like with many other similar libraries.

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.