Muutke küpsiste eelistusi

Introducing ReScript: Functional Programming for Web Applications 1st ed. [Pehme köide]

  • Formaat: Paperback / softback, 263 pages, kõrgus x laius: 235x155 mm, kaal: 444 g, 8 Illustrations, black and white, 1 Paperback / softback
  • Ilmumisaeg: 28-Dec-2022
  • Kirjastus: APress
  • ISBN-10: 1484288874
  • ISBN-13: 9781484288870
  • Pehme köide
  • Hind: 34,97 €*
  • * hind on lõplik, st. muud allahindlused enam ei rakendu
  • Tavahind: 41,14 €
  • Säästad 15%
  • Raamatu kohalejõudmiseks kirjastusest kulub orienteeruvalt 3-4 nädalat
  • Kogus:
  • Lisa ostukorvi
  • Tasuta tarne
  • Tellimisaeg 2-4 nädalat
  • Lisa soovinimekirja
  • Formaat: Paperback / softback, 263 pages, kõrgus x laius: 235x155 mm, kaal: 444 g, 8 Illustrations, black and white, 1 Paperback / softback
  • Ilmumisaeg: 28-Dec-2022
  • Kirjastus: APress
  • ISBN-10: 1484288874
  • ISBN-13: 9781484288870
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 effectively use ReScript to its full potential.

In Introducing ReScript, you'll learn how to use features in ReScript that  JavaScript lacks, such as type inference, null-safety, algebraic data types, pattern matching, and more. Along the way, you'll pick up functional programming concepts like immutability and higher-order functions. You'll also gain a sense of how ReScript works under the hood and how to leverage interoperability between ReScript and JavaScript.  

Whether you're a web developer interested in dabbling with functional programming or you just want to learn how to write safer and cleaner code for web applications, this book is a great way for you to get started with ReScript.

What You Will Learn
  • Use ReScript to write clean, safe, and elegant software
  • Understand the features of ReScript that set it apart from JavaScript, such as type inference, null-safety, and algebraic data types
  • Explore functional programming concepts like immutabhigher-orderr order functions, and pattern matching
  • Use popular JavaScript libraries and frameworks in your ReScript code and integrate ReScript code into JavaScript codebases

Who This Book Is For

Web developers that want a strictly typed, safer alternative to JavaScript, as well as web developers interested in learning functional programming and leveraging the elegant and powerful functional features in ReScript.
About the Author ix
About the Technical Reviewer xi
Introduction xiii
Chapter 1 Rescript Basics
1(28)
Expressions, Values, and Side Effects
1(1)
Compile Time and Runtime
2(1)
Types, Typechecking, and Type Inference
2(1)
Primitive Types and Operators
3(5)
Integer and Float
3(2)
Boolean
5(1)
String
6(1)
Unit
7(1)
Printing and Debugging
8(1)
Bindings
9(3)
Mutation and Refs
10(2)
Blocks
12(2)
Block Scoping
14(1)
Conditionals
14(2)
Switches
16(5)
Loops
21(3)
Putting It Afr Together
24(3)
Final Thoughts
27(2)
Chapter 2 Functions
29(24)
Defining and Using Functions
29(14)
Type Annotations
31(1)
Using Standard Library Functions and Opening Modules
32(2)
Higher-Order Functions
34(1)
Piping
35(3)
Labeled and Optional Parameters
38(2)
Currying and Partial Application
40(2)
Polymorphic Functions
42(1)
Pure Functions
43(3)
Ignoring Return Values
44(2)
Recursion
46(6)
Syntax
46(2)
How to Use Recursion
48(4)
Final Thoughts
52(1)
Chapter 3 Composite Data Types
53(34)
Tuples
53(2)
Creating Tuples
54(1)
Accessing Tuples
55(6)
Pattern Matching with Tuples
57(4)
Variants
61(11)
Declaring and Constructing Variants
61(1)
Pattern Matching with Variants
62(1)
Exhaustiveness
62(1)
Complex Patterns
63(1)
Variants with Data
64(5)
Recursive Data Types
69(3)
Options
72(1)
Pattern Matching Options
73(3)
Exceptions and Error Handling
76(1)
Raising Exceptions
77(1)
Catching Exceptions
77(1)
Custom Exceptions
78(8)
Another Way to Handle Errors: Result
79(2)
Result in Action
81(1)
Defining Errors for Results
82(2)
Composing Results
84(2)
Final Thoughts
86(1)
Chapter 4 Records and Objects
87(22)
Records
87(14)
Declaring and Creating Records
88(1)
Nominal Typing
88(1)
Accessing Record Fields
89(1)
Updating Records
90(1)
Mutable Fields
91(1)
Optional Fields
91(1)
Destructuring Records
92(3)
Pattern Matching with Records
95(2)
Records and Variants
97(2)
Printing Records
99(1)
Records and JSON
100(1)
Objects
101(7)
Declaring and Creating Objects
102(1)
Accessing Object Fields
103(1)
Structural Typing
103(1)
Mutating Objects
104(1)
Printing Objects
105(1)
Objects and JSON
106(2)
Objects vs. Records
108(1)
Chapter 5 Lists and Arrays
109(32)
Arrays
109(1)
Array Standard Library
110(3)
Note on Accessing Arrays
111(2)
Higher-Order Functions for Arrays
113(15)
Map
113(3)
Filter
116(2)
Reduce
118(4)
Composing Higher-Order Functions
122(1)
Higher-Order Functions in Action
122(4)
Generalizing Higher-Order Functions
126(2)
Lists
128(5)
Building a List
128(1)
Immutability and Lists
129(1)
Pattern Matching with List
130(3)
Higher-Order Functions with Lists
133(8)
Drawbacks of Lists
136(1)
Use Cases for Immutable Collections
137(2)
Lists vs. Arrays
139(1)
Final Thoughts
139(2)
Chapter 6 Collections
141(32)
Immutable Collections
142(14)
Immutable Sets
143(3)
Immutable Maps
146(3)
Using Collections: Luggage Example Revisited
149(2)
Advanced Topic: Generic Collections
151(5)
Mutable Collections
156(15)
Mutable Stack
157(2)
Mutable Queue
159(2)
Mutable Set and Mutable Map
161(1)
Hash Set and Hash Map
162(2)
Advanced Topic: Generic Hash Set/Hash Map Keys
164(3)
Diet
167(4)
Which Collection Should I Use?
171(2)
Chapter 7 Modules
173(30)
Files as Modules
174(1)
Defining Modules
174(1)
Using Modules
175(7)
Opening Modules
177(4)
Destructuring a Module
181(1)
Module Examples
182(6)
Module Signatures
188(12)
Interface Files
189(1)
Defining Module Signatures
189(5)
Functors
194(1)
Defining and Using Functors
195(2)
Extending Modules
197(2)
Functors in the Standard Library
199(1)
Final Thoughts
200(3)
Chapter 8 JavaScript Interoperability
203(52)
Calling JavaScript from Rescript
203(5)
Embedding Raw JavaScript in Rescript Files
206(2)
Calling Rescript from JavaScript
208(3)
Exporting Values from Rescript
208(1)
Using Rescript Modules from JavaScript
209(2)
Shared Data Types
211(5)
Integers
213(1)
Functions
214(1)
Options
215(1)
Other Data Types
216(4)
Immutable Data Structures
216(1)
Variants
216(3)
Polymorphic Variants
219(1)
Working with Null
220(3)
Working with Exceptions
223(2)
Catching Rescript Exceptions in JavaScript
223(2)
Catching JavaScript Exceptions in Rescript
225(1)
Working with JSON
225(7)
Option 1 Binding Without Types
225(2)
Option 2 Binding With Types
227(1)
Option 3 With Validation
228(4)
Putting It All Together: Simple Rescript Web App
232(21)
Version 1 Handwritten Bindings
233(14)
Version 2 Using Imported Bindings
247(6)
Final Thoughts
253(2)
Index 255
Danny Yang is a professional software engineer at Meta working on infrastructure for WhatsApp. He has previously worked on Facebook Messenger, including the web interface which was written in ReScript. His technical interests include functional programming, compilers, and data visualization, which he writes about on his blog.