Notes on Haskell
HistoryVersion 1 (current)
The first version: all of its text is new.
| 1 | # Notes on Haskell | |
| 2 | ||
| 3 | The wiki is written in Haskell and compiled to WebAssembly; the page you are reading was rendered by `Wiki.Core` in your browser.[^wasm] | |
| 4 | ||
| 5 | ```haskell | |
| 6 | -- The slug a title suggests: lowercase ASCII, single dashes. | |
| 7 | slugify :: Text -> Maybe Slug | |
| 8 | ||
| 9 | fibonacci :: [Integer] | |
| 10 | fibonacci = 0 : 1 : zipWith (+) fibonacci (drop 1 fibonacci) | |
| 11 | ``` | |
| 12 | ||
| 13 | Laziness is what lets `fibonacci` be infinite: the $n$-th element is computed once something asks for it, and it grows like $\varphi^n$, where | |
| 14 | ||
| 15 | $$\varphi = \frac{1 + \sqrt{5}}{2}$$ | |
| 16 | ||
| 17 | [^wasm]: With GHC's WebAssembly backend, through haskell-halogen. |