Introducing Rescript : functional programming for web applications /
This book serves as a succinct guide on ReScript, a functional language for building web applications. Using examples of ReScript language features along with explanations of fundamental concepts in functional programming, this book will show web developers with a background in JavaScript how to eff...
| Main Author: | |
|---|---|
| Format: | eBook |
| Language: | English |
| Published: |
Berkeley, CA :
Apress L. P.,
[2023]
|
| Subjects: | |
| Online Access: | Connect to the full text of this electronic book |
Table of Contents:
- Intro
- Table of Contents
- About the Author
- About the Technical Reviewer
- Introduction
- Chapter 1: ReScript Basics
- Expressions, Values, and Side Effects
- Compile Time and Runtime
- Types, Typechecking, and Type Inference
- Primitive Types and Operators
- Integer and Float
- Boolean
- String
- Unit
- Printing and Debugging
- Bindings
- Mutation and Refs
- Blocks
- Block Scoping
- Conditionals
- Switches
- Loops
- Putting It All Together
- Final Thoughts
- Chapter 2: Functions
- Defining and Using Functions
- Type Annotations
- Using Standard Library Functions and Opening Modules
- Higher-Order Functions
- Piping
- Labeled and Optional Parameters
- Currying and Partial Application
- Polymorphic Functions
- Pure Functions
- Ignoring Return Values
- Recursion
- Syntax
- How to Use Recursion
- Final Thoughts
- Chapter 3: Composite Data Types
- Tuples
- Creating Tuples
- Accessing Tuples
- Pattern Matching with Tuples
- Variants
- Declaring and Constructing Variants
- Pattern Matching with Variants
- Exhaustiveness
- Complex Patterns
- Variants with Data
- Recursive Data Types
- Options
- Pattern Matching Options
- Exceptions and Error Handling
- Raising Exceptions
- Catching Exceptions
- Custom Exceptions
- Another Way to Handle Errors: Result
- Result in Action
- Defining Errors for Results
- Composing Results
- Final Thoughts
- Chapter 4: Records and Objects
- Records
- Declaring and Creating Records
- Nominal Typing
- Accessing Record Fields
- Updating Records
- Mutable Fields
- Optional Fields
- Destructuring Records
- Pattern Matching with Records
- Records and Variants
- Printing Records
- Records and JSON
- Serialization
- Deserialization
- Objects
- Declaring and Creating Objects
- Accessing Object Fields
- Structural Typing
- Mutating Objects
- Printing Objects
- Objects and JSON
- Serializing Objects
- Deserializing Objects
- Objects vs. Records
- Chapter 5: Lists and Arrays
- Arrays
- Array Standard Library
- Note on Accessing Arrays
- Higher-Order Functions for Arrays
- Map
- Filter
- Reduce
- Composing Higher-Order Functions
- Higher-Order Functions in Action
- Generalizing Higher-Order Functions
- Lists
- Building a List
- Immutability and Lists
- Pattern Matching with List
- Higher-Order Functions with Lists
- Drawbacks of Lists
- Use Cases for Immutable Collections
- Lists vs. Arrays
- Final Thoughts
- Chapter 6: Collections
- Immutable Collections
- Immutable Sets
- Creating a Set
- Updating a Set
- Common Set Operations
- Immutable Maps
- Creating a Map
- Updating a Map
- Accessing a Map
- Using Collections: Luggage Example Revisited
- Advanced Topic: Generic Collections
- Mutable Collections
- Mutable Stack
- Mutable Queue
- Mutable Set and Mutable Map
- Mutable Map Example
- Hash Set and Hash Map
- Creating a Hash Set/Hash Map
- Accessing Hash Maps
- Hash Map Example