[elm-discuss] Re: More pattern matching

2017-08-22 Thread David Legard
Thanks for the suggestions. Not visually elegant, perhaps, but conceptually quite neat and satisfying. I shall incorporate these ideas into my app. Thanks again. -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group an

[elm-discuss] Re: More pattern matching

2017-08-22 Thread Ilias Van Peer
If you're actually parsing a string, you may also want to look into one of the various parsing libraries like `elm-tools/parser`. If you're willing to give a few more details about the format of those strings, I'm sure people here (and on slack) would be more than willing to give you a hand in

Re: [elm-discuss] More pattern matching

2017-08-22 Thread Peter Damoc
I don't know about elegant but one way to implement something like fizzBuzz would be: https://ellie-app.com/469wMYcvrZ3a1/0 Of course, this assumes that you have a lot of patterns and not the 4 in fizzBuzz If evaluating all the branches is too expensive you can use functions like this: https://el

[elm-discuss] More pattern matching

2017-08-22 Thread David Legard
Does Elm have anything between an *if-then-else* flow control and* case* ? My use case is, I need to parse a string in various ways to decide which Analysis ADT to assign to the string. Thus sconvert : String -> Analysis sconvert s = if s=="all" then AllDays else if s=="unplayed" then

Re: [elm-discuss] best practices for handling unreachable code, i.e., how to handle situations where runtime assertions would be used in other languages

2017-08-22 Thread 'Rupert Smith' via Elm Discuss
On Monday, August 21, 2017 at 9:41:55 PM UTC+1, Dave Doty wrote: > > But it does make me long for runtime exceptions for those errors where you > know that not only the current function, but also any function that may > have called it, really isn't going to be able to do any error-handling or >