diff --git a/HWP.org b/HWP.org index ef4f9e43..17f8442a 100644 --- a/HWP.org +++ b/HWP.org @@ -13,6 +13,27 @@ This is somehow a follow-up from Learn Haskell Fast and Hard. Which was more about being able to /play/ with Haskell than to /work/ with it. +This is also an experiment. +I'm not sure if it will be as positive as I hope. +This book try to be a good resource to learn Haskell but to speed up the +learning in the first part I'll skip the explanation about why Haskell does +things the way it does. +As a consequence if you don't keep in mind that there is *very good* reasons to +make some things way more difficult in Haskell than in other languages you +might miss the real reason. + +Also don't forget in the beginning you might only see what is more difficult or +harder to achieve in Haskell. +But for each thing harder keep in mind that there are very difficult things in +other languages that are solved extremely easily in Haskell. +And I personnally believe the things Haskell make easier are essential to reach +the best balance between speed, elegance, safety and pragmatism with regards to +any programming language I ever used before. + +So this book might be a bit raw. +And in fact not really "fun" unfortunately. +But it should be efficient. + This book is aimed to be one of the fastest way to learn how to be productive with Haskell. @@ -285,13 +306,13 @@ So be prepared that the actual learning route is jumping other classical learning steps you can find in other learning resources. Don't worry I'll do my best to make the jump as natural as possible. -* TODO Working like in any other language +* TODO Working like in any other language / Learning with examples We'll start by example first and all notion will be introduced as they appear. If you find confident you could feel free to skip some descriptions and explanations. -** Project 1: Guessing Game +** Basics -- Project 1: Guessing Game *** Init the project ☞ As a first projet a lot of new concept will be introduced. Don't be @@ -584,20 +605,19 @@ Now knowing if a code is potentially making any side effect is /explicit/. **** Strings in Haskell digression Generally working with string is something you do at the beginning of learning a -programming language. It is straightforward. In Haskell you have many different -choices when dealing with Strings depending on the context. +programming language. +It is straightforward. +In Haskell you have many different choices when dealing with Strings depending +on the context. But let just say that 95% of the time, you'll want to use =Text=. Here are all the possible choices: -- =String=: Just a list of =Char= very inefficient representation -- =Text=: UTF-16 strings and also =Lazy.Text= -- =Bytestring=: Raw stream of =Char= and also =Lazy.Bytestring= +- =String=: Just a list of =Char= very inefficient representation, +- =Text=: UTF-16 strings can be Lazy or Strict, +- =Bytestring=: Raw stream of =Char= and also =Lazy.Bytestring=. That is already 5 different choices. - -There is also other =String= implementation for example in the =Foundation= -package that is an attemps at making anoter starting point. In =Foundation= the strings are =UTF-8=. Mmmm so much choices. @@ -717,7 +737,7 @@ We see we can still make the program better. For example, the same question is asked twice in that example. Still, it works. -** TODO Use External Library (Ex: guess random numbers) +** TODO Use External Library -- Project 1 : use random numbers Let's write another slightly more complex example. Instead of guessing the age of somebody.