Question: What would that do?

Asked By
ilias
Asked At
2017-10-19 19:31:35

Found 15 possible answers.

User Answered At Possible Answer
joelq 2017-10-19 19:32:42 In Elm you would probably use List.map or List.foldl for most uses of each in other languages
anildigital 2017-10-19 19:34:15 function with map only take one argument
ilias 2017-10-19 19:34:51 Can you explain what you wish to do? It feels like you're looking for List.map with a partially applied function, knowing a little more about the purpose of your question would help :slightly_smiling_face:
ericgj 2017-10-19 19:40:08 I typically control this from the server side, but it's interesting to think through how to use Elm type system to do it.
ilias 2017-10-19 19:40:19 a traditional each is only useful with side-effects/mutation - if I understand what your mean with each . Other than that, it's the same thing
joelq 2017-10-19 19:42:06 Even in languages like Ruby, it's more idiomatic to use Array#map or Array#inject instead of Array#each if you aren't dealing with side-effects :slightly_smiling_face:
janiczek 2017-10-19 19:47:35 It's worth repeating that in Elm you don't have a way of "doing stuff" - only returning stuff :slightly_smiling_face: view returns, update returns, everything returns! :mutable-state:
ggallagher 2017-10-19 19:49:00 agreed, i'm hoping to come up with a way to filter what buttons, etc show up based on what role and/or group a user is in
ericgj 2017-10-19 19:59:39 well your view functions could be something like
view : {a | role : Role, group : Group } -> Model -> Html Msg
ggallagher 2017-10-19 20:01:25 thank you, i will see if i can put something together around this and let you know how it goes
ericgj 2017-10-19 20:02:10 I'm assuming you get the Role and Group from some kind of user session data
anildigital 2017-10-19 20:04:27 Anyone know why https://ruby-operators.herokuapp.com/spaceship doesn’t directly work .. but works when I open https://ruby-operators.herokuapp.com/ and then click the operator Looks like there is issue with Elm navigation and Heroku but not on heroku works locally Looks like Heroku issue ..
ggallagher 2017-10-19 20:05:43 eventually
ilias 2017-10-19 20:06:09 Right, you'll need to configure your server-side thing to always return the same page for those urls especially that second bit https://github.com/heroku/heroku-buildpack-static#custom-routes this seems relevant
ericgj 2017-10-19 20:11:12 You could also enforce that only certain Msgs can be sent to update if the user is in certain roles/groups. May be overkill though if your views prevent this.

Related Questions