concept usually a good idea in category idris

appears as: usually a good idea
Type-Driven Development with Idris

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

As functions get larger, it’s usually a good idea to break them down into smaller definitions. Idris provides two constructs for locally defining variables and functions: let and where.

  • Define— Press Ctrl-Alt-A to add a skeleton definition:
    isEven : Nat -> Bool
    isEven k = ?isEven_rhs

    Naming conventions

    As a naming convention, Idris chooses k by default for variables of type Nat. Naming conventions can be set by the programmer when defining data types, and you’ll see how to do this in chapter 4. In any case, it’s usually a good idea to rename these variables to something more informative.


  • As a naming convention, Idris chooses k by default for variables of type Nat. Naming conventions can be set by the programmer when defining data types, and you’ll see how to do this in chapter 4. In any case, it’s usually a good idea to rename these variables to something more informative.