I am learning elm, I've read the documentation and now I'm trying to annotate all the examples trying to explain what happens in each function.
This exercise is taking me quite some time to understand.
String and the last Html, but what about the middle one? Is it a Result which is composed by a String field and a List String field?view : String -> Result String (List String) -> Html
results : Signal.Mailbox (Result String (List String))
I'll leave the async bit for another question, many thanks in advance!
Result abstracts an operation that could succeed or fail. It is defined as
type Result error value
= Ok value
| Err error
If the operation succeeds the values will be Ok value, otherwise, if it fails, it will be Err error. In your case, the suceed value will be a list of strings, while the error value will be a single message.
For the second point, the thing is similar, results is a mailbox that contains a Result, which will be either Ok (List String) or Err String
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With