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...

Descripción completa

Detalles Bibliográficos
Otros Autores: Yang, Danny, author (author)
Formato: Libro electrónico
Idioma:Inglés
Publicado: New York, New York : Apress [2023]
Materias:
Ver en Biblioteca Universitat Ramon Llull:https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009711809406719
Tabla de Contenidos:
  • 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
  • Advanced Topic: Generic Hash Set/Hash Map Keys
  • Dict
  • Creating a Dict
  • Accessing a Dict
  • Updating a Dict
  • Serializing a Dict
  • Which Collection Should I Use?
  • Chapter 7: Modules
  • Files as Modules
  • Defining Modules
  • Using Modules
  • Opening Modules
  • Destructuring a Module
  • Module Examples
  • Module Signatures
  • Interface Files
  • Defining Module Signatures
  • Functors
  • Defining and Using Functors
  • Extending Modules
  • Functors in the Standard Library
  • Final Thoughts
  • Chapter 8: JavaScript Interoperability
  • Calling JavaScript from ReScript
  • Embedding Raw JavaScript in ReScript Files
  • Calling ReScript from JavaScript
  • Exporting Values from ReScript
  • Using ReScript Modules from JavaScript
  • Shared Data Types
  • Integers.
  • Functions
  • Options
  • Other Data Types
  • Immutable Data Structures
  • Variants
  • Polymorphic Variants
  • Working with Null
  • Working with Exceptions
  • Catching ReScript Exceptions in JavaScript
  • Catching JavaScript Exceptions in ReScript
  • Working with JSON
  • Option 1: Binding Without Types
  • Option 2: Binding With Types
  • Option 3: With Validation
  • Putting It All Together: Simple ReScript Web App
  • Version 1: Handwritten Bindings
  • Client
  • Client Bundling
  • Server
  • Running the Demo
  • Version 2: Using Imported Bindings
  • Client
  • Server
  • Final Thoughts
  • Index.