concept constructor in category idris

appears as: constructors, constructors, The constructors, constructor, The constructor, constructor
Type-Driven Development with Idris

This is an excerpt from Manning's book Type-Driven Development with Idris.

Again, this gives the fully qualified name of the type Prelude.List.List. It also gives the constructors, which are the primitive ways of constructing lists. Finally, for the :: operator, it gives the fixity, which states the operator is right associative (infixr) and has precedence level 7. I’ll describe precedence and the associativity of operators in more detail in chapter 3.

For Bool, for example, :doc reveals that the constructors are False and True:

  • Define— If you case-split on with_pat, you’ll get appropriate patterns for input arising from the types of the constructors to SplitList:
    mergeSort : Ord a => List a -> List a
    mergeSort input with (splitList input)
      mergeSort [] | SplitNil = ?mergeSort_rhs_1
      mergeSort [x] | SplitOne = ?mergeSort_rhs_2
      mergeSort (lefts ++ rights) | (SplitPair lefts rights) = ?mergeSort_rhs_3