Re: [elm-discuss] State of Elm Survey 2017 is live

2017-01-18 Thread Martin DeMello
the survey seemed overly focused on people whose day job was web
development. i'm guessing a significant fraction of the elm community are
people developing side projects.

martin

On Wed, Jan 18, 2017 at 10:28 AM, Brian Hicks  wrote:

> The State of Elm Survey is live. Please take it and share with your
> colleagues. The survey will run from today until the 24th of February (a
> Friday.)
>
> https://www.brianthicks.com/state-of-elm/2017/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Re: Emphasizing /r/elm more

2017-01-04 Thread Martin DeMello
I would argue very strongly against killing elm-discuss. I'm a heavy reddit
user, and I think it simply lacks the features necessary to support
mailing-list-style discussions:

1. if you subscribe to a lot of subreddits, there is no guarantee you'll be
shown new posts from /r/elm in your front page. gmail lets me see a list of
folders in my sidebar with unread-thread counts for each, so I never have
to think about specifically opening up elm-discuss to check if something
new has been posted

2. there is no good way to see the messages you have and haven't already
read within a thread. (there are browser plugins that try to help with this
but don't do a particularly good job; it's a hard problem to solve from the
outside)

3. you get a notification if someone replies to you, but not if someone
replies to that reply.

4. searching through old conversation is really hard

martin

On Wed, Jan 4, 2017 at 10:13 AM, Mark Hamburg  wrote:

> I agree that this only works if elm-discuss gets killed. It might,
> however, be necessary to also kill elm-dev because the leakage of
> elm-discuss traffic over into elm-dev will likely become much worse if
> elm-discuss goes away.
>
> Mark
>
> On Jan 4, 2017, at 9:34 AM, Rex van der Spuy 
> wrote:
>
>
>
> On Wednesday, January 4, 2017 at 12:05:33 PM UTC-5, Brian Hicks wrote:
>>
>> the fact remains that /r/elm is going to be a place that people go to ask
>> questions, and if nobody is there to answer them we're giving people a
>> really bad experience.
>>
>>
> That was my problem: When I started learning Elm I first posted questions
> on /r/elm.
> But, I soon found I received many more, and better, replies here on
> elm-discuss, so I hardly visit /r/elm anymore.
>
> I think for this move to work need to somehow pull the plug on elm-discuss.
> Maybe we should set a kill date, and then after that just lock down this
> list for good with a big sign saying "Please visit /r/elm"...?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Separate files for type declarations and code

2016-12-31 Thread Martin DeMello
I do the same thing in both ocaml and elm code. It's a pretty common
pattern.

martin

On Dec 31, 2016 3:29 PM, "Brian Marick"  wrote:

> To avoid circular dependencies, I find myself putting type declarations in
> one file:
>
> > module Animals.Pages.Declare exposing (..)
> >
> > type PageChoice
> >   = AllPage
> >   | AddPage
> >   | HelpPage
>
> … and related code in another:
>
> > module Animals.Pages.Define exposing
> > ...
> > toPageChangeCmd : PageChoice -> Cmd Msg
> > toPageChangeCmd page =
> >   let
> >...
> >   in
> > Navigation.newUrl url
>
>
> Is that typical, or am I missing something?
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Re: Same code generated by BuckleScriptRe: Elm "faster than JavaScript" (version 0.18) - NOT - Parts I and II...

2016-12-31 Thread Martin DeMello
Bucklescript's codegen looks really nice. Does it have any convenient way
of working with the DOM and generating HTML/SVG? I looked through the docs
and it seemed focused on writing javascript libraries rather than UI code.

martin

On Sat, Dec 31, 2016 at 8:09 AM, Bob Zhang  wrote:

> For the JS backend, `int` is always int32, we have int64 too which is
> simulated by using two `int`. in OCaml float is always double which is
> exactly the same as js number.
> The cool thing is that OCaml already has a very optimized native backend,
> and its type system is much more expressive (on par with Haskell)
>
>
> On Saturday, December 31, 2016 at 8:35:28 AM UTC-5, GordonBGood wrote:
>>
>> On Saturday, 31 December 2016 11:44:10 UTC+7, Bob Zhang wrote:
>>>
>>>
>>> Just for fun, I pasted the same code under BuckleScript playground:
>>>
>>> https://bloomberg.github.io/bucklescript/js-demo/?gist=efaf5
>>> 7aef9b37a38785681ded0ba35a9
>>>
>>> The generated code is below
>>>
>>> ```js
>>> function testProg(n) {
>>>   var lmt = Pervasives.min(n + 1 | 0, 10);
>>>   var _i = n;
>>>   while(true) {
>>> var i = _i;
>>> if (i >= lmt) {
>>>   return i;
>>> }
>>> else {
>>>   _i = i + 1 | 0;
>>>   continue ;
>>>
>>> }
>>>   };
>>> }
>>> ```
>>> Note that BuckleScript compiler is able to do type specialization for
>>> generic comparison, also it heavily optimized curried calling convention
>>>
>>
>> That's interesting; Ocaml is quite a good syntax; this main thing I have
>> found wrong with it in the past is how few primitive types it has, as int
>> Int is 32 bits on 32-bit platforms and 64-bits on 64-bit platforms;
>> actually less then these as there are tag bits.  Going by the try site,
>> this is still true true; this might not affect it's use for BockleScript so
>> much as most things are going to get converted to JavaScript Number's
>> anyway, but one might be forced to use floating types more often then
>> really required and there still is no way to represent primitive unboxed
>> 32/64 bit integers natively.
>>
>> On Monday, December 26, 2016 at 12:44:49 PM UTC-5, GordonBGood wrote:

 *Synopsis:*  Some, including  Evan, maintain that Elm can be "faster
 than JavaScipt".  While that may be true for some use cases including use
 of perhaps more efficient UI updates due to compartmentalized use of
 VirtualDOM, the actaul Javascript code generated by the compiler  is not
 very efficient for many/most tight code cases.  The reason is often
 unnecessary nested function calls that could easily be eliminated by making
 full use of the type information that the Elm compiler has.

 Part I

 *An example;*  The following tight loop doesn't really do anything, so
 should therefore compile into the very tightest of code (and I'm not
 expecting the Elm compiler to recognize that the result is actually known
 at compile time):

 range : Int
 range = 10

 testProg : Int -> Int
 testProg n = -- do some work
   let lmt = min (n + 1) range in
   let loop i =
 if i >= lmt then i else
 loop (i + 1) in loop n

 which compiles to the following JavaScript:

 var _user$project$Temp1482759649866537$range = 10;
 var _user$project$Temp1482759649866537$testProg = function (n) {
 var lmt = A2(_elm_lang$core$Basics$min, n + 100,
 _user$project$Temp1482759649866537$range);
 var loop = function (i) {
 loop:
 while (true) {
 if (_elm_lang$core$Native_Utils.cmp(i, lmt) > -1) {
 return i;
 } else {
 var _v0 = i + 1;
 i = _v0;
 continue loop;
 }
 }
 };
 return loop(n);
 };

>>> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Re: Elm "faster than JavaScript" (version 0.18) - NOT - Parts I and II...

2016-12-28 Thread Martin DeMello
On Wed, Dec 28, 2016 at 6:25 PM, GordonBGood  wrote:
>
>
> Related to speed, it seems to me that the working Fable (F#) code linked
> from your link above is more responsive than the working Elm code from
> another link on that page, both for the same sample application; am I
> imagining things or do you see that too?
>

yes, but it seems to be due to a slower load time from the backend rather
than any perceptible frontend differences.

martin

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Re: Elm "faster than JavaScript" (version 0.18) - NOT - Parts I and II...

2016-12-28 Thread Martin DeMello
On Wed, Dec 28, 2016 at 3:16 PM, GordonBGood  wrote:

> Even if this method works, the interim method means I have to produce
>> JavaScript code which I understood that the purpose of Elm was to avoid.
>> If one still has to write large parts of the code in JavaScript for this
>> particular application, one then starts to ask why not use TypeScript
>> directly (c#'ish syntax) or Kotlin with the JavaScript back end (more
>> concise, can be very functional in use, quite a bit more advanced stage of
>> development than Elm).  For me, these are the implied questions this thread
>> raises.
>>
>
elm certainly hasn't hit the "all things for all people" stage yet, but if
you do want to use an elm-like language with easier js interop I'd
recommend F# rather than typescript or kotlin.

check out this blog post:
http://lucasmreis.github.io/blog/from-elm-to-fable/

martin

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Re: Upgrading to 0.18 and elm-webpack-starter

2016-12-22 Thread Martin DeMello
I've never had webpack file watching work robustly for me. I finally just
bound a vim hotkey to "touch Main.elm" which was an adequate workaround.

martin

On Thu, Dec 22, 2016 at 9:50 AM, Simon  wrote:

> I just updated my skeleton app using webpack to 0.18. There was a bug in
> elm-webpack-loader but that has now been fixed.
>
> See https://github.com/simonh1000/elm-hot-loader for details
>
> (I am seeing the watching breaking after 5 or so rebuilds, which is a bit
> frustrating. I had that before and returned to gulp because of it. If
> anyone knows how to make webpack file watching more robust, let me know)
>
>
>
>
> On Thursday, 22 December 2016 18:39:20 UTC+1, Nathan Eldridge wrote:
>>
>> I know this is a pretty obvious solution, but have you doubled checked
>> your package.json file? My current project started with elm-webpack-starter
>> with several tweaks. When I ran elm-upgrade it did skip over that.
>>
>> You could also be trying to use an installed version of elm-make instead
>> of the package.json version. In an earlier iteration of my current project,
>> I managed to screw around with the path variables too much on Windows and
>> did that as well.
>>
>> If the obvious didn't fix it, are you using the standard 0.17
>> webpack.config.js file? It's possible that your elm-webpack-loader is
>> pointing to the wrong executable.
>>
>>
>> On Thursday, December 22, 2016 at 8:58:50 AM UTC-6, Rex van der Spuy
>> wrote:
>>>
>>> Hi Everyone,
>>>
>>> I'm trying to figure out the best way to get my newly upgraded 0.18 code
>>> to work with an existing elm-webpack-starter installation.
>>> My new code works fine in reactor, but elm-webpack-starter is still
>>> trying to compile it as 0.17.
>>>
>>> Can anyone suggest how to turn-on 0.18 compilation in the 0.7.1 version
>>> of elm-webpack-starter?
>>> Or, should I just clone a the latest version, 0.8, (which is
>>> pre-configured for 0.18) and copy my upgraded Elm source code into it?
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Re: Unpublishing a package

2016-11-22 Thread Martin DeMello
It's not a question of being antisocial or uncivilised; it's that it is
really hard to say "I just want to patch this for 0.18 and continue using
it in my project" without having globally visible effects. It is
unreasonable to expect someone to wait for the package maintainer to do the
update and have the only real recourse be to pester them until they do.
Local repos would fix that once and for all; the automated safeguard could
be that you cannot publish a package to global if it depends on a local
repo.

martin

On Tue, Nov 22, 2016 at 3:12 AM, 'Rupert Smith' via Elm Discuss <
elm-discuss@googlegroups.com> wrote:

> What about the issue of people forking and re-publishing packages (and
> ignoring the tests), because they are too impatient/anti-social to go about
> things in more civilized manner? Do there need to be stricter controls for
> getting stuff into the repo? Do we need or can we manage some kind of
> cummunity oversight? Or is this unnecessary at this stage and its not
> really such an issue?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Tell me how to teach Web Apps

2016-11-21 Thread Martin DeMello
Some things that might help:

1. typescript 2.0 has a really nice set of type-related features.
https://blog.mariusschulz.com/2016/09/27/typescript-2-0-non-nullable-types

in particular, it has support for lexical closures, immutable ("readonly")
data, and tagged unions, which are over 90% of what i want from a
statically typed functional language.

2. stanza has a good rationale for optional typing:
http://lbstanza.org/optional_typing.html

martin

On Mon, Nov 21, 2016 at 3:43 PM, Robert Muller 
wrote:

> Thank you! I've looked at typescript a bit and I am strongly biased toward
> statically typed PLs but I suppose I'll have to sort out whether or not it
> gets over the "helps them get an opportunity" bar. Is it really reasonably
> mainstream? I'll look into it. Thank you for the suggestion.
> Bob
>
>
> On Monday, November 21, 2016 at 6:26:56 PM UTC-5, Martin DeMello wrote:
>>
>> How about teaching it in typescript + react? Typescript is way better
>> than vanilla javascript, while still being reasonably mainstream and not
>> too different-looking.
>>
>> martin
>>
>> On Mon, Nov 21, 2016 at 3:23 PM, Robert Muller 
>> wrote:
>>
>>> I'm teaching a full-semester course on Web Apps this spring. It's my
>>> first time through so I have a lot to learn. I'm a long-time functional
>>> programmer (mostly ML: SML & OCaml). If I wasn't worried about my students
>>> getting jobs and internships the choice would be obvious: I'd teach Elm!
>>> But the students are taking the course to get jobs and internships and I
>>> have to respect that so I'm looking for advice.
>>> A couple of former students in industry tell me that I definitely need
>>> to cover back-end issues. So I'm considering teaching the front 3/4 of the
>>> course using Node.js + React.js and then integrating Elm in the advanced
>>> topics part during the last 1/4 might be reasonable.
>>>
>>> But maybe not. Please tell share your thoughts with me!
>>>
>>> Bob Muller
>>> Boston College
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Elm Discuss" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to elm-discuss...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Tell me how to teach Web Apps

2016-11-21 Thread Martin DeMello
How about teaching it in typescript + react? Typescript is way better than
vanilla javascript, while still being reasonably mainstream and not too
different-looking.

martin

On Mon, Nov 21, 2016 at 3:23 PM, Robert Muller 
wrote:

> I'm teaching a full-semester course on Web Apps this spring. It's my first
> time through so I have a lot to learn. I'm a long-time functional
> programmer (mostly ML: SML & OCaml). If I wasn't worried about my students
> getting jobs and internships the choice would be obvious: I'd teach Elm!
> But the students are taking the course to get jobs and internships and I
> have to respect that so I'm looking for advice.
> A couple of former students in industry tell me that I definitely need to
> cover back-end issues. So I'm considering teaching the front 3/4 of the
> course using Node.js + React.js and then integrating Elm in the advanced
> topics part during the last 1/4 might be reasonable.
>
> But maybe not. Please tell share your thoughts with me!
>
> Bob Muller
> Boston College
>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Re: Rename Just to Something, as the counterpart to Nothing?

2016-11-20 Thread Martin DeMello
I like Some and None, plus it'd be consistent with ocaml

martin

On Sun, Nov 20, 2016 at 3:41 PM, Robin Heggelund Hansen <
skinney...@gmail.com> wrote:

> How about 'Some' and 'None'?
> Those are not longer to type than what we have today, and they should
> solve your initial confusion.
>
>
> søndag 20. november 2016 18.16.26 UTC+1 skrev Will White følgende:
>>
>> I'm talking about Maybe.Just, of course. Just has always seemed strange
>> to me, as if it's hinting that it's something other than just the
>> counterpart to Nothing. I don't know the reasons behind its naming, but I
>> think I would prefer Something, as in "something or nothing". What do you
>> think?
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] dependency problem with upgrading to 0.18

2016-11-18 Thread Martin DeMello
ah, thanks for figuring it out! i'll file a bug for it.

martin

On Fri, Nov 18, 2016 at 12:41 AM, Nick H  wrote:

> It looks like there may be a problem with the tags.
>
> The latest version of the github repo is in Elm 0.18. But the 2.0.1
> release tag is attached to an older commit (it's what I was quoting in my
> last message.)
>
> Looks like the author needs to add a new release tag. Open an issue?
>
> ~Nick
>
> On Fri, Nov 18, 2016 at 12:37 AM, Nick H 
> wrote:
>
>> I am looking at the github page for that project, and it's
>> elm-package.json
>> <https://github.com/tortus/elm-array-2d/blob/5462efa4ebfd6e2600c5c227a8337f4258d44f08/elm-package.json>
>> says something different:
>>
>> "dependencies": {
>> "elm-lang/core": "4.0.0 <= v < 5.0.0"
>> },
>> "elm-version": "0.17.0 <= v < 0.18.0"
>>
>> I don't know why this is different from what you are seeing.
>>
>> On Thu, Nov 17, 2016 at 9:32 PM, Martin DeMello 
>> wrote:
>>
>>> elm-update ran successfully, but elm-make fails with
>>>
>>> $ elm-make
>>> Problem in dependency tortus/elm-array-2d 2.0.1
>>>
>>> The elm-package.json constraints of 'tortus/elm-array-2d' are probably
>>> letting too much stuff through. Definitely open an issue on the relevant
>>> github
>>> repo to get this fixed and save other people from this pain.
>>>
>>> However, I checked tortus/elm-array-2d out independently and it built
>>> fine against 0.18; its elm-package.json looks fine too (and is pretty
>>> minimal).
>>>
>>> "dependencies": {
>>> "elm-lang/core": "5.0.0 <= v < 6.0.0"
>>> },
>>> "elm-version": "0.18.0 <= v < 0.19.0"
>>>
>>> Any idea how to debug this? The error message is pretty opaque and none
>>> of the google hits for when this arose in earlier version bumps were
>>> helpful.
>>>
>>> martin
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Elm Discuss" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to elm-discuss+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] dependency problem with upgrading to 0.18

2016-11-17 Thread Martin DeMello
elm-update ran successfully, but elm-make fails with

$ elm-make
Problem in dependency tortus/elm-array-2d 2.0.1

The elm-package.json constraints of 'tortus/elm-array-2d' are probably
letting too much stuff through. Definitely open an issue on the relevant
github
repo to get this fixed and save other people from this pain.

However, I checked tortus/elm-array-2d out independently and it built fine
against 0.18; its elm-package.json looks fine too (and is pretty minimal).

"dependencies": {
"elm-lang/core": "5.0.0 <= v < 6.0.0"
},
"elm-version": "0.18.0 <= v < 0.19.0"

Any idea how to debug this? The error message is pretty opaque and none of
the google hits for when this arose in earlier version bumps were helpful.

martin

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Re: using a compile-to-js workflow with elm-webpack-starter

2016-11-11 Thread Martin DeMello
Thanks, that helped me get everything working! I think this would be useful
to add to the docs somewhere (either in elm-webpack-starter or in the elm
tutorial itself, since it does mention webpack elsewhere).

martin

On Tue, Nov 8, 2016 at 3:54 AM, Wouter In t Velt 
wrote:

> I use elm-webpack-starter too, with ports.
>
> In webpack, the watcher automatically rebuilds whenever you change a file.
> Not only one of the elm files, but also when you change index.js or
> index.html.
>
> You can change your index.js, or create a new *.js file which you require
> into index.js, or add a 

[elm-discuss] Re: using a compile-to-js workflow with elm-webpack-starter

2016-11-07 Thread Martin DeMello
No one? If the recommended solution is to move off webpack (plus pointers
to a replacement) that's fine too; I would just like to get my dev
environment set up once and for all and then go back to writing elm code.

martin

On Sat, Nov 5, 2016 at 5:31 PM, Martin DeMello 
wrote:

> I have my project set up with elm-webpack-starter, which installs a
> boilerplate index.html and index.js
>
> https://github.com/moarwick/elm-webpack-starter/tree/master/src/static
>
> I'm now trying to follow the ports guide
>
> http://guide.elm-lang.org/interop/javascript.html
>
> which says to compile elm to javascript instead and include that in my
> index.html. I couldn't find any guides towards getting that working with
> the starter webpack setup, though, and blindly modifying the index.html
> file as shown, and copying the generated elm.js to src/static, didn't work.
>
> martin
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] using a compile-to-js workflow with elm-webpack-starter

2016-11-05 Thread Martin DeMello
I have my project set up with elm-webpack-starter, which installs a
boilerplate index.html and index.js

https://github.com/moarwick/elm-webpack-starter/tree/master/src/static

I'm now trying to follow the ports guide

http://guide.elm-lang.org/interop/javascript.html

which says to compile elm to javascript instead and include that in my
index.html. I couldn't find any guides towards getting that working with
the starter webpack setup, though, and blindly modifying the index.html
file as shown, and copying the generated elm.js to src/static, didn't work.

martin

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Re: Support for binary data

2016-11-05 Thread Martin DeMello
Seconding this one - I need to be able to pass a binary file to my backend,
which requires the ability to both load the file and attach binary data to
a POST request.

martin

On Wed, Oct 19, 2016 at 2:53 AM, Simon  wrote:

> My need is to upload PDFs directly to S3. That requires two additional
> things
>
> - the ability to read a file from the hard disk - the sort of native code
> needed is at https://github.com/simonh1000/file-reader/blob/
> master/src/Native/FileReader.js
> - an extra function in Http with signature `blobPart
> 
> : String -> Blob -> Part
> `
>
> Simon
>
>
> On Monday, 11 January 2016 13:55:10 UTC+1, John Watson wrote:
>>
>> Can anyone tell me what the plans are for supporting binary data in elm?
>> I'm thinking of a Byte (and some sort of Byte Array) type and also
>> implementing Blob in HTTP responses.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Send a file via an ajax POST request

2016-11-05 Thread Martin DeMello
Thanks, I took a look at that, but it loads the file data into elm, where
we still have the problem that we cannot attach a binary blob to a POST
request.

I'm not fully sure, but I think the flow needs to be:
1. Get filename from the input button, in elm.
2. Pass filename to javascript
3. Upload the file and attach it to an ajax post request in javascript
4. Pass the return value of the ajax call back to elm

martin

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Send a file via an ajax POST request

2016-11-05 Thread Martin DeMello
I'm a bit lost trying to put the pieces together for this. I have a web
service that does file format conversion, and I want to use the
binary->json converter to import a binary file into an elm frontend.

Here's some code to illustrate what I want to achieve. I can call my webapp
via

$ curl --form "filedata=@filename.bin" --form "from=binary" --form
"to=json" http://localhost:1234/json

and in my view I have

  form [class "pure-form", id "convert-form"]
  [ fieldset []
  [ input [ type' "file" , class "pure-button"] []
  , a [class "pure-button", onClick UploadFile] [text "Load"]
  ]
  ]

>From what I can tell, I'll need to go through the ports system both to
upload the file and to attach the binary data to a POST request, but I'm
not too familiar with javascript either, and I'm hoping this is something
someone has already figured out for their own app.

martin

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Re: Newbie - which build tool

2016-10-28 Thread Martin DeMello
On Fri, Oct 28, 2016 at 6:36 AM, Wouter In t Velt 
wrote:

>
> Don't know anything about Ieiningen or Clojure, but I am a content user of
> elm-webpack-starter ,
> for bundling, hot reload, and sass-to-css.
> Mine is just 1 small voice from the community though.
> Apparently elm-live  is pretty good
> too, and appears to be somewhat lighter than webpack, but I have no
> experience with it.
>

+1 for elm-webpack-starter, it all just works.

martin

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Proposal: rename foldl til foldLeft and foldr to foldRight

2016-10-20 Thread Martin DeMello
I would be strongly opposed to renaming either foldl or foldr to just fold;
that always confuses me when languages do it.

martin

On Thu, Oct 20, 2016 at 8:32 AM, Max Goldstein 
wrote:

> Normally I'm opposed to syntax or name changes. But I think this or some
> variation is a good idea. (Maybe foldl becomes fold, since it's usually the
> one you want.)
>
> That said, it's all subject to Evan's approval.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] why no more primes on 0.18 ?

2016-10-18 Thread Martin DeMello
Agreed; I'll definitely miss being able to use primes in variable names!

martin

On Tue, Oct 18, 2016 at 6:28 PM, mbr  wrote:

> just learned that primes and backticks won't be on elm 0.18.
>
> What are the reason for their removal?
>
> I will miss the primes quite a bit. Am I the only one here that feels this
> way ?
>
> For instance, I would have to write headerModel___ and headerModel__
> instead of headerModel''' and headerModel''
> In the prime case I count the 'while on the underscore case I will
> compare its length.
>
> at the end of the day, I will just skip the underscore and use number like
> headerModel03 and headerModel02.
>
> And my case for backticks, I understand it will make the andThen API
> easier, but why completely remove it from the language ?
>
> I guess my main question is, What is the motivation for their removal ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Re: List.filter -> List.keep?

2016-10-18 Thread Martin DeMello
I like ruby's "select" and "reject", for precisely the same reason.

martin

On Tue, Oct 18, 2016 at 1:39 PM, Kasey Speakman 
wrote:

> I believe filter is a pretty standard name for this. Even Javascript has
> Array.filter
> 
> with the same semantics.
>
> In .NET Linq uses `.Where`, but I believe that is mainly to have
> similarity with SQL.
>
>
> On Tuesday, October 18, 2016 at 2:35:45 PM UTC-5, Duane Johnson wrote:
>>
>> I saw @_chunglou's tweet
>>  yesterday and
>> wondered if this had been discussed before:
>>
>> "I can never, ever remember whether `filter` needs `true` or `false`.
>> `keep` would be a nicer name."
>>
>> I agree `keep` would remove the ambiguity. Thoughts?
>>
>> -- Duane
>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Re: Why does this not work via record intersection

2016-10-09 Thread Martin DeMello
thanks! now that i know the answer i can see that it was in the docs under
"extensible records", but it was indeed non-obvious.

martin

On Sun, Oct 9, 2016 at 9:09 PM, Max Goldstein 
wrote:

> You need a rather non-obvious piece of syntax:
>
> make_xword : { a | rows : Int, cols : Int } -> Xword
>
> This basically means that the input is a record with rows and cols, and
> any other fields. The origin of this syntax is that any record *a*, as
> long as it's extended with these fields, is acceptable.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Why does this not work via record intersection

2016-10-09 Thread Martin DeMello
If I have the following:

make_xword : { rows : Int, cols : Int } -> Xword

import Xword exposing (Xword, make_xword)

type alias InCell =
  { x : Int
  , y : Int
  , contents : String
  }

type alias InXword =
  { rows : Int
  , cols : Int
  , cells : List InCell
  }

to_xword : InXword -> Xword
to_xword input =
  make_xword { rows = input.rows, cols = input.cols }

why can I not replace the last function with

to_xword : InXword -> Xword
to_xword input =
  make_xword input

since input is a superset of {rows; cols}?

martin

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Re: Which text editor do you prefer for Elm?

2016-10-04 Thread Martin DeMello
The top two features I look for in a code editor are vim emulation and
autoindentation - how does vscode hold up in those areas?

martin

On Tue, Oct 4, 2016 at 5:07 AM, Ed Ilyin  wrote:

> BTW, vscode is now gaining popularity (even among Google employees) for
> its consistent look, speed and nice git and shell integration. It is based
> on Monaco-editor.
> Elm plug in: https://github.com/sbrink/vscode-elm
>
> I have used sublime, vim, emacs, spacemacs, atom+proton and now Elming on
> vscode.
> вт, 4 окт. 2016 г. в 12:05, Dénes Harmath :
>
>> Thank you very much for pointing to elmjutsu, it provides the IDE
>> features that I was missing! :)
>>
>> 2016. augusztus 10., szerda 16:32:47 UTC+2 időpontban OvermindDL1 a
>> következőt írta:
>>
>> As others have stated, atom is awesome, easily the best so far.
>>
>> You have https://atom.io/packages/linter-elm-make as other have
>> mentioned.  It and language-elm use elm-oracle for intellisense, which is
>> accurate, but hella-slow, like amazingly slow (multiple-seconds to bring up
>> intellisense kind of slow), same on other IDE's that I've tried that use
>> elm-oracle too (maybe because elm-oracle is just hella-slow on Windows,
>> unsure elsewhere).
>>
>> There is another plugin for elm on atom that came out recently:
>> https://atom.io/packages/elmjutsu
>>
>> Elmjutsu adds significantly faster intellisense, more accurate
>> intellisense (well same accuracy but more 'useful'), a sidebar (or
>> bottom/top) that shows docs on where the cursor is, types shown, go to
>> symbol or declaration or go back, and so much more.  It is made by one of
>> the same people that primarily work on linter-elm-make to fix-up things in
>> linter-elm-make that are out of the scope for that addon.
>>
>> The elm-format atom addon is useful too, it uses elm-format to reformat
>> your file, which you can do on save (don't do that on Windows, Windows
>> non-cow filesystem makes elm-format hurgurk if done at same time as file
>> saving), or only when you call it (which I do, and do often).
>>
>>
>> @Rupert Smith : Just open atom and open the 'folder' of your project
>> where the elm-package.json is.  It works in atom's folder mode.
>>
>> On Wednesday, August 10, 2016 at 7:28:12 AM UTC-6, Rupert Smith wrote:
>>
>> On Wednesday, August 10, 2016 at 1:19:53 PM UTC+1, Simone Vittori wrote:
>>
>> I tried Atom recently, it gets pretty good when you start using the
>> linter-elm-make  package. You
>> get inline errors and some other goodies.
>>
>>
>> Any idea how to tell linter-elm-make where to pick up the
>> elm-package.json from?
>>
>> I have
>>
>> - elm-package.json
>> - src/
>>  - elm/
>>   - Main.elm
>>
>> and it complains imports are missing, I think because it cannot see the
>> elm-package.json file.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Elm Discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to elm-discuss+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Re: Is a decoder the right level of abstraction for parsing JSON?

2016-09-29 Thread Martin DeMello
I've been thinking about this recently because I have some ocaml code I
want to compile to javascript and call from elm, and doing it via json
seems unnecessarily complicated (the elm code already uses the same
algebraic datatypes the ocaml code does). It's definitely easier to insist
that the encoding is strictly conforming (generating is easier than
consuming, after all), so I would be very interested in any work along
those lines.

martin

On Thu, Sep 29, 2016 at 1:46 PM, Riley Eynon-Lynch 
wrote:

> We have 7k lines of Elm in production, and we stopped using it because of
> this pain in the boundary between Elm & JS. The examples from NRI show lots
> of local, elm-internal logic without much API chatter or JS interop. Our
> app has tons of API chatter (realtime collaboration is a feature), and we
> have 40k lines of JS in our main SPA that any newly-elmed component would
> have to talk to.
>
> We found that of our 7k loc, over 1k was in decoders & encoders!
>
>
> On Thursday, September 29, 2016 at 11:54:17 AM UTC-5, Eduardo Cuducos
> wrote:
>>
>> This idea makes a lot of sense to me. We, as developers, could go
>> “automagically” from JSON to Model if they match — and the Json.Decode will
>> still be there if one needs to parse a JSON differently.
>>
>> On Thu, Sep 29, 2016 at 12:36 PM 'Rupert Smith' via Elm Discuss <
>> elm-d...@googlegroups.com> wrote:
>>
>>> On Thursday, September 29, 2016 at 4:35:06 PM UTC+1, Rupert Smith wrote:

 I also have a little problem with the 'roles' encode to solve. At the
 moment I have:

 , ( "roles"
   , case model.roles of
 Just roles ->
 roles |> List.map roleEncoder |> Encode.list

 Nothing ->
 Encode.null
   )

 which will mean 'null' is output when the roles are Nothing.

>>>
>>> Another option would be if Encode provided 'missing : Value', which
>>> means skip that field, but it doesn't.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Elm Discuss" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to elm-discuss...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] How to sell Elm to your client / boss

2016-09-29 Thread Martin DeMello
I think the best way to sell elm to your client/boss is to point to a
reasonably large scale project you have done in elm, and talk about your
experiences with it. Another alternative is to talk about the benefits you
gained from integrating small bits of elm into a larger project.

I'd be wary of selling my boss/client on any technology that I didn't have
in-depth experience of some sort with, because you never know what pitfalls
you might face after you have already committed a few months to it.

martin

On Thu, Sep 29, 2016 at 3:53 AM, Thibaut Assus 
wrote:

> Hello, I just posted a new blogpost on Medium :
>
> https://medium.com/elmlightments/how-to-sell-elm-to-your-client-boss-
> d2a697e7f8fe#.6t7mtl550
>
> Looking forward for your feedback
>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] interop between elm and js-of-ocaml/f# in the browser

2016-09-27 Thread Martin DeMello
Has anyone done work on serialising/deserialising data to share between elm
and js code generated from ocaml or f#? Json does not seem like the optimal
way to do it, because there's an impedance mismatch between the datatypes
in both languages. I tried googling around for serialisation formats
specifically meant to share data between ML-like languages, but didn't find
anything.

If someone has a library to make converting sum-and-product data structures
to/from json easier (ideally via some sort of declarative spec), that would
do nicely too.

martin

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Problem with keyboard inputs and focus

2016-09-25 Thread Martin DeMello
Full code here: https://github.com/martindemello/crosspad.elm

I have a page consisting of an SVG crossword grid, and a group of radio
buttons for various settings.

My subscriptions:

subscriptions: Model -> Sub Msg
subscriptions model =
  Sub.batch
[ Keyboard.presses (\code -> KeyPress (fromCode code))
, Keyboard.downs (\code -> KeyDown (fromKeyCode code))
]

for catching global keyboard presses (KeyDown for special keys and KeyPress
for alpha). The full update handler is

update: Msg -> Model -> (Model, Cmd Msg)
update msg model =
  case msg of
ClickSquare x y -> ({ model | cur_x = x, cur_y = y }, Cmd.none)
KeyDown k -> (handle_keycode k model, Cmd.none)
KeyPress c -> (handle_keypress c model, Cmd.none)
SetSymmetry s -> (handle_symm s model, Cmd.none)

where ClickSquare and SetSymmetry come from inline event handlers in the
svg grid and the radio group respectively. The problem is if I click on a
radio button, the radio group gets the focus, and the arrow keys get
processed by two separate handlers.

The narrow question I have is how I can detect and set the focused element
(everything I found on google sounded hacky), or if this is not properly
supported, what is the correct way to write my code? If I can attach my
keyboard handlers just to the SVG element that would be great too, but I
couldn't figure that out either.

I thought of overloading the ClickSquare handler to set the grid to
"active" whenever a square is clicked, and wrapping my Keyboard.presses and
Keyboard.downs handlers in an "if active" check, but that seems like doing
manually what I should be able to just work with the browser to do for me.

martin

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Re: pattern matching on a field within a record

2016-09-24 Thread Martin DeMello
On Sat, Sep 24, 2016 at 9:11 PM, Nick H  wrote:

>
> Regarding null_square: If you want to make sure that null_square is passed
> by reference, you can define it as a top-level value. (That said, the
> record is so small, I doubt it would make a noticeable performance
> difference, unless you're planning on making a gazillion of them.)
>

That's what I ended up doing, and the code was pretty nice with it.

martin

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Re: pattern matching on a field within a record

2016-09-24 Thread Martin DeMello
Don't think that will work because c is of type Maybe Square, not Maybe
Cell.

One further question - if I define

let null_square = { cell = Empty, num = 0 }

let get_square maybe_square =
  case maybe_cell of
Nothing: null_square
Just s : s

let get_letter maybe_square =
  case maybe_square of
{ Letter s } -> s
_ -> ""

would that be introducing an inefficient creation of a null_square every
time I call get_letter or is it just a cheap reference?

martin

On Fri, Sep 23, 2016 at 12:04 PM, Simon  wrote:

> This should work
>
>  case c of
> Just (Letter s) ->
>   s
> _ -> ""
>
>
>
> On Friday, 23 September 2016 03:50:19 UTC+2, Martin DeMello wrote:
>>
>> If I have the following code:
>>
>> type Cell = Empty | Letter String
>>
>> type alias Square =
>>   { cell : Cell
>>   , num : Int
>>   }
>>
>> and c : Maybe Square,
>>
>> can I do the following in a single match?
>>
>>   case c of
>> Just { cell } ->
>>   case cell of
>> Letter s -> s
>> _ -> ""
>> _ -> ""
>>
>> that is, i conceptually want
>>
>>   case c of
>> Just { cell = Letter s } -> s
>> _ -> ""
>>
>> martin
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] pattern matching on a field within a record

2016-09-22 Thread Martin DeMello
If I have the following code:

type Cell = Empty | Letter String

type alias Square =
  { cell : Cell
  , num : Int
  }

and c : Maybe Square,

can I do the following in a single match?

  case c of
Just { cell } ->
  case cell of
Letter s -> s
_ -> ""
_ -> ""

that is, i conceptually want

  case c of
Just { cell = Letter s } -> s
_ -> ""

martin

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.