A Haskell type alias, or type synonym, gives an existing type a clearer name without creating a distinct representation or type identity. Use the type keyword when the name explains how values are used. section 2.3.1 section 2.6
Naming an alphabet
An alphabet is represented as a list of characters, just like a String, but the alias communicates its role in a substitution cipher: type Alphabet = [Char] lowerAlphabet :: Alphabet lowerAlphabet = ['a' .. 'z'] upperAlphabet :: Alphabet upperAlphabet = ['A' .. 'Z'] digits :: Alphabet digits = ['0' .. '9'] Alphabet values remain lists of Char. The alias improves readability; it does not prevent ordinary String and Alphabet values from being used interchangeably. section 2.3.1
Aliases become especially useful when a general representation has a more specific purpose:
- Use String for human-readable text and Alphabet for characters used by a cipher. section 2.3.1
- Use FilePath when a String represents a filename; the two types remain interchangeable. section 3.3.1
- Inspect aliases and values with :type and :info, and refresh changed definitions with :reload in GHCi. section 2.3.1 section 2.6
type Alphabet = [Char]
Inspect the compact alias declaration that gives a list of characters a domain-specific name. section 2.3.1





