Maybe this will help: all record types already exist when the type checker 
starts. Even though there are no terms of that type, you could write x = { 
bar = "foo" } and that value will be assigned the type { bar : String }, 
notice the equals in the value and the colon in the type.

So, type aliasing a record is just like type aliasing an Int: It doesn't 
increase the number of types available, it just adds a new name (alias) for 
an existing type.

Meanwhile the type keyword, no alias, creates a union type, which you say 
you understand. Point being that a union type is a new type, which could 
not be written before it was defined. (Record constructors are useful 
shorthand, but if hypothetically the language didn't provide them, there 
wouldn't be any programs that would become unwritable because of that 
change.

-- 
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