实例介绍
Haskell Programming From First Principles 函数式编程入门书籍
i already have a lot of experience with haskell, but Ive never felt confident in it the way this book has made me feel Alain oDea Real deal with @haskellbook is that you dont just learn Haskell; you get a hands on experience as to why functional programming works. -George Makrydakis One of my goals this year is to evangelize @haskellbook and @HaskellForMac. i think these tools will make anyone who uses them better i want to get comfortable with it so that I can shift how i think about Swift, -Janie Clayton Contents Reader feedback Contents Authors preface Acknowledgements XXV Introduction XXIX Why This book ⅹXX1X a few words to new programmers ⅹxx1V Haskevangelism What's in this book? Best practices for examples and exercises All You Need is lambda all You need is lambda 2 What is functional programming? 1.3 What is a function? 1.4 The structure of lambda terms 6 1.5 Beta reduction 9 1.6 Multiple arguments 14 Evaluation is simplification 20 Combinators CONTENTS 1.9 Divergence 22 1.10 Summary 23 1.1l Chapter exercises 24 1.12 Answers 27 1.13 Definitions 31 Follow-up resources 33 2 Hello, haskells 34 2.1 Hello. haskell 85 2.2 Interacting with Haskell code 36 2.8 Understanding expressions 40 24 Functions 43 2.5 Evaluation 47 2.6 Infix operators 51 2.7 Declaring values 57 2.8 Arithmetic functions in haskell 68 2.9 Parenthesization 78 2.10 Let and where 85 211 Chapter Exercises 89 2.12 Definitions 94 2.13 Follow-up resources 96 3 Strings 98 8.1 Printing strings 99 82 A first look at types 99 8.3 Printing simple strings 101 CONTENTS 8.4 Top-level versus local definitions 108 8.5 ypes of concatenation functions 8.6 Concatenation and scoping 116 8.7 More list functions 119 8.8 Chapter Exercises 122 8.9 Definitions 128 4 Basic datatypes 180 4.1 Basic Datatypes 18l 4.2 What are types? 182 4.8 anatomy of a data declaration 182 Numeric types ,,,136 4.5 Comparing values 145 4.6 Go on and bool me 150 Tuples 159 Lists 163 4.9 Chapter exercises 165 4.10 Definitions 170 4.1 Names and variables 173 5 T ypes 176 5.1 ypes 177 5.2 What are types for? 178 5.3 How to read type signatures 180 5.4 Currying ,,,,,,,,,,,,,,,,,,,,,,190 5.5 Polymorphism:…. 206 CONTENTS 5.6 ype inference 215 5.7 Asserting types for declarations 220 5.8 Chapter Exercises 228 5.9 Definitions 237 5.10 Follow-up resources 244 6 Typeclasses 245 6.1 ypeclasses 246 6.2 What are type classes 246 6.3 Back to bool 248 6.4 eq 250 6.5 Writing typeclass instances 255 6.6 Num 271 67 ype-defaulting typeclasses 276 6.8 Ord 282 6.9 Enum 292 6.l0 Show 294 6.11 R ead 80l 6.12 Instances are dispatched by type 802 618 Gimme more operations ,,,,,807 6.14 Chapter Exercises 312 6.15 Chapter Definitions 321 6.16 Typeclass inheritance, partial 324 6.l7 Follow-up resources 324 More functional patterns 326 CONTENTS 7.1 Make it func-y 827 7.2 Arguments and parameters 827 7.3 Anonymous functions 837 7.4 Pattern matchi ng 342 75 Case expressions 356 76 Higher-order functions 360 77 Guards 878 78 Function composition 882 79 Pointfree style 888 710 Demonstrating composition 392 711 Chapter exercises 896 712 Chapter definitions 401 713 Follow-up resources 411 8 Recursion 413 8.1 Recursion 414 8.2 Factorial 415 8.8 Bottom 425 8.4 Fibonacci numbers 429 8.5 Integral division from scratch 435 8.6 Chapter Exercises 442 8.7 Definitions ,,449 9 Lists 450 9.1 Lists,,,,,,,,,,,,,,,,,,,,,,,,,,,,451 9.2 The list datatype 451 CONTENTS 9.3 Pattern matching on lists 453 9.4 List's syntactic sugar 456 9.5 Using ranges to construct lists 458 9.6 Extracting portions of lists 461 9.7 List comprehensions 468 9.8 Spines and nonstrict evaluation 4/5 9.9 Transforming lists of values 490 9.10 Filtering lists of values 501 Zipping lists 508 9.12 Chapter exercises 507 913 Definitions 516 9.14 Follow-up resources 519 Folding lists 520 10.1 Folds 521 10.2 Bringing you into the fold 521 10.3 Recursive patterns 528 10.4 Fold right 525 10.5 Fold left 537 10.6 How to write fold functions ,,,,,550 10.7 Folding and evaluation 557 108 Summary 559 10.9 Scans 56l 10.10 Chapter exercises 566 10.l1 Definitions 572 10.12 Follow-up resources 575 CONTENTS IX Algebraic datatypes 576 Algebraic datatypes 577 11.2 Data declarations review 578 11.3 Data and type constructors 580 11.4 Type constructors and kinds ,,,588 11.5 Data constructors and values 5 85 11.6 What's a type and what's data 591 Data constructor arities 597 11.8 What makes these datatypes algebraic? 60l 11.9 newtype ....607 1.10 Sum type 614 11.1l Product types 618 11.12 Normal form 628 l1.13 Constructing and deconstructing values 629 11 14 Function type is exponential 652 11. 15 Higher-kinded datatypes 660 l1.16 Lists are polymorphic 668 11.17 Binary tree 668 l1.l8 Chapter exercises 676 l1.l9 Definitions 688 12 Signaling adversity 689 12.1 Signaling adversity 690 12.2 How I learned to stop worrying and love Nothing 690 12.8 Bleating either 694 124 Kinds, a thousand stars in your types 704 【实例截图】
【核心代码】
标签:
相关软件
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论