舉報

會員
Learn Type:Driven Development
Type-drivendevelopmentisanapproachthatusesastatictypesystemtoachieveresultsincludingsafetyandefficiency.Typesareusedtoexpressrelationshipsandotherassumptionsdirectlyinthecode,andtheseassumptionsareenforcedbythecompilerbeforethecodeisrun.LearnType-DrivenDevelopmentcovershowtousethesetypesystemstocheckthelogicalconsistencyofyourcode.Thisbookbeginswiththebasicideabehindtype-drivendevelopment.You’lllearnaboutvalues(orterms)andhowtheycontrastwithtypes.Asyouprogressthroughthechapters,you’llcoverhowtocombinetypesandvaluesinsidemodulesandbuildstructuredtypesoutofsimplerones.You’llthenunderstandhowtoexpresschoicesoralternativesdirectlyinthetypesystemusingvariants,polymorphicvariants,andgeneralizedalgebraicdatatypes.You’llalsogettogripswithsumtypes,buildsophisticateddatatypesfromgenerics,andexplorefunctionsthatexpresschangeinthetypesofvalues.Intheconcludingchapters,you’llcoveradvancedtechniquesforcodereuse,suchasparametricpolymorphismandsubtyping.Byendofthisbook,youwillhavelearnedhowtoiteratethroughatype-drivenprocessofsolvingcodingproblemsusingstatictypes,togetherwithdynamicbehavior,toobtainmoresafetyandspeed.
目錄(146章)
倒序
- coverpage
- Title Page
- Copyright and Credits
- Learn Type-Driven Development
- Packt Upsell
- Why subscribe?
- Packt.com
- Contributors
- About the authors
- About the reviewer
- Packt is searching for authors like you
- Preface
- Who this book is for
- What this book covers
- To get the most out of this book
- Download the example code files
- Conventions used
- Get in touch
- Reviews
- Starting Type-Driven Development
- Analyzing code for hidden errors
- Adding types
- ReasonML
- Why ReasonML?
- Getting started with ReasonML
- Using Try Reason
- Going further
- Summary
- Programming with Types and Values
- Workflow
- Types and values
- Static types
- What do you gain?
- Static and dynamic environments
- Values
- Scoping and shadowing
- Understanding type erasure
- Errors
- Syntax errors
- Type errors and inference
- Summary
- Packaging Types and Values Together
- File modules
- Syntactic modules
- Using a syntactic module
- Module signatures
- Exporting and documenting the public API
- Syntactic module signatures
- Module errors
- Signature mismatch
- Value can't be found
- Type abstraction
- Zero-allocation type abstraction
- Preventing type mix-ups
- Summary
- Grouping Values Together in Types
- Record types
- Record literals
- Accessing fields and dealing with errors
- Changing record values
- Immutable updates
- Mutable record fields
- Record patterns
- Tuple types
- Accessing tuple values
- Destructuring pattern matching
- Accessor functions
- Object types
- Inheritance and subtyping
- JavaScript object types
- Summary
- Putting Alternative Values in Types
- Variant types
- Pattern matching
- The power of switch
- Refutable patterns
- The when clause and general branching
- Stricter safety checks
- Polymorphic variant types
- Creating and typing values
- Inputting values into functions
- Understanding polymorphic variant inference
- Outputting values from functions
- Generalized algebraic data types
- Designing for correctness with types
- Products and sums together
- Recursive types
- Summary
- Making Types That Can Slot into Any Other Type
- Type inference and generic types
- The special case of interpolation
- Type parameters
- The list – modeling more than one
- The option – modeling either none or one
- Mutable parameterized types – ref and array
- Managing a reference to a value
- Managing an array of values
- Mutation and type inference restrictions
- Forcing a difference with phantom types
- Summary
- Making Types That Represent Operations
- Function types and other useful properties
- Referential transparency
- Function purity
- Totality
- What a function type means
- Multiple arguments and currying
- Functions as values
- Function literal syntax
- Eta abstraction
- Summary
- Reusing Code with Many Different Types
- Polymorphism in Reason
- Generic functions with parametric polymorphism
- Ad hoc polymorphism or overloading
- Generic code with functors
- What is a functor?
- Example 1 – looking in the standard library
- Example 2
- Example 3
- Summary
- Extending Types with New Behavior
- Subtyping using polymorphic variants
- Reusing constructors for different types
- An example of polymorphic variant type extension
- More about extending polymorphic variant types
- Code reuse with OOP-style inheritance
- Opening a module
- Including a module
- Summary
- Bringing It All Together
- Starting with a variant type (version 1)
- Using more pattern matching (version 2)
- Switching to polymorphic variant types (version 3)
- Using records (version 4)
- Using modules for code structure (version 5)
- An alternative code structure (version 6)
- An improvement – using lists as output (version 7)
- Another improvement – using mutable records (version 8)
- Unit testing our code (final version)
- Creating our final package and setting up for tests
- Writing our first tests
- Running the tests
- Summary
- Other Books You May Enjoy
- Leave a review - let other readers know what you think 更新時間:2021-07-02 14:41:45
推薦閱讀
- Python快樂編程:人工智能深度學習基礎
- FLL+WRO樂高機器人競賽教程:機械、巡線與PID
- Building an RPG with Unity 2018
- RabbitMQ Cookbook
- Express Web Application Development
- Python之光:Python編程入門與實戰(zhàn)
- Visualforce Developer’s guide
- Kubernetes源碼剖析
- C++編程兵書
- Mastering Adobe Captivate 7
- 黑莓(BlackBerry)開發(fā)從入門到精通
- Elasticsearch Blueprints
- 樹莓派開發(fā)從零開始學:超好玩的智能小硬件制作書
- PHP典型模塊與項目實戰(zhàn)大全
- Image Processing with ImageJ(Second Edition)
- Instant OpenCV for iOS
- Kudu:構建高性能實時數(shù)據(jù)分析存儲系統(tǒng)
- Application Testing with Capybara
- MATLAB程序設計及應用
- 零基礎學Visual Basic第2版
- Unreal Engine Game Development Blueprints
- Getting Started with Oracle WebLogic Server 12c:Developer’s Guide
- Ionic:Hybrid Mobile App Development
- MATLAB數(shù)值分析與應用
- Getting Started with Twitter Flight
- Swift 4 Programming Cookbook
- Python青少年編程魔法課堂:案例+視頻教學版
- Python 網(wǎng)絡爬蟲實戰(zhàn)
- 程序員代碼面試指南:IT名企算法與數(shù)據(jù)結構題目最優(yōu)解(第2版)
- 硅谷設計之道:探尋硅谷科技公司的體驗設計策略