- Learn Type:Driven Development
- Yawar Amin Kamon Ayeva
- 211字
- 2021-07-02 14:41:24
Using Try Reason
Reason provides a fantastic resource for learners: an online Reason-to-JavaScript compiler and evaluator. To access it, go to the Reason website and click Try in the navigation bar at the top. You can use it to quickly try out different ideas.
Let's run through a quick example using Try Reason to get our bearings. Type in the example code from src/Ch01/Ch01_Demo.re into the Reason section of the Try Reason web app. Now add the following line after that:
let bob = makePerson(1, "Bob");
Now if you examine the output JS, you should see that the following changes have been made:
- Types have been stripped away
- Records have been transformed into arrays without field names (records are roughly like C structs or JavaScript objects)
- Every declared value is explicitly exported (made public)
Note that we have purposely introduced very little actual Reason syntax in this chapter. If you are curious to explore the syntax (which is very similar to JavaScript at its core), it's best if you explore the excellent Reason website documentation. Since the focus of this book is type-driven development, in the upcoming chapters we will introduce all the syntax we will need and discuss its impact on our understanding of the code.
- Progressive Web Apps with React
- Spring Cloud Alibaba微服務架構設計與開發實戰
- 編程的修煉
- Mastering Adobe Captivate 2017(Fourth Edition)
- ASP.NET Core 5.0開發入門與實戰
- 單片機C語言程序設計實訓100例:基于STC8051+Proteus仿真與實戰
- Apache Hive Essentials
- 老“碼”識途
- Reactive Programming With Java 9
- Building Minecraft Server Modifications
- VMware虛擬化技術
- Visual Basic程序設計上機實驗教程
- Android開發三劍客:UML、模式與測試
- Python從入門到精通
- Buildbox 2.x Game Development