PureScript mediante ejemplos
PureScript mediante ejemplos
Programación funcional para la Web
Sobre este libro
PureScript es un pequeño lenguaje de programación fuertemente tipado con un sistema de tipos expresivo, escrito en (e inspirado por) Haskell, que compila a JavaScript.
La programación funcional en JavaScript está ganando popularidad recientemente, pero el desarrollo a gran escala está obstaculizado por la ausencia de un entorno disciplinado en el que escribir código. PureScript pretende resolver este problema trayendo la potencia de la programación funcional fuertemente tipada al mundo del desarrollo JavaScript.
Este libro te mostrará cómo empezar a desarrollar en el lenguaje de programación PureScript, desde lo más básico (establecer un entorno de desarrollo) hasta lo más avanzado.
Cada capítulo estará motivado por un problema particular, y en el curso de la resolución de ese problema se presentarán nuevas herramientas y técnicas de programación funcional. Aquí hay algunos ejemplos de los problemas que se resolverán en este libro:
- Transformar estructuras de datos con asociaciones y pliegues.
- Validación de campos de formulario usando funtores aplicativos.
- Verificación de código con QuickCheck.
- Usar el API Canvas.
- Implementación de lenguajes específicos del dominio.
- Trabajar con el DOM.
- Interoperabilidad con JavaScript.
- Tratar con el infierno de las retrollamadas (callbacks).
Tabla de contenido
-
Introducción
- JavaScript funcional
- Tipos e inferencia de tipos
- Programación web políglota
- Prerrequisitos
- Sobre ti
- Cómo leer este libro
- Consiguiendo ayuda
- Acerca del autor
- Acerca de la traducción
- Agradecimientos
-
Empezando
- Objetivos del capítulo
- Introducción
- Instalando PureScript
- Instalando las herramientas
- ¡Hola, PureScript!
- Compilando para el navegador
- Quitando código no usado
- Compilando módulos CommonJS
- Seguimiento de dependencias con Bower
- Calculando diagonales
- Probando el código usando el modo interactivo
- Conclusión
-
Funciones y registros (records)
- Objetivos del capítulo
- Preparación del proyecto
- Tipos simples
- Tipos cuantificados
- Notas sobre la sangría (indentation)
- Definiendo nuestros tipos
- Constructores de tipo (type constructors) y familias (kinds)
- Mostrando entradas de la agenda
- Prueba temprano, prueba a menudo
- Creando agendas
- Funciones currificadas (curried functions)
- Consultando la agenda
- Aplicación de funciones infija
- Composición de funciones
- Prueba, prueba, prueba…
- Conclusión
-
Recursividad, asociaciones (maps) y pliegues (folds)
- Objetivos del capítulo
- Preparación del proyecto
- Introducción
- Recursividad sobre arrays
- Asociaciones (maps)
- Operadores infijos
- Filtrando arrays
- Aplanando arrays
- Arrays por comprensión (array comprehensions)
- Notación ‘do’ (do notation)
- Guardas (guards)
- Pliegues (folds)
- Recursividad final (tail recursion)
- Acumuladores (accumulators)
- Prefiere pliegues a recursividad explícita
- Un sistema de ficheros virtual
- Listando todos los ficheros
- Conclusión
-
Ajuste de patrones (pattern matching)
- Objetivos del capítulo
- Preparación del proyecto
- Ajuste de patrones simple
- Patrones simples
- Guardas
- Patrones de array (array patterns)
- Patrones de registro (record patterns) y polimorfismo de fila (row polymorphism)
- Patrones anidados (nested patterns)
- Patrones nombrados (named patterns)
- Expresiones “case” (case expressions)
- Fallos de ajuste de patrones (pattern match failures) y funciones parciales (partial functions)
- Tipos de datos algebraicos (algebraic data types)
- Usando ADTs
- Doble sentido en registros (record puns)
- Newtypes
- Una biblioteca para gráficos vectoriales
- Calculando rectángulos de delimitación
- Conclusión
-
Clases de tipos (type classes)
- Objetivos del capítulo
- Preparación del proyecto
- Clases de tipos comunes
- Anotaciones de tipo (type annotations)
- Instancias superpuestas (overlapping instances)
- Dependencias de instancia (instance dependencies)
- Clases de tipos de varios parámetros (multi parameter type classes)
- Dependencias funcionales (functional dependencies)
- Clases de tipos nularias (nullary type classes)
- Superclases (superclasses)
- Una clase de tipos para funciones resumen
- Conclusión
-
Validación aplicativa (applicative validation)
- Objetivos del capítulo
- Preparación del proyecto
- Generalizando la aplicación de funciones
- Elevando funciones arbitrarias
- La clase de tipos Applicative
- Intuición para Applicative
- Más efectos
- Combinando efectos
- Validación aplicativa
- Validadores con expresiones regulares (regular expression validators)
- Funtores transitables (traversable functors)
- Funtores aplicativos para paralelismo
- Conclusión
-
La mónada Eff
- Objetivos del capítulo
- Preparación del proyecto
- La clase de tipos mónada
- Leyes de la mónada
- Plegando con mónadas
- Mónadas y aplicativos
- Efectos nativos (native effects)
- Efectos secundarios y pureza
- La mónada Eff
- Efectos extensibles (extensible effects)
- Intercalando efectos
- La familia de Eff
- Objetos y filas
- Efectos de grano fino (fine-grained effects)
- Gestores (handlers) y acciones (actions)
- Estado mutable
- Efectos DOM
- Una interfaz de usuario para la agenda
- Conclusión
-
Gráficos con Canvas
- Objetivos del capítulo
- Preparación del proyecto
- Formas simples
- Haciendo uso del polimorfismo de fila
- Dibujando círculos aleatorios
- Transformaciones
- Preservando el contexto
- Estado mutable global
- Sistemas-L
- Conclusión
-
Interfaz para funciones externas (foreign function interface)
- Objetivos del capítulo
- Preparación del proyecto
- Una advertencia
- Llamando a PureScript desde JavaScript
- Entendiendo la generación de nombres
- Representación de datos en tiempo de ejecución (runtime data representation)
- Representando ADTs
- Representando tipos cuantificados
- Representando tipos restringidos
- Usando código JavaScript desde PureScript
- Envolviendo valores JavaScript
- Definiendo tipos externos
- Funciones de múltiples argumentos
- Representando efectos secundarios
- Definiendo nuevos efectos
- Trabajando con datos no tipados
- Gestionando valores nulos e indefinidos
- Serialización genérica de JSON
- Conclusión
-
Aventuras monádicas
- Objetivos del capítulo
- Preparación del proyecto
- Cómo jugar
- La mónada State
- La mónada Reader
- La mónada Writer
- Transformadores de mónada (monad transformers)
- El transformador de mónada ExceptT
- Pilas de transformadores de mónada (monad transformer stacks)
- ¡Clases de tipos al rescate!
- Alternativas
- Mónadas por comprensión
- Retroceso (backtracking)
- La mónada RWS
- Implementando la lógica del juego
- Ejecutando el cálculo
- Gestionando opciones de línea de comandos
- Conclusión
-
El infierno de retrollamadas (callback hell)
- Objetivos del capítulo
- Preparación del proyecto
- El problema
- La mónada de continuación
- Poniendo ExceptT a trabajar
- Un cliente HTTP
- Cálculos paralelos
- Conclusión
-
Verificación generativa (generative testing)
- Objetivos del capítulo
- Preparación del proyecto
- Escribiendo propiedades
- Mejorando los mensajes de error
- Verificando código polimórfico
- Generando datos arbitrarios
- Probando funciones de orden mayor
- Escribiendo instancias de Coarbitrary
- Verificando sin efectos secundarios
- Conclusión
-
Lenguajes específicos del dominio (domain-specific languages)
- Objetivos del capítulo
- Preparación del proyecto
- Un tipo de datos HTML
- Constructores inteligentes (smart constructors)
- Tipos fantasma (phantom types)
- La mónada libre (free monad)
- Interpretando la mónada
- Extendiendo el lenguaje
- Conclusión
Causas que se apoyan

JOVESOLIDES (Jóvenes hacia la Solidaridad y Desarrollo)
Sumando ideas, transformamos el mundo
http://www.redjovesolides.orgLa Red Jovesolides trabaja en los ámbitos de la cooperación y el desarrollo, sensibilización y voluntariado y la inclusión social.
Leanpub incondicional, sin riesgo, 100% de felicidad garantizada
Durante los primeros 60 días de compra, puedes obtener un reembolso del 100% de cualquier compra Leanpub, en dos clics. Procesamos las restituciones manualmente, así que puede tomarse unos días en aparecer. Véase términos completos.
Que estés bien. Haz el bien.
Authors have earned$11,600,486writing, publishing and selling on Leanpub, earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.
Learn more about writing on Leanpub
Actualizaciones gratis. Libre de DRM.
¡Si compras un libro Leanpub obtienes actualizaciones gratis siempre y cuando el autor actualice el libro! Varios autores usan Leanpub para publicar sus libros en progreso mientras los escriben. Todos los lectores obtienen actualizaciones gratis, independientemente de cuándo compraron el libro o cuánto pagaron (incluyendo si fue gratis).
La mayoría de los libros Leanpub se encuentran disponibles en PDF (para computadores), EPUB (para teléfonos y tabletas) y MOBI (para Kindle). Los formatos que un libro incluye se muestran en la esquina superior derecha de esta página.
Finalmente, los libros Leanpub no tienen ninguna de las cosas sin sentido sobre protección de copia DRM, así que puedes leerlos fácilmente en cualquier dispositivo que se soporta.
Aprende más sobre los formatos de Leanpub y dónde puedes leerlos
Top Books
C++20 - The Complete Guide
Nicolai M. JosuttisAll new language and library features of C++20 (for those who know previous C++ versions).
The book presents all new language and library features of C++20. Learn how this impacts day-to-day programming, to benefit in practice, to combine new features, and to avoid all new traps.
Buy early, pay less, free updates.
Other books:
Jetpack Compose internals
Jorge CastilloJetpack Compose is the future of Android UI. Master how it works internally and become a more efficient developer with it. You'll also find it valuable if you are not an Android dev. This book provides all the details to understand how the Compose compiler & runtime work, and how to create a client library using them.
Cronache di Domain-Driven Design
Francesco Strazzullo, Matteo Baglini, Gianluca Padovani, Emanuele DelBono, Marco Consolaro, Alessandro Colla, Uberto Barbini, Alberto Acerbis, Julie Camosseto, DDD Open, and Alberto BrandoliniCronache di Domain-Driven Design: un libro corale in italiano fatto di storie indipendenti tra loro, che sono il risultato dell’applicazione di Domain-Driven Design su progetti reali.
Ansible for DevOps
Jeff GeerlingAnsible is a simple, but powerful, server and configuration management tool. Learn to use Ansible effectively, whether you manage one server—or thousands.
R Programming for Data Science
Roger D. PengThis book brings the fundamentals of R programming to you, using the same material developed as part of the industry-leading Johns Hopkins Data Science Specialization. The skills taught in this book will lay the foundation for you to begin your journey learning data science. Printed copies of this book are available through Lulu.
OpenIntro Statistics
David Diez, Christopher Barr, Mine Cetinkaya-Rundel, and OpenIntroA complete foundation for Statistics, also serving as a foundation for Data Science.
Leanpub revenue supports OpenIntro (US-based nonprofit) so we can provide free desk copies to teachers interested in using OpenIntro Statistics in the classroom and expand the project to support free textbooks in other subjects.
More resources: openintro.org.
Functional event-driven architecture: Powered by Scala 3
Gabriel VolpeExplore the event-driven architecture (EDA) in a purely functional way, mainly powered by Fs2 streams in Scala 3!
Leverage your functional programming skills by designing and writing stateless microservices that scale, powered by stateful message brokers.
Mastering STM32 - Second Edition
Carmine NovielloWith more than 1200 microcontrollers, STM32 is probably the most complete ARM Cortex-M platform on the market. This book aims to be the first guide around that introduces the reader to this exciting MCU portfolio from ST Microelectronics and its official CubeHAL and STM32CubeIDE development environment.
CCIE Service Provider Version 4 Written and Lab Exam Comprehensive Guide
Nicholas RussoThe service provider landscape has changed rapidly over the past several years. Networking vendors are continuing to propose new standards, techniques, and procedures for overcoming new challenges while concurrently reducing costs and delivering new services. Cisco has recently updated the CCIE Service Provider track to reflect these changes; this book represents the author's personal journey in achieving that certification.
CCIE SP v5.0
Łukasz Bromirski, Piotr Jablonski, and Nicholas RussoAre you striving to prepare to and pass CCIE SP lab exam? Take the opportunity and get this workbook! With the attached initial cfg files you will prepare yourself for the CCIE SP exam as well as learn SP technologies applicable to all kinds of today modern networks! This workbook covers blueprint topics and provides challenging examples.
Top Bundles
- #1
Software Architecture for Developers: Volumes 1 & 2 - Technical leadership and communication
2 Books
"Software Architecture for Developers" is a practical and pragmatic guide to modern, lightweight software architecture, specifically aimed at developers. You'll learn:The essence of software architecture.Why the software architecture role should include coding, coaching and collaboration.The things that you really need to think about before... - #2
Practical FP in Scala + Functional event-driven architecture
2 Books
Practical FP in Scala (A hands-on approach) & Functional event-driven architecture, aka FEDA, (Powered by Scala 3), together as a bundle! The content of PFP in Scala is a requirement to understand FEDA so why not take advantage of this bundle!? - #3
All the Books of The Medical Futurist
6 Books
We put together the most popular books from The Medical Futurist to provide a clear picture about the major trends shaping the future of medicine and healthcare. Digital health technologies, artificial intelligence, the future of 20 medical specialties, big pharma, data privacy, digital health investments and how technology giants such as Amazon... - #4
CCIE Service Provider Ultimate Study Bundle
2 Books
Piotr Jablonski, Lukasz Bromirski, and Nick Russo have joined forces to deliver the only CCIE Service Provider training resource you'll ever need. This bundle contains a detailed and challenging collection of workbook labs, plus an extensively detailed technical reference guide. All of us have earned the CCIE Service Provider certification... - #6
Pattern-Oriented Memory Forensics and Malware Detection
2 Books
This training bundle for security engineers and researchers, malware and memory forensics analysts includes two accelerated training courses for Windows memory dump analysis using WinDbg. It is also useful for technical support and escalation engineers who analyze memory dumps from complex software environments and need to check for possible... - #7
Modern C++ Collection
3 Books
Get All about Modern C++C++ Standard Library, including C++20Concurrency with Modern C++, including C++20C++20Each book has about 200 complete code examples. Updates are included. When I update one of the books, you immediately get the updated bundle. You can expect significant updates to each new C++ standard (C++23, C++26, .. ) and also... - #9
Retromat eBook Bundle for Agile Retrospectives
2 Books
If you facilitate retrospectives this bundle is for you: "Plans for Retrospectives" helps beginners learn the lay of the land with tried-and-true plans. Once you know your way around, "Run great agile retrospectives" contains all 135+ activities in Retromat for you to mix and match.