Programming Stuff

Haskell I: Declarations and Pattern Matching

Haskell has name conventions. Here the different declarations group by camel-case and pascal-case conventions.


  • Camel-Case Names (lower camel case)
    • Variables
    • Functions/Parameters
  • Pascal-Case Names
    • Modules
    • Type synonyms
    • Qualified Import (Loading Modules)
    • Classes (Typeclasses)
    • Data  (Datatype)

      * Note: firstName, lastName, age, height, phoneNumber and flavor are functions that why are camel-case.

Pattern Matching & Guards

  • Pattern Matching
    * Concrete data type 

    * _

    * List Comprehensions

    * x:xs

    * all@(x:xs)
  • Guards
    * | 

    * Where
  • Others
    * let-in 

    * Case expressions

    or Where (we create “what” as function)

Helper function to discover more information about the types

  • types of Function or Constructor/Tag. e.g. the first one describe the type or signature of the function map

  • information of almost anything (type, classes, functions…).  e.g. the last one describe who derive( or implement) the class Show

  • kind



Hoogle: (type/signature matching)