Transcript from the "Primitives & Records" Lesson
>> Richard Feldman: Another way I could write an annotation is for something like this. I could say, totalPages is an integer, that's true. So Elm has integers as well as floats. So floating points, that would be like a decimal. Also, Boolean. So isActive, Bool, that works. Here's how we can annotate functions.
[00:00:19] So I could say the function round, goes from the float to an int by rounding it off, there is also floor and ceiling, which have the same type annotation. There is the not function, which we saw earlier, that takes true and turns it into false or vice versa, that's bool to bool.
[00:00:32] The arrow basically says, here is what I'm taking in and then here's what I'm returning. We have a String.length, which gives you back the length of a string, that takes a string and returns on int. We can also do record types in our annotations. So this kind of demonstrates that's why elm has this different syntax for colon and equals.
[00:01:11] Whereas the Elm, it wants to be consistent. As you can see on the bottom here, where we're using equals for the values and then colon for the types corresponding to those values.