| Start |
|---|
| Bang Patterns Patterns annotated with a bang ( In this example, Bang patterns are enabled using the Haskell 2010 |
| Lazy patterns Lazy, or irrefutable, patterns (denoted with the syntax The following function is lazy in its argument: and so we get The following function is written with a lazy pattern but is in fact using the pattern's variable which forces the match, so will fail for
Here |
| Normal forms This example provides a brief overview - for a more in-depth explanation of normal forms and examples, see this question (opens new window). Reduced normal formThe reduced normal form (or just normal form, when the context is clear) of an expression is the result of evaluating all reducible subexpressions in the given expression. Due to the non-strict semantics of Haskell (typically called laziness), a subexpression is not reducible if it is under a binder (i.e. a lambda abstraction - In other words, it does not matter (in terms of denotational semantics) in which order you reduce subexpressions. However, the key to writing performant Haskell programs is often ensuring that the right expression is evaluated at the right time, i.e, the understanding the operational semantics. An expression whose normal form is itself is said to be in normal form. Some expressions, e.g. Weak head normal formThe RNF corresponds to fully evaluating an expression - likewise, the weak head normal form (WHNF) corresponds to evaluating to the head of the expression. The head of an expression The evaluation semantics of Haskell can be described in terms of the WHNF - to evaluate an expression The primitive In which in which case the constructor |
| Strict fields In a Strict fields can be used in both record and non-record types: |
Read Article
https://develop.horje.com/learn/1434/reference