FS2 (previously called Scalaz-Stream) is a library that facilitates purely functional API to encode stream processing in a modular and composable manner.
Due to its functional abstraction around "streams" of data, FS2 enables isolating and delaying the side-effects until the streams are fully composed and assembled into its final execution context.
The main objectives of this talk are to get started with FS2, particularly with its functional approach to stream processing, and to dive into details of its semantics.
Video and slides synchronized, mp3 and slide download available at URL http://bit.ly/1TpXAZV.
Scalaz-Stream (soon to be called "FS2" or "Functional Streams for Scala") is a library that lets us write compositional, modular, safe, and efficient asynchronous I/O using an expressive purely functional API. Runar Bjarnason presents how to get started with the library, shows some examples, and how we can combine functional streams into large distributed systems. Filmed at qconlondon.com.
Runar Bjarnason is software engineer in Boston, the author of the book Functional Programming in Scala, and an occasional speaker on topics in functional programming.
An introduction to functional programming with goEleanor McHugh
A crash course in functional programming concepts using Go. Heavy on code, light on theory.
You can find the examples at https://github.com/feyeleanor/intro_to_fp_in_go
Get started with Lua - Hackference 2016Etiene Dalcol
Lua is a very fast, elegant and powerful dynamic language. It’s an excellent tool for robust applications or slim embedded systems. It found a niche in game development with big names such as “Grim Fandango”, “World of Warcraft” and “Angry Birds”. This talk will present what makes Lua different from other interpreted languages, the evolution of the Lua ecosystem, some key concepts of the language, and show you why Lua is the next language to add to your skill set.
FS2 (previously called Scalaz-Stream) is a library that facilitates purely functional API to encode stream processing in a modular and composable manner.
Due to its functional abstraction around "streams" of data, FS2 enables isolating and delaying the side-effects until the streams are fully composed and assembled into its final execution context.
The main objectives of this talk are to get started with FS2, particularly with its functional approach to stream processing, and to dive into details of its semantics.
Video and slides synchronized, mp3 and slide download available at URL http://bit.ly/1TpXAZV.
Scalaz-Stream (soon to be called "FS2" or "Functional Streams for Scala") is a library that lets us write compositional, modular, safe, and efficient asynchronous I/O using an expressive purely functional API. Runar Bjarnason presents how to get started with the library, shows some examples, and how we can combine functional streams into large distributed systems. Filmed at qconlondon.com.
Runar Bjarnason is software engineer in Boston, the author of the book Functional Programming in Scala, and an occasional speaker on topics in functional programming.
An introduction to functional programming with goEleanor McHugh
A crash course in functional programming concepts using Go. Heavy on code, light on theory.
You can find the examples at https://github.com/feyeleanor/intro_to_fp_in_go
Get started with Lua - Hackference 2016Etiene Dalcol
Lua is a very fast, elegant and powerful dynamic language. It’s an excellent tool for robust applications or slim embedded systems. It found a niche in game development with big names such as “Grim Fandango”, “World of Warcraft” and “Angry Birds”. This talk will present what makes Lua different from other interpreted languages, the evolution of the Lua ecosystem, some key concepts of the language, and show you why Lua is the next language to add to your skill set.
The slides from the talk I gave at Oracle III #JuevesTecnológicos in Madrid.
A review of how the ParallelStreams Work in Java 8 and some considerations we must know in order to get the better performance from the concurrent data processing in #Java8
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...Víctor Bolinches
Charla Universidad de Valencia - http://www.uv.es/
Cátedra de Capgemini 2016/17 - http://www.uv.es/capgeminiuv/sobre_nosotros.html
Asignatura : Programación avanzada y Lenguajes de programación
Título : Paradigma FP y OOP usando técnicas avanzadas de Programación
Flying Futures at the same sky can make the sun rise at midnightWiem Zine Elabidine
Template made by Slidesgo
Implementing responsive and high-performance applications is the most obvious challenge that we face in our programming life. It’s interesting to deeply study concurrency and parallelism on the JVM. In this talk you will learn how to describe parallel tasks and the idea behind Futures and the execution context. I will cover the tricky part of concurrency when the concurrent tasks share and use the same resources and how flying Futures in the same sky can make the sun rise at midnight! At the end I will talk about some possible solutions that you can use to reduce your worries about the pitfalls of concurrency.
Я расскажу о нестандартных особенностях языка для реальных проектов. Речь пойдет о том, зачем усложнять себе жизнь и какие преимущества это может дать.
- Protocol-Oriented Programming и его дилеммы
- Когда и зачем использовать обобщения и вложенные типы
- Настоящее и будущее Swift
The slides from the talk I gave at Oracle III #JuevesTecnológicos in Madrid.
A review of how the ParallelStreams Work in Java 8 and some considerations we must know in order to get the better performance from the concurrent data processing in #Java8
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...Víctor Bolinches
Charla Universidad de Valencia - http://www.uv.es/
Cátedra de Capgemini 2016/17 - http://www.uv.es/capgeminiuv/sobre_nosotros.html
Asignatura : Programación avanzada y Lenguajes de programación
Título : Paradigma FP y OOP usando técnicas avanzadas de Programación
Flying Futures at the same sky can make the sun rise at midnightWiem Zine Elabidine
Template made by Slidesgo
Implementing responsive and high-performance applications is the most obvious challenge that we face in our programming life. It’s interesting to deeply study concurrency and parallelism on the JVM. In this talk you will learn how to describe parallel tasks and the idea behind Futures and the execution context. I will cover the tricky part of concurrency when the concurrent tasks share and use the same resources and how flying Futures in the same sky can make the sun rise at midnight! At the end I will talk about some possible solutions that you can use to reduce your worries about the pitfalls of concurrency.
Я расскажу о нестандартных особенностях языка для реальных проектов. Речь пойдет о том, зачем усложнять себе жизнь и какие преимущества это может дать.
- Protocol-Oriented Programming и его дилеммы
- Когда и зачем использовать обобщения и вложенные типы
- Настоящее и будущее Swift
investigation on thermal properties of epoxy composites filled with pine app...Ijripublishers Ijri
he present paper deals with the effect of volume fraction of fillers on the thermal Properties of polymer composites. This work sees an opportunity of enhancement on insulation capability of a typical fiber reinforced polymer composite. To validate this mathematical model, a set of epoxy based composites, with fiber content ranging 4.38 to 20.10% of volume fractions have been prepared by simple hand lay-up technique. For preparing the composite, natural fiber i.e. Pine apple leaf fibers are incorporated in Epoxy Resin. Thermal conductivities of these composite samples are measured as per ASTM standard E-1530 by using the Unitherm™ Model 2022 tester, which operates on the double guarded heat flow principle at the temperature ranging from 30˚C to 150˚C. And also the Specific Heat of the powdered samples are measured by using Differential Scanning Calorimeter (DSC). By using the MATLAB the numerical analysis is carried out to find the value of Thermal Diffusivity with varying temperatures. It was observed that the thermal diffusivity varies with fiber concentration, but the variation of thermal diffusivity with varying temperature was not so significant.
KEYWORDS: Pine Apple Leaf fiber, Epoxy Composites, Volume Fraction, Thermal Properties.
The cyber house of horrors - securing the expanding attack surfaceJason Bloomberg
The enterprise attack surface has exploded in recent years. More users on more devices in more locations are able to access ever more sensitive enterprise applications. The result is that the number of targets for attackers has gone up dramatically.
The expanding attack surface has been dubbed a “Cyber House of Horrors,” as insider risks, aggressive social engineering, exploitation of outdated access controls, and a range of other security issues have come to the fore.
Join Certes Networks and Intellyx for a webinar to explore:
What factors are driving the expansion of the attack surface?
What types of attacks and exploits are taking advantage of these changes?
How are segmentation techniques and access controls evolving in response?
Beyond the buzzword: a reactive web-appliction in practiceManuel Bernhardt
This talk & live-coding session gives an insight into the why, what and how of reactive applications, and web-applications in particular. The first part is theoretical, whilst the second part is a live-coding session introducing the Play Framework, Akka and the Scala programming language all whilst demonstrating reactive patterns such as Futures, Actors, Pipes and Circuit Breakers.
CMO Exchange - CMOs as Change Management Operators panel - January 27 2013FortuneCMO, LLC
CMO Exchange panel: 'CMOs as Change Management Operators' by Steven Cook, Vince Ferraro, Maribel Garcia-Rodriguez, Lorena Harris and Filip Wouters. #CMOExchange #CMO.com
You already know TDD, your code coverage is almost at 80%, jUnit has no secret for you? But you feel that you could do more with your tests, the tools you use have limitations. Or maybe you're just tired of assertEquals?
Don't panic! We will see how you can code tests. We will look upon:
- Mutation Testing
- BDD, Behaviour Driven Development
- Property Testing
Can you believe that the Scala programming language is already 13 years old? Scala was an experiment back in 2003, but there are no questions today about its success and its great influence on other languages, especially on Java. In this session we will travel time, going back to the age when Java was the hacker’s drink, while Pizza was the hacker’s food. We will glance through some of the memorable moments, and land in the present days to introduce all the goodnesses available in the upcoming Scala 2.12 release. Finally, we will take a brief but intense look at what we can expect from the future. Prepare your time traveling equipment, and be ready to rewind the clock to more than 20 years ago!
Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...GeeksLab Odessa
SubScript - это расширение языка Scala, добавляющее поддержку конструкций и синтаксиса аглебры общающихся процессов (Algebra of Communicating Processes, ACP). SubScript является перспективным расширением, применимым как для разработки высоконагруженных параллельных систем, так и для простых персональных приложений.
Threads, Queues, and More: Async Programming in iOSTechWell
To keep your iOS app running butter-smooth at 60 frames per second, Apple recommends doing as many tasks as possible asynchronously or “off the main thread.” Joe Keeley introduces you to some basic concepts of asynchronous programming in iOS. He discusses what threads and queues are, how they are related, and the special significance of the main queue to iOS. Look at what options are available in the iOS SDK to work asynchronously, including NSOperationQueues and Grand Central Dispatch. Take an in depth look at how to implement some common use cases for those options in Swift. Joe pays special attention to networking, one of the most common asynchronous use cases. Spend some time discussing common asynchronous programming pitfalls—and how to avoid them. Leave this session ready to try out asynchronous programming in your iOS app.
Programming Sideways: Asynchronous Techniques for AndroidEmanuele Di Saverio
Android apps need to respond fast, support highly parallel execution and multi component architecture.
Learn some tricks of the trade for these problems!
as presented at www.mobileconference.it (2013 edition)
From Java to Scala - advantages and possible risksSeniorDevOnly
Oleksii Petinov during his presentation gave the audience the overview of his vision of Scala pros and contras. In his vision Scala smoothly integrates features of object-oriented and functional languages, enabling Java and other programmers to be more productive.
There is admittedly some truth to the statement that “Scala is complex”, but the learning curve is well worth the investment.
Spring Day | Spring and Scala | Eberhard WolffJAX London
2011-10-31 | 09:45 AM - 10:30 AM
Spring is widely used in the Java world - but does it make any sense to combine it with Scala? This talk gives an answer and shows how and why Spring is useful in the Scala world. All areas of Spring such as Dependency Injection, Aspect-Oriented Programming and the Portable Service Abstraction as well as Spring MVC are covered.
More Data, More Problems: Evolving big data machine learning pipelines with S...Alex Sadovsky
These are the slides from the Denver/Boulder Spark meet-up on February 24th, 2016. (deck build animations are all broken here... sorry!)
This talk provides an evaluation of existing machine learning pipelines in the eyes of different key stakeholders in the data science ecosystem. Focus is be placed upon the entire process from data to product (and keeping everyone in-between happy). Ultimately I explore how to utilize Spotify’s Luigi pipeline tool in combination with Spark to produce batch processing machine learning pipelines that have operational insights and redundancy built in.
Understanding reactive programming with microsoft reactive extensionsOleksandr Zhevzhyk
We all want our applications to be responsible, reliable and testable. But event-driven paradigm sometimes could lead us to obscured or, even worse, messy code. Let’s look into the world, where generated data, background tasks and events are stuck together as asynchronous data streams to achieve a better result.
Similar to Functional Stream Processing with Scalaz-Stream (20)
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...Juraj Vysvader
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I didn't get rich from it but it did have 63K downloads (powered possible tens of thousands of websites).
Globus Connect Server Deep Dive - GlobusWorld 2024Globus
We explore the Globus Connect Server (GCS) architecture and experiment with advanced configuration options and use cases. This content is targeted at system administrators who are familiar with GCS and currently operate—or are planning to operate—broader deployments at their institution.
Software Engineering, Software Consulting, Tech Lead.
Spring Boot, Spring Cloud, Spring Core, Spring JDBC, Spring Security,
Spring Transaction, Spring MVC,
Log4j, REST/SOAP WEB-SERVICES.
Understanding Globus Data Transfers with NetSageGlobus
NetSage is an open privacy-aware network measurement, analysis, and visualization service designed to help end-users visualize and reason about large data transfers. NetSage traditionally has used a combination of passive measurements, including SNMP and flow data, as well as active measurements, mainly perfSONAR, to provide longitudinal network performance data visualization. It has been deployed by dozens of networks world wide, and is supported domestically by the Engagement and Performance Operations Center (EPOC), NSF #2328479. We have recently expanded the NetSage data sources to include logs for Globus data transfers, following the same privacy-preserving approach as for Flow data. Using the logs for the Texas Advanced Computing Center (TACC) as an example, this talk will walk through several different example use cases that NetSage can answer, including: Who is using Globus to share data with my institution, and what kind of performance are they able to achieve? How many transfers has Globus supported for us? Which sites are we sharing the most data with, and how is that changing over time? How is my site using Globus to move data internally, and what kind of performance do we see for those transfers? What percentage of data transfers at my institution used Globus, and how did the overall data transfer performance compare to the Globus users?
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeAftab Hussain
Understanding variable roles in code has been found to be helpful by students
in learning programming -- could variable roles help deep neural models in
performing coding tasks? We do an exploratory study.
- These are slides of the talk given at InteNSE'23: The 1st International Workshop on Interpretability and Robustness in Neural Software Engineering, co-located with the 45th International Conference on Software Engineering, ICSE 2023, Melbourne Australia
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus
As part of the DOE Integrated Research Infrastructure (IRI) program, NERSC at Lawrence Berkeley National Lab and ALCF at Argonne National Lab are working closely with General Atomics on accelerating the computing requirements of the DIII-D experiment. As part of the work the team is investigating ways to speedup the time to solution for many different parts of the DIII-D workflow including how they run jobs on HPC systems. One of these routes is looking at Globus Compute as a way to replace the current method for managing tasks and we describe a brief proof of concept showing how Globus Compute could help to schedule jobs and be a tool to connect compute at different facilities.
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppGoogle
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
👉👉 Click Here To Get More Info 👇👇
https://sumonreview.com/ai-fusion-buddy-review
AI Fusion Buddy Review: Key Features
✅Create Stunning AI App Suite Fully Powered By Google's Latest AI technology, Gemini
✅Use Gemini to Build high-converting Converting Sales Video Scripts, ad copies, Trending Articles, blogs, etc.100% unique!
✅Create Ultra-HD graphics with a single keyword or phrase that commands 10x eyeballs!
✅Fully automated AI articles bulk generation!
✅Auto-post or schedule stunning AI content across all your accounts at once—WordPress, Facebook, LinkedIn, Blogger, and more.
✅With one keyword or URL, generate complete websites, landing pages, and more…
✅Automatically create & sell AI content, graphics, websites, landing pages, & all that gets you paid non-stop 24*7.
✅Pre-built High-Converting 100+ website Templates and 2000+ graphic templates logos, banners, and thumbnail images in Trending Niches.
✅Say goodbye to wasting time logging into multiple Chat GPT & AI Apps once & for all!
✅Save over $5000 per year and kick out dependency on third parties completely!
✅Brand New App: Not available anywhere else!
✅ Beginner-friendly!
✅ZERO upfront cost or any extra expenses
✅Risk-Free: 30-Day Money-Back Guarantee!
✅Commercial License included!
See My Other Reviews Article:
(1) AI Genie Review: https://sumonreview.com/ai-genie-review
(2) SocioWave Review: https://sumonreview.com/sociowave-review
(3) AI Partner & Profit Review: https://sumonreview.com/ai-partner-profit-review
(4) AI Ebook Suite Review: https://sumonreview.com/ai-ebook-suite-review
#AIFusionBuddyReview,
#AIFusionBuddyFeatures,
#AIFusionBuddyPricing,
#AIFusionBuddyProsandCons,
#AIFusionBuddyTutorial,
#AIFusionBuddyUserExperience
#AIFusionBuddyforBeginners,
#AIFusionBuddyBenefits,
#AIFusionBuddyComparison,
#AIFusionBuddyInstallation,
#AIFusionBuddyRefundPolicy,
#AIFusionBuddyDemo,
#AIFusionBuddyMaintenanceFees,
#AIFusionBuddyNewbieFriendly,
#WhatIsAIFusionBuddy?,
#HowDoesAIFusionBuddyWorks
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteGoogle
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
👉👉 Click Here To Get More Info 👇👇
https://sumonreview.com/ai-pilot-review/
AI Pilot Review: Key Features
✅Deploy AI expert bots in Any Niche With Just A Click
✅With one keyword, generate complete funnels, websites, landing pages, and more.
✅More than 85 AI features are included in the AI pilot.
✅No setup or configuration; use your voice (like Siri) to do whatever you want.
✅You Can Use AI Pilot To Create your version of AI Pilot And Charge People For It…
✅ZERO Manual Work With AI Pilot. Never write, Design, Or Code Again.
✅ZERO Limits On Features Or Usages
✅Use Our AI-powered Traffic To Get Hundreds Of Customers
✅No Complicated Setup: Get Up And Running In 2 Minutes
✅99.99% Up-Time Guaranteed
✅30 Days Money-Back Guarantee
✅ZERO Upfront Cost
See My Other Reviews Article:
(1) TubeTrivia AI Review: https://sumonreview.com/tubetrivia-ai-review
(2) SocioWave Review: https://sumonreview.com/sociowave-review
(3) AI Partner & Profit Review: https://sumonreview.com/ai-partner-profit-review
(4) AI Ebook Suite Review: https://sumonreview.com/ai-ebook-suite-review
Graspan: A Big Data System for Big Code AnalysisAftab Hussain
We built a disk-based parallel graph system, Graspan, that uses a novel edge-pair centric computation model to compute dynamic transitive closures on very large program graphs.
We implement context-sensitive pointer/alias and dataflow analyses on Graspan. An evaluation of these analyses on large codebases such as Linux shows that their Graspan implementations scale to millions of lines of code and are much simpler than their original implementations.
These analyses were used to augment the existing checkers; these augmented checkers found 132 new NULL pointer bugs and 1308 unnecessary NULL tests in Linux 4.4.0-rc5, PostgreSQL 8.3.9, and Apache httpd 2.2.18.
- Accepted in ASPLOS ‘17, Xi’an, China.
- Featured in the tutorial, Systemized Program Analyses: A Big Data Perspective on Static Analysis Scalability, ASPLOS ‘17.
- Invited for presentation at SoCal PLS ‘16.
- Invited for poster presentation at PLDI SRC ‘16.
First Steps with Globus Compute Multi-User EndpointsGlobus
In this presentation we will share our experiences around getting started with the Globus Compute multi-user endpoint. Working with the Pharmacology group at the University of Auckland, we have previously written an application using Globus Compute that can offload computationally expensive steps in the researcher's workflows, which they wish to manage from their familiar Windows environments, onto the NeSI (New Zealand eScience Infrastructure) cluster. Some of the challenges we have encountered were that each researcher had to set up and manage their own single-user globus compute endpoint and that the workloads had varying resource requirements (CPUs, memory and wall time) between different runs. We hope that the multi-user endpoint will help to address these challenges and share an update on our progress here.
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxrickgrimesss22
Discover the essential features to incorporate in your Winzo clone app to boost business growth, enhance user engagement, and drive revenue. Learn how to create a compelling gaming experience that stands out in the competitive market.
Enhancing Research Orchestration Capabilities at ORNL.pdfGlobus
Cross-facility research orchestration comes with ever-changing constraints regarding the availability and suitability of various compute and data resources. In short, a flexible data and processing fabric is needed to enable the dynamic redirection of data and compute tasks throughout the lifecycle of an experiment. In this talk, we illustrate how we easily leveraged Globus services to instrument the ACE research testbed at the Oak Ridge Leadership Computing Facility with flexible data and task orchestration capabilities.
Quarkus Hidden and Forbidden ExtensionsMax Andersen
Quarkus has a vast extension ecosystem and is known for its subsonic and subatomic feature set. Some of these features are not as well known, and some extensions are less talked about, but that does not make them less interesting - quite the opposite.
Come join this talk to see some tips and tricks for using Quarkus and some of the lesser known features, extensions and development techniques.
Top 7 Unique WhatsApp API Benefits | Saudi ArabiaYara Milbes
Discover the transformative power of the WhatsApp API in our latest SlideShare presentation, "Top 7 Unique WhatsApp API Benefits." In today's fast-paced digital era, effective communication is crucial for both personal and professional success. Whether you're a small business looking to enhance customer interactions or an individual seeking seamless communication with loved ones, the WhatsApp API offers robust capabilities that can significantly elevate your experience.
In this presentation, we delve into the top 7 distinctive benefits of the WhatsApp API, provided by the leading WhatsApp API service provider in Saudi Arabia. Learn how to streamline customer support, automate notifications, leverage rich media messaging, run scalable marketing campaigns, integrate secure payments, synchronize with CRM systems, and ensure enhanced security and privacy.
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Shahin Sheidaei
Games are powerful teaching tools, fostering hands-on engagement and fun. But they require careful consideration to succeed. Join me to explore factors in running and selecting games, ensuring they serve as effective teaching tools. Learn to maintain focus on learning objectives while playing, and how to measure the ROI of gaming in education. Discover strategies for pitching gaming to leadership. This session offers insights, tips, and examples for coaches, team leads, and enterprise leaders seeking to teach from simple to complex concepts.
Atelier - Innover avec l’IA Générative et les graphes de connaissancesNeo4j
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Allez au-delà du battage médiatique autour de l’IA et découvrez des techniques pratiques pour utiliser l’IA de manière responsable à travers les données de votre organisation. Explorez comment utiliser les graphes de connaissances pour augmenter la précision, la transparence et la capacité d’explication dans les systèmes d’IA générative. Vous partirez avec une expérience pratique combinant les relations entre les données et les LLM pour apporter du contexte spécifique à votre domaine et améliorer votre raisonnement.
Amenez votre ordinateur portable et nous vous guiderons sur la mise en place de votre propre pile d’IA générative, en vous fournissant des exemples pratiques et codés pour démarrer en quelques minutes.
5. Task[A]
• Purely functional & compositional.
• Task[A] is a wrapper around Future[Throwable / A].
• Asynchronous: uses scalaz.concurrent.Future[A].
• Handles exceptions: with scalaz./, aka Either.
5
6. Task[A]
• Task separates what to do with the monadic context from when to do.
scala> Task{ println("Hello World!") }
res0: scalaz.concurrent.Task[Unit] = scalaz.concurrent.Task@2435b6e8
scala> res0.run
Hello World!
6
7. Task[A]
• Task separates what to do with monadic context from when to do.
scala> Task{ println("Hello World!") }
res0: scalaz.concurrent.Task[Unit] = scalaz.concurrent.Task@2435b6e8
scala> res0.run
Hello World!
scala> res0.run
Hello World!
7
8. Task[A]
• Example: Lifting computation into a Task:
import twitter4j._
val twitterClient = new TwitterFactory(twitterConfig).getInstance()
def statuses(query: Query): Task[List[Status]] =
Task {
twitterClient.search(query).getTweets.toList
}
8
18. Process[F, O]
... represents a stream of O values
which can interleave external requests
to evaluate expressions of form F[_].
18
19. Process[F[_], O]
• F[_]: a context/container (e.g., scalaz.concurrent.Task)
• effectful or not,
• in which a computation runs.
19
20. Process[F[_], O]
• F[_]: a context/container (e.g., scalaz.concurrent.Task)
• effectful or not,
• in which a computation runs.
• Streams of Os is obtained from the context: F.
20
21. Process[F[_], O]
• F[_]: a context/container (e.g., scalaz.concurrent.Task)
• effectful or not,
• in which a computation runs.
• Streams of Os is obtained from the context: F.
• Process can accept different input types (e.g., F[_]).
21
22. Execution Model
scala> :paste
// Entering paste mode (ctrl-D to finish)
import scalaz.stream._
import scalaz.concurrent.Task
import scala.concurrent.duration._
// Exiting paste mode, now interpreting.
22
28. Await[F[_], I, O]
case class Await[F[_], I, O](
req: F[I],
recv: I Process[F, O],
fallback: Process[F, O] = halt,
cleanUp: Process[F,O] = halt) extends Process[F, O]
28
29. Await[F[_], I, O]
• Example: Build a Twitter Search Process to get tweets with #spark
Tag.
• Defined earlier:
val twitterClient: Twitter = ???
def statuses(query: Query): Task[List[Status]] = ???
29
30. Await[F[_], I, O]
// Builds a Twitter Search Process for a given Query
def buildSearchProcess(query: Query): Process[Task, Status] = {
val queryTask: Task[List[Status]] = statuses(query)
await(queryTask){ statusList
Process.emitAll(statusList)
}
}
//In essence, it builds: Process: Await (_ Emit Halt)
val akkaSearchProcess: Process[Task, Status] =
buildSearchProcess(new Query("#spark"))
30
31. Await[F[_], I, O]
• Example: Build a stream of Positive Integers.
scala> import Process._
import Process._
scala> def integerStream: Process[Task, Int] = {
| def next (i: Int): Process[Task,Int] = await(Task(i)){ i
| emit(i) ++ next(i + 1)
| }
| next(1)
| }
integerStream: scalaz.stream.Process[scalaz.concurrent.Task,Int]
31
32. Notable Approaches to Construct Process
• Process.eval
• Process.repeatEval
• scalaz.stream.io and scalaz.stream.nio
• scalaz.stream.tcp
• scalaz.stream.async
• ...
32
33. Running a Process: run
• def run: F[Unit]: constructs the machinery that will execute the Process.
• Reduces the sequence of operations to a single operation, in the context of Task. Given:
scala> val intsP = integerStream.take(10)
intsP: scalaz.stream.Process[scalaz.concurrent.Task,Int] = ...
scala> val task = intsP.run
task: scalaz.concurrent.Task[Unit] = scalaz.concurrent.Task@fbce6f9
scala> task.run
// outputs nothing?
33
34. Running a Process: runLog
• def runLog:F[Vector[O]]: Gets all the intermediate results.
scala> intsP.runLog.run
res4: Vector[Int] = Vector(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
34
35. Running a Process: runLog
• What does happen when we execute integerStream.runLog.run?
def integerStream: Process[Task, Int] = {
def next (i: Int): Process[Task,Int] = await(Task(i)){ i
emit(i) ++ next(i + 1)
}
next(1)
}
35
60. Tee
• type Tee[-I,-I2,+O] = Process[Env[I,I2]#T, O]
• Deterministic
• Left and then Right and then Left ...
scala> import tee._
scala> import Process._
scala> val p1: Process[Task, Int] = integerStream
scala> val p2: Process[Task, String] = emitAll(Seq("A", "B", "C"))
scala> val teeExample1: Process[Nothing, Any] = (p1 tee p2)(interleave)
scala> teeExample1.runLog.run
res2: Vector[Any] = Vector(1, A, 2, B, 3, C)
scala> val teeExample2: Process[Nothing, Int] = (p1 tee p2)(passL)
scala> teeExample2.take(5).runLog.run
res3: Vector[Int] = Vector(1, 2, 3, 4, 5)
60
65. • Creadits: Edward Kmett, Runar Bjarnasson & Paul Chuisano et al.
• Sides and code samples will be posted at http://github.com/
adilakhter/scalaitaly-functional-stream-processing.
65