Homepage
Please support this book:
buy it
or
donate
(Ad, please don’t block.)
Exploring ReasonML
Table of contents
I Background
1 About this book
1.1 Questions and answers about this book
1.2 Warning: This book is outdated
1.3 About the cover
2 What is ReasonML?
2.1 What is ReasonML?
2.2 The benefits of OCaml
2.3 Improving OCaml
2.4 Conclusion
3 Getting started with ReasonML
3.1 Installation
3.2 Quickly trying out ReasonML
3.3 Template projects
3.4 Important tip: converting OCaml to ReasonML
4 What is planned for ReasonML?
5 FAQ: ReasonML
5.1 Where is module
Str
in BuckleScript?
II Core language
6 A first look at ReasonML’s syntax
6.1 Most things are expressions
6.2 Semicolons matter
6.3 Everything is camel-cased in ReasonML
6.4 Special prefixes and suffixes for variable names
7 Basic values and types
7.1 Interactions in
rtop
7.2 ReasonML is statically typed – what does that mean?
7.3 Comments
7.4 Booleans
7.5 Numbers
7.6 Strings
7.7 Characters
7.8 The unit type
7.9 Converting between basic types
7.10 More operators
8
let
bindings and scopes
8.1 Normal
let
bindings
8.2 Redefining variables
8.3 Type annotations
8.4 Creating new scopes via scope blocks
9 Pattern matching: destructuring,
switch
,
if
expressions
9.1 Digression: tuples
9.2 Pattern matching
9.3 Pattern matching via
let
(destructuring)
9.4
switch
9.5
if
expressions
9.6 The ternary operator (
_?_:_
)
10 Functions
10.1 Defining functions
10.2 Single parameters without parentheses
10.3 Recursive bindings via
let rec
10.4 Terminology: arity
10.5 The types of functions
10.6 There are no functions without parameters
10.7 Destructuring function parameters
10.8 Labeled parameters
10.9 Optional parameters
10.10 Partial application
10.11 The reverse-application operator (
|>
)
10.12 Tips for designing function signatures
10.13 Single-argument match functions
10.14 (Advanced)
10.15 Operators
10.16 Polymorphic functions
10.17 ReasonML does not support variadic functions
11 Basic modules
11.1 Installing the demo repository
11.2 Your first ReasonML program
11.3 Two simple modules
11.4 Controlling how values are exported from modules
11.5 Importing values from modules
11.6 Namespacing modules
11.7 Exploring the standard library
11.8 Installing libraries
12 Variant types
12.1 Variants as sets of symbols (enums)
12.2 Variants as data structures
12.3 Self-recursive data structures via variants
12.4 Mutually recursive data structures via variants
12.5 Parameterized variants
12.6 Useful standard variants
13 Polymorphic variant types
13.1 What are polymorphic variants?
13.2 Writing extensible code with polymorphic variants
13.3 Best practices: normal variants vs. polymorphic variants
13.4 (Advanced)
13.5 Type constraints for type variables
13.6 Type constraints for polymorphic variants
13.7 What do type constraints match?
13.8 Inferred type constraints
13.9 Type inference uses unification (which is bi-directional)
13.10 Monomorphic type vs. constraint
13.11 Material
14 Lists
14.1 Brief excursion: type signatures
14.2 Standard library functionality for lists and arrays
14.3 The structure of lists
14.4 Examples: creating lists
14.5 Examples: reading lists
14.6 Examples: changing lists
14.7 Standard library functions for lists
14.8 What to read next
15 Arrays
15.1 Lists vs. arrays
15.2 Creating arrays
15.3 Getting the length of an array
15.4 Reading and writing array elements
15.5 Pattern matching and arrays
15.6 Converting between lists and arrays
15.7 Processing arrays
16 Records
16.1 What are records?
16.2 Basic use
16.3 Records in other modules
16.4 FAQ: records
17 Functors (advanced)
17.1 What are functors?
17.2 A first functor
17.3 Functors for data structures
17.4 Functors for extending modules
17.5 Material
III Functional programming techniques
18 Recursion
18.1 Required knowledge
18.2 Processing data via recursive function calls
18.3 Looping via recursion
18.4 Looping via higher-order helper functions
18.5 Recursive technique: accumulator
18.6 Tail call elimination
IV Miscellaneous topics
19 What to read next?
20 Where are the remaining chapters?