I'm not sure the best way to inspect types. elm-repl can do it, but it seems like one of the strengths of beginner Elm is that you don't need to install anything on your computer to get started.
We could maybe do something like type holes? If we extend the toPrint example from the previous chapter, we could turn it into a template like this:
import Graphics.Element exposing (show)
type Type = Type
toPrint : Type
toPrint =
'a'
main = show toPrint
And then when you hit Compile you'd get an error message like
The type annotation for toPrint does not match its definition.
12| toPrint : Type
The type annotation is saying:
Type
But I am inferring that the definition has this type:
Char
Which we could try to explain? I'm not sure what the best way to proceed is. Can you think of something else?
I'm not sure the best way to inspect types. elm-repl can do it, but it seems like one of the strengths of beginner Elm is that you don't need to install anything on your computer to get started.
We could maybe do something like type holes? If we extend the toPrint example from the previous chapter, we could turn it into a template like this:
import Graphics.Element exposing (show)
type Type = Type
toPrint : Type toPrint = 'a'
main = show toPrint And then when you hit Compile you'd get an error message like
The type annotation for
toPrint
does not match its definition.12| toPrint : Type The type annotation is saying:
But I am inferring that the definition has this type:
Which we could try to explain? I'm not sure what the best way to proceed is. Can you think of something else?