It seems like an oversight that the guide doesn't mention withDefault,
considering that's one of the most important functions in the Maybe &
Result libraries.

I think maybe the guide is best used as a supplement to the core
documentation <http://package.elm-lang.org/packages/elm-lang/core/latest>.
None of the modules are too big... if you haven't yet, I would definitely
recommend browsing the docs for whatever modules you're using!

Totally agree that multi-line expressions are super annoying in the REPL.
For playing around with code, I've found the online editor
<http://elm-lang.org/try> to be much more useful.

Another thing you could try would be to write your longer definitions in a
file:

module Foo exposing (..)

import Json.Decode as Json exposing (..)
import Dict exposing (..)

inputString = """{  "118_192": {    "Cloverdale P": {
"sum_lane_miles": 0,      "sum_single_unit_mt": 0,      "sum_vmt": 57,
"sum_combination_mt": 0    },    "CO P": {      "sum_lane_miles": 0,
"sum_single_unit_mt": 0,      "sum_vmt": 43,      "sum_combination_mt":
0    }      }}"""

gridVolumes = dict ( dict (dict float))
dataDict = decodeString gridVolumes inputString

 and then load the file into the REPL using an import statement.

> import Foo exposing (..)
> dataDict



On Tue, Sep 27, 2016 at 8:43 AM, J. E. Marca <[email protected]>
wrote:

> ...
>
> On Tuesday, September 27, 2016 at 12:04:14 AM UTC-7, Peter Damoc wrote:
>
> ...
>
>
>> You can read more in the Error handling section of the guide:
>> https://guide.elm-lang.org/error_handling/
>>
>>
>>
> I read that on my first pass through the guide, and just re-read it.  What
> I don't see in there is a simple one-liner to get results in a repl when I
> know the result is okay --- it's a repl, I can see the result with my
> eyes.  But after looking up the Result library you mentioned, now instead
> of the long case statement (with the super annoying backslash-end-of-line
> thing for multiline entries), I can use a much simpler Result.withDefault.
>
>
>
> --
> 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 [email protected].
> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to