Every expression in Haskell has a type which is determined at compile time. All the types composed together by function application have to match up. If they don't, the program will be rejected by the compiler. Types become not only a form of guarantee, but a language for expressing the construction of programs.

Click to expand

All Haskell values have a type:

char = 'a' :: Char int = 123 :: Int fun = isDigit :: Char -> Bool

You have to pass the right type of values to functions, or the compiler will reject the program:

Type error isDigit 1

You can decode bytes into text:

bytes = Crypto . Hash . SHA1 . hash "hello" :: ByteString text = decodeUtf8 bytes :: Text

But you cannot decode Text, which is already a vector of Unicode points: