Question: Hey! Is anyone using Webpack 4 and doing HMR with elm ? without page reloads. Thanks !

Asked By
Asked At
2018-03-22 00:09:01

Found 15 possible answers.

User Answered At Possible Answer
jxxcarlson 2018-03-22 01:14:08 @composed … mainly more examples. Many of the docs are primarily lists of type signatures. I should have stated my views more judiciously --- there is fine balance between being concise and verbose. I use the elm package docs all the time and do like them.
gabber 2018-03-22 01:17:28 Why this is not caught at compile time? Will that be fixed in 0.19?
Uncaught Error: Trying to use `(==)` on functions. There is no way to know if functions are "the same" in the Elm sense. [...]
luke 2018-03-22 01:38:14 it won't. right now the (==) operator has the type a -> a -> Bool , which unifies with functions so you can still do it. in order to prevent that there needs to be a new supertype or whatever you want to call it, in the way that number and comparable work, to be able to exclude functions also this isn't a really common thing or a blocker so it's not a high priority to address but that's not in scope for 0.19
gabber 2018-03-22 01:44:32 I think it would not required to change the type definition, but instead compiler can check if args being passed are functions, so compilation fails. Indeed, this is not common to happen so it should not a priority, but would be nice to have less runtime exceptions possibilities.
mordrax 2018-03-22 01:49:27 I'm struggling with encoding json for a export to csv feature. Two things: By fail, I mean return a [ [], [], [], [], []] peculiarly, the number of inner lists is correct but there's no data 2. I'm able to encode some List (List String) but not others, and I don't know why... the types are definitive, so if it works for one case, it should work for all 1. The encode will fail silently, much like the decoder i suppose, but I'm struggling to debug this
jessta 2018-03-22 01:59:20 @mordrax got an example? are you sure there are actually items in those lists?
mordrax 2018-03-22 02:22:06 here's the code i'm running, fairly generic:
(5) [Array(0), Array(0), Array(0), Array(0), Array(0)]
The empty data in the second case is valid json, but empty! 
-- chrome output
I've tried to fill each cell with some data, thinking that maybe the join doesn't like having empty strings in lists, not the case.
<@jessta> :point_up:
port outgoing : { key : String, data : String } -> Cmd msg } , data = data { key = key outgoing outgoing_ key data = Ports.outgoing_ looks like this:
outgoing_ : String -> String -> Cmd msg
this is what's come out of elm, debugger at the port so there's nothing else involved.
<@mordrax> uploaded a file: All other cases  
<@mordrax> uploaded a file: The only succesful case  
|> Ports.outgoing_ "ExportToCSV" |> Json.Encode.encode 1 |> Json.Encode.list (header :: rowData subjects) in |> Json.Encode.list (.title >> Json.Encode.string) columns header = |> Json.Encode.list (\column -> column.getRawData subject |> Json.Encode.string) columns rowData subject = let makeCSV subjects columns = makeCSV : List subject -> List (Column subject msg) -> Cmd msg
jessta 2018-03-22 02:36:00 @mordrax what happens if you make it port outgoing : { key : String, data : Json.Encode.Value } -> Cmd msg ?
mordrax 2018-03-22 02:37:02 all the calls does Json.Encode.encode 0 prior to passing it in i've used it successfully for pass pdfs and objects through so far.
jessta 2018-03-22 02:37:36 do you have a sample of data that you can see the issue with?
mordrax 2018-03-22 02:38:43 i suspect it's the actual encoding process, going to doh! forgot to add debug.log.... err i've found another case where it works on a minimal table so i'm going to try to output the encoded values and see what's going on Worked out what it was, our grid component allows adding columns dynamically in the view code, but the export functionality uses the grid state in the update call, which doesn't have these columns. So alot of our grids actually don't have columns! @jessta you were actually right, i'm passing in empty columns somewhere... so even if there is row data (which explains the correct number of nested lists) there is no getter for cell data
confirmed, before passing into the port, it's:
encoded csv: "[\n [],\n [],\n [],\n []\n]" to answer your question though, i'm going to print the data but can't share that here the annoying thing is that Json.Encode fails silently i thought it might have to do with sanitising the strings? there's weird $&%#/ symbols there
latkins_ 2018-03-22 07:00:34 I have a list of buttons, which each emit a message with a different integer value. I've created this list with a It looks like when I click any button, they are all clicked. Is this expected, or a mistake on my part?
jessta 2018-03-22 07:12:18 @latkins_ can you show the code you use to create the buttons?
latkins_ 2018-03-22 07:13:58 makeButton rating book = button [ onClick (RateBook book rating True) ] [ text (toString rating)] div [ class "ratings-buttons" ] ( (\rating -> makeButton rating book) (List.range 1 5)) then
jessta 2018-03-22 07:16:34 @latkins_ and what msgs do you get when you click any of those buttons?

Related Questions