The Notes for Professionals book is compiled from Stack Overflow Documentation, the content is written by the beautiful people at Stack Overflow. Text content is released under Creative Commons BY-SA. See credits at the end of this book whom contributed to the various chapters. Images may be copyright of their respective owners unless otherwise specified
Book created for educational purposes and is not affiliated with group(s), company(s) nor Stack Overflow. All trademarks belong to their respective company owners
https://goalkicker.com/
Content
1-1
Content list
1-2
About
1-3
Chapter 1: Getting started with Haskell Language
1-4
Section 1.1: Getting started
1-5
Section 1.2: Hello, World!
1-6
Section 1.3: Factorial
1-7
Section 1.4: Fibonacci, Using Lazy Evaluation
1-8
Section 1.5: Primes
1-9
Section 1.6: Declaring Values
1-10
Chapter 2: Overloaded Literals
1-11
Section 2.1: Strings
1-12
Section 2.2: Floating Numeral
1-13
Section 2.3: Integer Numeral
1-14
Section 2.4: List Literals
1-15
Chapter 3: Foldable
1-16
Section 3.1: Definition of Foldable
1-17
Section 3.2: An instance of Foldable for a binary tree
1-18
Section 3.3: Counting the elements of a Foldable structure
1-19
Section 3.4: Folding a structure in reverse
1-20
Section 3.5: Flattening a Foldable structure into a list
1-21
Section 3.6: Performing a side-eect for each element of a Foldable structure
1-22
Section 3.7: Flattening a Foldable structure into a Monoid
1-23
Section 3.8: Checking if a Foldable structure is empty
1-24
Chapter 4: Traversable
1-25
Section 4.1: Definition of Traversable
1-26
Section 4.2: Traversing a structure in reverse
1-27
Section 4.3: An instance of Traversable for a binary tree
1-28
Section 4.4: Traversable structures as shapes with contents
1-29
Section 4.5: Instantiating Functor and Foldable for a Traversable structure
1-30
Section 4.6: Transforming a Traversable structure with the aid of an accumulating parameter
1-31
Section 4.7: Transposing a list of lists
1-32
Chapter 5: Lens
1-33
Section 5.1: Lenses for records
1-34
Section 5.2: Manipulating tuples with Lens
1-35
Section 5.3: Lens and Prism
1-36
Section 5.4: Stateful Lenses
1-37
Section 5.5: Lenses compose
1-38
Section 5.6: Writing a lens without Template Haskell
1-39
Section 5.7: Fields with makeFields
1-40
Section 5.8: Classy Lenses
1-41
Section 5.9: Traversals
1-42
Chapter 6: QuickCheck
1-43
Section 6.1: Declaring a property
1-44
Section 6.2: Randomly generating data for custom types
1-45
Section 6.3: Using implication (==>) to check properties with preconditions
1-46
Section 6.4: Checking a single property
1-47
Section 6.5: Checking all the properties in a file
1-48
Section 6.6: Limiting the size of test data
1-49
Chapter 7: Common GHC Language Extensions
1-50
Section 7.1: RankNTypes
1-51
Section 7.2: OverloadedStrings
1-52
Section 7.3: BinaryLiterals
1-53
Section 7.4: ExistentialQuantification
1-54
Section 7.5: LambdaCase
1-55
Section 7.6: FunctionalDependencies
1-56
Section 7.7: FlexibleInstances
1-57
Section 7.8: GADTs
1-58
Section 7.9: TupleSections
1-59
Section 7.10: OverloadedLists
1-60
Section 7.11: MultiParamTypeClasses
1-61
Section 7.12: UnicodeSyntax
1-62
Section 7.13: PatternSynonyms
1-63
Section 7.14: ScopedTypeVariables
1-64
Section 7.15: RecordWildCards
1-65
Chapter 8: Free Monads
1-66
Section 8.1: Free monads split monadic computations into data structures and interpreters
1-67
Section 8.2: The Freer monad
1-68
Section 8.3: How do foldFree and iterM work?
1-69
Section 8.4: Free Monads are like fixed points
1-70
Chapter 9: Type Classes
1-71
Section 9.1: Eq
1-72
Section 9.2: Monoid
1-73
Section 9.3: Ord
1-74
Section 9.4: Num
1-75
Section 9.5: Maybe and the Functor Class
1-76
Section 9.6: Type class inheritance: Ord type class
1-77
Chapter 10: IO
1-78
Section 10.1: Getting the 'a' "out of" 'IO a'
1-79
Section 10.2: IO defines your program's `main` action
1-80
Section 10.3: Checking for end-of-file conditions
1-81
Section 10.4: Reading all contents of standard input into a string
1-82
Section 10.5: Role and Purpose of IO
1-83
Section 10.6: Writing to stdout
1-84
Section 10.7: Reading words from an entire file
1-85
Section 10.8: Reading a line from standard input
1-86
Section 10.9: Reading from `stdin`
1-87
Section 10.10: Parsing and constructing an object from standard input
1-88
Section 10.11: Reading from file handles
1-89
Chapter 11: Record Syntax
1-90
Section 11.1: Basic Syntax
1-91
Section 11.2: Defining a data type with field labels
1-92
Section 11.3: RecordWildCards
1-93
Section 11.4: Copying Records while Changing Field Values
1-94
Section 11.5: Records with newtype
1-95
Chapter 12: Partial Application
1-96
Section 12.1: Sections
1-97
Section 12.2: Partially Applied Adding Function
1-98
Section 12.3: Returning a Partially Applied Function
1-99
Chapter 13: Monoid
1-100
Section 13.1: An instance of Monoid for lists
1-101
Section 13.2: Collapsing a list of Monoids into a single value
1-102
Section 13.3: Numeric Monoids
1-103
Section 13.4: An instance of Monoid for ()
1-104
Chapter 14: Category Theory
1-105
Section 14.1: Category theory as a system for organizing abstraction
1-106
Section 14.2: Haskell types as a category
1-107
Section 14.3: Definition of a Category
1-108
Section 14.4: Coproduct of types in Hask
1-109
Section 14.5: Product of types in Hask
1-110
Section 14.6: Haskell Applicative in terms of Category Theory
1-111
Chapter 15: Lists
1-112
Section 15.1: List basics
1-113
Section 15.2: Processing lists
1-114
Section 15.3: Ranges
1-115
Section 15.4: List Literals
1-116
Section 15.5: List Concatenation
1-117
Section 15.6: Accessing elements in lists
1-118
Section 15.7: Basic Functions on Lists
1-119
Section 15.8: Transforming with `map`
1-120
Section 15.9: Filtering with `filter`
1-121
Section 15.10: foldr
1-122
Section 15.11: Zipping and Unzipping Lists
1-123
Section 15.12: foldl
1-124
Chapter 16: Sorting Algorithms
1-125
Section 16.1: Insertion Sort
1-126
Section 16.2: Permutation Sort
1-127
Section 16.3: Merge Sort
1-128
Section 16.4: Quicksort
1-129
Section 16.5: Bubble sort
1-130
Section 16.6: Selection sort
1-131
Chapter 17: Type Families
1-132
Section 17.1: Datatype Families
1-133
Section 17.2: Type Synonym Families
1-134
Section 17.3: Injectivity
1-135
Chapter 18: Monads
1-136
Section 18.1: Definition of Monad
1-137
Section 18.2: No general way to extract value from a monadic computation
1-138
Section 18.3: Monad as a Subclass of Applicative
1-139
Section 18.4: The Maybe monad
1-140
Section 18.5: IO monad
1-141
Section 18.6: List Monad
1-142
Section 18.7: do-notation
1-143
Chapter 19: Stack
1-144
Section 19.1: Profiling with Stack
1-145
Section 19.2: Structure
1-146
Section 19.3: Build and Run a Stack Project
1-147
Section 19.4: Viewing dependencies
1-148
Section 19.5: Stack install
1-149
Section 19.6: Installing Stack
1-150
Section 19.7: Creating a simple project
1-151
Section 19.8: Stackage Packages and changing the LTS (resolver) version
1-152
Chapter 20: Generalized Algebraic Data Types
1-153
Section 20.1: Basic Usage
1-154
Chapter 21: Recursion Schemes
1-155
Section 21.1: Fixed points
1-156
Section 21.2: Primitive recursion
1-157
Section 21.3: Primitive corecursion
1-158
Section 21.4: Folding up a structure one layer at a time
1-159
Section 21.5: Unfolding a structure one layer at a time
1-160
Section 21.6: Unfolding and then folding, fused
1-161
Chapter 22: Data.Text
1-162
Section 22.1: Text Literals
1-163
Section 22.2: Checking if a Text is a substring of another Text
1-164
Section 22.3: Stripping whitespace
1-165
Section 22.4: Indexing Text
1-166
Section 22.5: Splitting Text Values
1-167
Section 22.6: Encoding and Decoding Text
1-168
Chapter 23: Using GHCi
1-169
Section 23.1: Breakpoints with GHCi
1-170
Section 23.2: Quitting GHCi
1-171
Section 23.3: Reloading a already loaded file
1-172
Section 23.4: Starting GHCi
1-173
Section 23.5: Changing the GHCi default prompt
1-174
Section 23.6: The GHCi configuration file
1-175
Section 23.7: Loading a file
1-176
Section 23.8: Multi-line statements
1-177
Chapter 24: Strictness
1-178
Section 24.1: Bang Patterns
1-179
Section 24.2: Lazy patterns
1-180
Section 24.3: Normal forms
1-181
Section 24.4: Strict fields
1-182
Chapter 25: Syntax in Functions
1-183
Section 25.1: Pattern Matching
1-184
Section 25.2: Using where and guards
1-185
Section 25.3: Guards
1-186
Chapter 26: Functor
1-187
Section 26.1: Class Definition of Functor and Laws
1-188
Section 26.2: Replacing all elements of a Functor with a single value
1-189
Section 26.3: Common instances of Functor
1-190
Section 26.4: Deriving Functor
1-191
Section 26.5: Polynomial functors
1-192
Section 26.6: Functors in Category Theory
1-193
Chapter 27: Testing with Tasty
1-194
Section 27.1: SmallCheck, QuickCheck and HUnit
1-195
Chapter 28: Creating Custom Data Types
1-196
Section 28.1: Creating a data type with value constructor parameters
1-197
Section 28.2: Creating a data type with type parameters
1-198
Section 28.3: Creating a simple data type
1-199
Section 28.4: Custom data type with record parameters
1-200
Chapter 29: Reactive-banana
1-201
Section 29.1: Injecting external events into the library
1-202
Section 29.2: Event type
1-203
Section 29.3: Actuating EventNetworks
1-204
Section 29.4: Behavior type
1-205
Chapter 30: Optimization
1-206
Section 30.1: Compiling your Program for Profiling
1-207
Section 30.2: Cost Centers
1-208
Chapter 31: Concurrency
1-209
Section 31.1: Spawning Threads with `forkIO`
1-210
Section 31.2: Communicating between Threads with `MVar`
1-211
Section 31.3: Atomic Blocks with Software Transactional Memory
1-212
Chapter 32: Function composition
1-213
Section 32.1: Right-to-left composition
1-214
Section 32.2: Composition with binary function
1-215
Section 32.3: Left-to-right composition
1-216
Chapter 33: Databases
1-217
Section 33.1: Postgres
1-218
Chapter 34: Data.Aeson - JSON in Haskell
1-219
Section 34.1: Smart Encoding and Decoding using Generics
1-220
Section 34.2: A quick way to generate a Data.Aeson.Value
1-221
Section 34.3: Optional Fields
1-222
Chapter 35: Higher-order functions
1-223
Section 35.1: Basics of Higher Order Functions
1-224
Section 35.2: Lambda Expressions
1-225
Section 35.3: Currying
1-226
Chapter 36: Containers - Data.Map
1-227
Section 36.1: Importing the Module
1-228
Section 36.2: Monoid instance
1-229
Section 36.3: Constructing
1-230
Section 36.4: Checking If Empty
1-231
Section 36.5: Finding Values
1-232
Section 36.6: Inserting Elements
1-233
Section 36.7: Deleting Elements
1-234
Chapter 37: Fixity declarations
1-235
Section 37.1: Associativity
1-236
Section 37.2: Binding precedence
1-237
Section 37.3: Example declarations
1-238
Chapter 38: Web Development
1-239
Section 38.1: Servant
1-240
Section 38.2: Yesod
1-241
Chapter 39: Vectors
1-242
Section 39.1: The Data.Vector Module
1-243
Section 39.2: Filtering a Vector
1-244
Section 39.3: Mapping (`map`) and Reducing (`fold`) a Vector
1-245
Section 39.4: Working on Multiple Vectors
1-246
Chapter 40: Cabal
1-247
Section 40.1: Working with sandboxes
1-248
Section 40.2: Install packages
1-249
Chapter 41: Type algebra
1-250
Section 41.1: Addition and multiplication
1-251
Section 41.2: Functions
1-252
Section 41.3: Natural numbers in type algebra
1-253
Section 41.4: Recursive types
1-254
Section 41.5: Derivatives
1-255
Chapter 42: Arrows
1-256
Section 42.1: Function compositions with multiple channels
1-257
Chapter 43: Typed holes
1-258
Section 43.1: Syntax of typed holes
1-259
Section 43.2: Semantics of typed holes
1-260
Section 43.3: Using typed holes to define a class instance
1-261
Chapter 44: Rewrite rules (GHC)
1-262
Section 44.1: Using rewrite rules on overloaded functions
1-263
Chapter 45: Date and Time
1-264
Section 45.1: Finding Today's Date
1-265
Section 45.2: Adding, Subtracting and Comparing Days
1-266
Chapter 46: List Comprehensions
1-267
Section 46.1: Basic List Comprehensions
1-268
Section 46.2: Do Notation
1-269
Section 46.3: Patterns in Generator Expressions
1-270
Section 46.4: Guards
1-271
Section 46.5: Parallel Comprehensions
1-272
Section 46.6: Local Bindings
1-273
Section 46.7: Nested Generators
1-274
Chapter 47: Streaming IO
1-275
Section 47.1: Streaming IO
1-276
Chapter 48: Google Protocol Buers
1-277
Section 48.1: Creating, building and using a simple .proto file
1-278
Chapter 49: Template Haskell & QuasiQuotes
1-279
Section 49.1: Syntax of Template Haskell and Quasiquotes
1-280
Section 49.2: The Q type
1-281
Section 49.3: An n-arity curry
1-282
Chapter 50: Phantom types
1-283
Section 50.1: Use Case for Phantom Types: Currencies
1-284
Chapter 51: Modules
1-285
Section 51.1: Defining Your Own Module
1-286
Section 51.2: Exporting Constructors
1-287
Section 51.3: Importing Specific Members of a Module
1-288
Section 51.4: Hiding Imports
1-289
Section 51.5: Qualifying Imports
1-290
Section 51.6: Hierarchical module names
1-291
Chapter 52: Tuples (Pairs, Triples, ...)
1-292
Section 52.1: Extract tuple components
1-293
Section 52.2: Strictness of matching a tuple
1-294
Section 52.3: Construct tuple values
1-295
Section 52.4: Write tuple types
1-296
Section 52.5: Pattern Match on Tuples
1-297
Section 52.6: Apply a binary function to a tuple (uncurrying)
1-298
Section 52.7: Apply a tuple function to two arguments (currying)
1-299
Section 52.8: Swap pair components
1-300
Chapter 53: Graphics with Gloss
1-301
Section 53.1: Installing Gloss
1-302
Section 53.2: Getting something on the screen
1-303
Chapter 54: State Monad
1-304
Section 54.1: Numbering the nodes of a tree with a counter
1-305
Chapter 55: Pipes
1-306
Section 55.1: Producers
1-307
Section 55.2: Connecting Pipes
1-308
Section 55.3: Pipes
1-309
Section 55.4: Running Pipes with runEect
1-310
Section 55.5: Consumers
1-311
Section 55.6: The Proxy monad transformer
1-312
Section 55.7: Combining Pipes and Network communication
1-313
Chapter 56: Infix operators
1-314
Section 56.1: Prelude
1-315
Section 56.2: Finding information about infix operators
1-316
Section 56.3: Custom operators
1-317
Chapter 57: Parallelism
1-318
Section 57.1: The Eval Monad
1-319
Section 57.2: rpar
1-320
Section 57.3: rseq
1-321
Chapter 58: Parsing HTML with taggy-lens and lens
1-322
Section 58.1: Filtering elements from the tree
1-323
Section 58.2: Extract the text contents from a div with a particular id
1-324
Chapter 59: Foreign Function Interface
1-325
Section 59.1: Calling C from Haskell
1-326
Section 59.2: Passing Haskell functions as callbacks to C code