Re: [elm-discuss] How to check if all Maybes are specified and use values directly (without using "withDefault")

2016-08-03 Thread Austin Baltes
Hi Janis, thank you for sharing that library. I wasn't familiar with it and it exposes some useful functionality -- I'll definitely keep in mind! On Wednesday, August 3, 2016 at 9:25:14 PM UTC-7, Janis Voigtländer wrote: > > Another possible take on your example: > > forecastProtected : Maybe Flo

Re: [elm-discuss] How to check if all Maybes are specified and use values directly (without using "withDefault")

2016-08-03 Thread Janis Voigtländer
Another possible take on your example: forecastProtected : Maybe Float -> Maybe Float -> Maybe Float -> (List Int) -> List FloatforecastProtected q d b months = case combine [q, d, b] of Just [q, d, b] -> forecast q d b months _ -> [] where combine is from http://package.elm-lang.or

Re: [elm-discuss] How to check if all Maybes are specified and use values directly (without using "withDefault")

2016-08-03 Thread Austin B
Hey thank you! On Wednesday, August 3, 2016 at 4:51:55 PM UTC-7, Joey Eremondi wrote: > > The key here is to use the wildcard _ in your pattern matching, which will > match any value. > > You can also bundle your arguments in a tuple, without needing to use > records. > > forecastProtected : Ma

Re: [elm-discuss] How to check if all Maybes are specified and use values directly (without using "withDefault")

2016-08-03 Thread Joey Eremondi
The key here is to use the wildcard _ in your pattern matching, which will match any value. You can also bundle your arguments in a tuple, without needing to use records. forecastProtected : Maybe Float -> Maybe Float -> Maybe Float -> (List Int) -> List Float forecastProtected q d b months = c

[elm-discuss] How to check if all Maybes are specified and use values directly (without using "withDefault")

2016-08-03 Thread Austin B
I am trying to ensure that three arguments to a function are all not Nothing. Right now I have this (below), which works, but uses "withDefault." I want to avoid this because the default values are meaningless and I want to clearly and fundamentally avoid any possible situation where a Nothing