I personally put long strings in their own global variable/function while 
spaced as they should with ++ (the compiler certainly should optimize 
'that'), so the above would be for me:
```elm
story_johnOliver_desc =
  "Far, far away in a land called teevee, there " ++
  "lived a wise man whose laugh you could see."

# elsewhere
        |> Dict.insert 2
            (Story
                "John Oliver"
                story_johnOliver_desc
            )
```

Though to be honest I only use `++` on quite long strings, the above form 
I'd still do as a single line, but still in its own call.


On Sunday, September 25, 2016 at 3:14:52 PM UTC-6, Duane Johnson wrote:
>
> I'm curious if there are other options for making long inline strings look 
> good in Elm:
>
> 1. Use double quotes and (++) to concatenate. Cons: adds runtime 
> operation; must add parens around the string block if it's an argument, 
> e.g. the following does not compile
>
> ```elm
>         |> Dict.insert 2
>             (Story
>                 "John Oliver"
>                 "Far, far away in a land called teevee, there " ++
>                 "lived a wise man whose laugh you could see."
>             )
> ```
>
> To compile, it must become:
>
> ```elm
>         |> Dict.insert 2
>             (Story
>                 "John Oliver"
>                 ("Far, far away in a land called teevee, there "
>                     ++ "lived a wise man whose laugh you could see."
>                 )
>             )
> ```
>
> 2. Use triple-double quotes. Cons: includes whitespace, and in combination 
> with elm-format, whitespace is not within control:
>
> ```elm
>         |> Dict.insert 2
>             (Story
>                 "John Oliver"
>                 """Far, far away in a land called teevee, there
>                 lived a wise man whose laugh you could see."""
>             )
> ```
>
> The second string becomes "Far, far away in a land called teevee, there   
>              lived a wise man whose laugh you could see." (Note extra 
> spaces between "there" and "lived").
>
> 3. Put strings on one big line. Cons: not pretty, hard to see in a text 
> editor without line wrapping.
>
> Any suggestions?
>
> Thanks,
> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to