Interesting - the link actually states pattern matching is done on fields
not records - that might explain the confusion.
On Monday, 30 January 2017 02:05:52 UTC, Joey Eremondi wrote:
>
> Yep. Sorry for the terminology confusion, I use Constructor (what they
> call them in Haskell) and tag
Yep. Sorry for the terminology confusion, I use Constructor (what they call
them in Haskell) and tag interchangeably, I probably shouldn't.
So, when you do
"type Foo = Bar ... | Baz ..."
You get a tag. The tag can be used to construct Foos, as a function, or to
destruct them, in a "case ... of
That suggests either the compiler distinguishes between implicit & explicit
declarations, or constructors and tags are treated differently (my money's
on the latter).
On Sunday, 29 January 2017 23:25:25 UTC, Joey Eremondi wrote:
>
> This is certainly a case where the message could be better,
This is certainly a case where the message could be better, perhaps we
should log it at https://github.com/elm-lang/error-message-catalog if
something similar is not already there.
Types and expressions (including Constructors) are in different namespaces.
So while there is a Type named Response,
Fixed - the correct solution is:
import Http exposing ( .. )
httpErrorString : Http.Error -> String
httpErrorString error =
case error of
Http.BadStatus ( response ) ->
"bad status [" ++ response.body ++ "]"
For anyone else confused, the problem is a misunderstanding of