Re: [elm-discuss] Re: fold function argument order

2016-12-09 Thread Janis Voigtländer
Kasey, you keep talking as if there were a mathematical, semantic concept of “left-associativity” (and the same for “right-associativity”). But there isn’t. Or can you give a definition? A definition of the mathematical, semantic concept of “associativity” is: “An operator is associative if

Re: [elm-discuss] Re: fold function argument order

2016-12-09 Thread Kasey Speakman
Minor term correction. String concatenation isn't left-associative (duh on my part). It's just not commutative (the order can't be swapped and still get the same answer, unlike addition/multi). On Friday, December 9, 2016 at 11:15:04 PM UTC-6, Kasey Speakman wrote: > > It's about associativity.

Re: [elm-discuss] Re: fold function argument order

2016-12-09 Thread Kasey Speakman
It's about associativity. Some operations have specific associativity even when a and b are different types. Cons (::) is a great example of this. Cons is only right associative even when `a` is Int and `b` is List Int. You cannot write `[] :: 1 :: 2 :: 3`, because cons does not work from the

Re: [elm-discuss] elm-lang/Navigation with hash and query string

2016-12-09 Thread Nick H
I would call this not a bug, since it conforms to the URL standard . in your second example, ?a=b=d is not a query string, but a part of the fragment string. This is just one of several ways that URL syntax can lead you down a dark alley and steal your

[elm-discuss] elm-lang/Navigation with hash and query string

2016-12-09 Thread Charlie Koster
I submitted an issue to evancz/url-parser but it ended up being human error on my part. However, I'm making this post because of my closing comment on that

Re: [elm-discuss] `Case of` branches grouping

2016-12-09 Thread Max Goldstein
In addition to the underscore pattern (meh - makes it easy to forget about a case added later) and refactoring types, I can also recommend extracting a function. You still have to have n cases but each of them will be short. -- You received this message because you are subscribed to the

Re: [elm-discuss] Re: fold function argument order

2016-12-09 Thread Max Goldstein
Fold takes arguments in the same order as update: the element and then the accumulator. Don't trust partial application of infix ops unless you know they are commutative. Write a lambda instead. -- You received this message because you are subscribed to the Google Groups "Elm Discuss"

Re: [elm-discuss] Re: fold function argument order

2016-12-09 Thread Nick H
expection to this exceptation. On Fri, Dec 9, 2016 at 2:17 PM, Nick H wrote: > I would disagree with "not expected in general." In general -- when a and > b are different types -- Elm's API design guidelines should set you up to > always expect a -> b -> b and never b

Re: [elm-discuss] Re: fold function argument order

2016-12-09 Thread Nick H
I would disagree with "not expected in general." In general -- when a and b are different types -- Elm's API design guidelines should set you up to always expect a -> b -> b and never b -> a -> b. If the definition of foldl were changed to take the latter, it would be the only exception to this

Re: [elm-discuss] Re: Stance on native APIs for 0.18?

2016-12-09 Thread Duane Johnson
On Fri, Dec 9, 2016 at 1:07 PM, Mark Hamburg wrote: > operations that need to deal with the external world The one thing I don't like about Elm is the feeling that it's *hard work* to deal with the world. I wish it felt like a happy place, a tool I would easily reach

Re: [elm-discuss] `Case of` branches grouping

2016-12-09 Thread Nick H
> > I generally don't like using equality test on union types because that > makes your code more prone to errors - later on you might decide to add / > remove some types from union type. I'm on board with that. I try to avoid catch-all underscores in case statements for the same reason. But if

Re: [elm-discuss] Re: Stance on native APIs for 0.18?

2016-12-09 Thread Mark Hamburg
While there are certainly times when synchronous calls would have been nice, I recognize that having synchronous behavior for potentially mutable external state also tends to imply a lot about execution order — something that a pure functional language expects to be more free about. Hence, I think

Re: [elm-discuss] Re: how to make a port compnent

2016-12-09 Thread Nick H
Forgot to say... that's a really cool idea! :-) On Fri, Dec 9, 2016 at 10:25 AM, Nick H wrote: > I would love for somebody to disagree with me, but I really don't think > Elm is a good choice for this project. > > Elm does not have any audio support yet, so that

Re: [elm-discuss] Re: how to make a port compnent

2016-12-09 Thread Nick H
I would love for somebody to disagree with me, but I really don't think Elm is a good choice for this project. Elm does not have any audio support yet, so that would all be done through ports. You've said the code editor will not be in Elm... and it sounds like that is going to be a major part of

[elm-discuss] Re: how to make a port compnent

2016-12-09 Thread أحمد حبنكة
well the application is going to be like this : the user will create tutorials like this : user starts recording audio, while speaking he/she enters code in the code editor , when user ends recording the course shall be created. Now someone will watch the course, when the course is started

Re: [elm-discuss] Re: how to make a port compnent

2016-12-09 Thread Peter Damoc
On Fri, Dec 9, 2016 at 6:05 PM, Nick H wrote: > I am pretty sure it is impossible to "wrap" a JS component with Elm, > especially if it is as complicated as a code editor. This thing is going to > have loads of code that already manages rendering and event handling.

[elm-discuss] Re: launchaco built in Elm

2016-12-09 Thread Wouter In t Velt
Op vrijdag 9 december 2016 06:55:07 UTC+1 schreef Marc Laventure: > > Hey! I am the author, great to hear your satisfaction with Launchaco. I am > also super excited to play around with elm on server side rendering! Fun > tidbit, we used golang to generate the html and assets when you click the

Re: [elm-discuss] Why latest versions of elm-compiler not available on Hackage?

2016-12-09 Thread Joey Eremondi
Jan, can you tell us about your use case? Elm-compiler doesn't export the parser as a library. If you're looking to do stuff like that, elm-format might be a better starting point for a parser: https://github.com/avh4/elm-format The syntax is not exported as an API because it is subject to

[elm-discuss] Re: `Case of` branches grouping

2016-12-09 Thread Kasey Speakman
An example of what it could look like. In F#, you can group cases together which have the same parameter type match x with | A i -> // stuff1 | B s | C s | D s -> // stuff2 on s However you cannot group together cases with different parameters types match x with |

Re: [elm-discuss] Why latest versions of elm-compiler not available on Hackage?

2016-12-09 Thread Nick H
You need to build from source. The elm compiler moved from hackage to npm. It was never maintained in both places at once. On Fri, Dec 9, 2016 at 1:51 AM, Jan Hrček wrote: > Hello, > > is there a distribution of latest (0.18) elm-compiler available as haskell > library? I

Re: [elm-discuss] `Case of` branches grouping

2016-12-09 Thread Petr Huřťák
I generally don't like using equality test on union types because that makes your code more prone to errors - later on you might decide to add / remove some types from union type. On Friday, December 9, 2016 at 4:57:48 PM UTC+1, Nick H wrote: > > You can also do equality tests on type values,

Re: [elm-discuss] `Case of` branches grouping

2016-12-09 Thread Wouter In t Velt
Op vrijdag 9 december 2016 16:57:48 UTC+1 schreef Nick H: > > This only works if your type values aren't storing any data. > The equality test can be done if you are *not trying to pattern match* on the data in the type. So -- will work if someValue == Just 42 then doStuffWith 42 is fine,

Re: [elm-discuss] Re: how to make a port compnent

2016-12-09 Thread Nick H
I am pretty sure it is impossible to "wrap" a JS component with Elm, especially if it is as complicated as a code editor. This thing is going to have loads of code that already manages rendering and event handling. Its not going to play nicely with the VDOM. What is the rest of your program

[elm-discuss] `Case of` branches grouping

2016-12-09 Thread Petr Huřťák
Hi, I would like hear some discussion on grouping of branches in `case of` statement . Currently it is not possible to use one branch for multiple conditions. Something along these lines: case someTypeValue of A -> -- code B -> C -> D -> -- different code

Re: [elm-discuss] Re: Stance on native APIs for 0.18?

2016-12-09 Thread Vojtěch Král
Dne pátek 9. prosince 2016 12:12:43 UTC+1 Rupert Smith napsal(a): > > On Thursday, December 8, 2016 at 5:27:53 PM UTC, Vojtěch Král wrote: >> >> This resonates with me very much. This is _exactly_ the reason why I made >> The Elm Alienation post on Reddit: >>

[elm-discuss] Re: Elm Visual Debugger/IDE Idea

2016-12-09 Thread Conner Ruhl
Yeah, that sounds like a fun project. Collapsing similar messages (like ticks) would be another small improvement. On Wednesday, December 7, 2016 at 1:21:10 AM UTC-6, Will White wrote: > > Hi Conner. I'm interested in working on the debugger in this way, for > starters: > >

Re: [elm-discuss] Re: fold function argument order

2016-12-09 Thread Kasey Speakman
Ok, correction List.foldl (-) 0 [1, 2, 3] -- returns 2 -- expands to 3 - (2 - (1 - 0)) = 2 During my testing last night, I had a typo (foldr instead of foldl) when I was testing the expansions. That was the center-building behavior. Using the form a -> b -> b is right-building regardless of

[elm-discuss] Re: Why latest versions of elm-compiler not available on Hackage?

2016-12-09 Thread أحمد حبنكة
you can see this issue : https://github.com/elm-lang/elm-compiler/issues/1300 while it is a bit old, I think it states Evan's decision so you either have to build from source or work with the command-line options. بتاريخ الجمعة، 9 ديسمبر، 2016 11:51:33 ص UTC+2، كتب Jan Hrček: > > Hello, > > is

Re: [elm-discuss] Re: fold function argument order

2016-12-09 Thread Kasey Speakman
Sorry, that last bit was an example of what happens in Elm when folding with string concat (++). That's unexpected behavior from a left fold. List.foldl (++) "" ["The ", "quick ", "brown "] -- returns "brown quick The " On Friday, December 9, 2016 at 8:26:17 AM UTC-6, Kasey Speakman wrote: >

Re: [elm-discuss] Re: fold function argument order

2016-12-09 Thread Kasey Speakman
You're confusing pipe's syntax and infix. Pipe is defined like this: (|>) x f = f x And used like this x |> f == f x So pipe has an inherent flip because it is used to chain otherwise right-building statements. e.g. List.sum (List.filter isOdd [1, 2, 3]) vs [1, 2, 3] |> List.filter isOdd

[elm-discuss] Re: how to make a port compnent

2016-12-09 Thread أحمد حبنكة
Is there a solution to my problem or are native modules my only solution ? بتاريخ الأربعاء، 7 ديسمبر، 2016 5:13:56 م UTC+2، كتب أحمد حبنكة: > > I'm going to build a project in which I need to build a code editor > component, Right now I plan to use microsoft's monaco editor, I want to > wrap as

Re: [elm-discuss] Re: Stance on native APIs for 0.18?

2016-12-09 Thread 'Rupert Smith' via Elm Discuss
On Thursday, December 8, 2016 at 5:27:53 PM UTC, Vojtěch Král wrote: > > This resonates with me very much. This is _exactly_ the reason why I made > The Elm Alienation post on Reddit: > https://www.reddit.com/r/elm/comments/5g3540/the_elm_alienation/ > If I can quote from that: "In a nutshell,

[elm-discuss] Why latest versions of elm-compiler not available on Hackage?

2016-12-09 Thread Jan Hrček
Hello, is there a distribution of latest (0.18) elm-compiler available as haskell library? I checked hackage but that only has version 0.15. Or do I need to build it from sources? I'd like to make use of the elm parsing capabilities of the

[elm-discuss] Re: Race condition in textareas?

2016-12-09 Thread John Watson
In case anyone's still interested, I sorted out the problem I think. defaultValue is working absolutely fine. The problem appears to be that there is a difference between the way Firefox on the one hand and Chrome and Safari on the other require you to get input from the slider. The former