A strong type system helps you catch compilation errors early on and point you in the right direction, but how far can we push it to express the correctness of our programs?
In this talk, we'll explore what type level programming is and how we can leverage Scala's powerful type system not only to catch compilation errors, but begin supplying proofs of correctness to our programs.
We'll take a stroll from programming at the value level to expressing our intentions at the type level.
This talk was given in the Israeli Scala Meetup, Underscore, on February 13, 2018.
Video (Hebrew): https://youtu.be/57iAD9X_1jI
These days sbt is the de-facto build tool for Scala, but most of us just write the minimum viable build.sbt file, import the libraries we need (and maybe throw in some sbt-assembly) and forget about it.
In this Good Practices session, you will learn about making your build safer and more robust by making the Scala compiler work for you and through using some sbt plugins.
This talk will be quite high-level. There will be no need for prior knowledge of sbt and it should be beneficial for you even if you don’t use sbt.
Kotlin is a statically typed programming language for the JVM, Android and the browser designed for the industry. This presentation is an overview of Kotlin features and advantages over Java including code samples.
If you still haven't heard of it, there is a new star in JVM sky - Kotlin. This short presentation will serve as intro for those who wan't to hear what's all the fuss about and dive deeper into this new alternative to Java
This talk was given in the Israeli Scala Meetup, Underscore, on February 13, 2018.
Video (Hebrew): https://youtu.be/57iAD9X_1jI
These days sbt is the de-facto build tool for Scala, but most of us just write the minimum viable build.sbt file, import the libraries we need (and maybe throw in some sbt-assembly) and forget about it.
In this Good Practices session, you will learn about making your build safer and more robust by making the Scala compiler work for you and through using some sbt plugins.
This talk will be quite high-level. There will be no need for prior knowledge of sbt and it should be beneficial for you even if you don’t use sbt.
Kotlin is a statically typed programming language for the JVM, Android and the browser designed for the industry. This presentation is an overview of Kotlin features and advantages over Java including code samples.
If you still haven't heard of it, there is a new star in JVM sky - Kotlin. This short presentation will serve as intro for those who wan't to hear what's all the fuss about and dive deeper into this new alternative to Java
Partial Continuations, Lessons From JavaScript and Guile in 2012 (Quasiconf 2...Igalia
By Andy Wingo.
Three talks in one:
- The power of limits: Partial continuations in Scheme
- Postcards from the web: Lessons from JavaScript
- Guile in 2012: A look back at 2.0, a look forward to 2.2
The power of limits: Partial continuations in Scheme
I’ll describe what delimited continuations are, how they are better than call/cc, and then go on to demonstrate and describe an event-based cooperative threading system built with delimited continuations, showing how it makes for much clearer code. I’ll show a simple implementation of the memcached protocol.
Postcards from the web: Lessons from JavaScript
In this talk I will mention some things that I have learned about language implementations from having worked on V8 and JavaScriptCore.
Guile in 2012: A look back at 2.0, a look forward to 2.2
It will briefly summarize the 2.0 release series of Guile, how it went, what worked well and what didn’t. Then we’ll look forward to the next cycle, which is probably some 6 months away.
Lock-free algorithms for Kotlin CoroutinesRoman Elizarov
Presentation for SPTCC 2017 - http://neerc.ifmo.ru/sptcc/
Video (part 1): https://www.youtube.com/watch?v=W2dOOBN1OQI
Video (part 2): https://www.youtube.com/watch?v=iQsN_IDUTSc
Partial Continuations, Lessons From JavaScript and Guile in 2012 (Quasiconf 2...Igalia
By Andy Wingo.
Three talks in one:
- The power of limits: Partial continuations in Scheme
- Postcards from the web: Lessons from JavaScript
- Guile in 2012: A look back at 2.0, a look forward to 2.2
The power of limits: Partial continuations in Scheme
I’ll describe what delimited continuations are, how they are better than call/cc, and then go on to demonstrate and describe an event-based cooperative threading system built with delimited continuations, showing how it makes for much clearer code. I’ll show a simple implementation of the memcached protocol.
Postcards from the web: Lessons from JavaScript
In this talk I will mention some things that I have learned about language implementations from having worked on V8 and JavaScriptCore.
Guile in 2012: A look back at 2.0, a look forward to 2.2
It will briefly summarize the 2.0 release series of Guile, how it went, what worked well and what didn’t. Then we’ll look forward to the next cycle, which is probably some 6 months away.
Lock-free algorithms for Kotlin CoroutinesRoman Elizarov
Presentation for SPTCC 2017 - http://neerc.ifmo.ru/sptcc/
Video (part 1): https://www.youtube.com/watch?v=W2dOOBN1OQI
Video (part 2): https://www.youtube.com/watch?v=iQsN_IDUTSc
My Scala by the Bay 2014 talk on exploring the ideas behind the implementation of the generic library shapeless, and general ideas about how to do "type level" programming in Scala.
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Globus
The U.S. Geological Survey (USGS) has made substantial investments in meeting evolving scientific, technical, and policy driven demands on storing, managing, and delivering data. As these demands continue to grow in complexity and scale, the USGS must continue to explore innovative solutions to improve its management, curation, sharing, delivering, and preservation approaches for large-scale research data. Supporting these needs, the USGS has partnered with the University of Chicago-Globus to research and develop advanced repository components and workflows leveraging its current investment in Globus. The primary outcome of this partnership includes the development of a prototype enterprise repository, driven by USGS Data Release requirements, through exploration and implementation of the entire suite of the Globus platform offerings, including Globus Flow, Globus Auth, Globus Transfer, and Globus Search. This presentation will provide insights into this research partnership, introduce the unique requirements and challenges being addressed and provide relevant project progress.
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Globus
The Earth System Grid Federation (ESGF) is a global network of data servers that archives and distributes the planet’s largest collection of Earth system model output for thousands of climate and environmental scientists worldwide. Many of these petabyte-scale data archives are located in proximity to large high-performance computing (HPC) or cloud computing resources, but the primary workflow for data users consists of transferring data, and applying computations on a different system. As a part of the ESGF 2.0 US project (funded by the United States Department of Energy Office of Science), we developed pre-defined data workflows, which can be run on-demand, capable of applying many data reduction and data analysis to the large ESGF data archives, transferring only the resultant analysis (ex. visualizations, smaller data files). In this talk, we will showcase a few of these workflows, highlighting how Globus Flows can be used for petabyte-scale climate analysis.
Launch Your Streaming Platforms in MinutesRoshan Dwivedi
The claim of launching a streaming platform in minutes might be a bit of an exaggeration, but there are services that can significantly streamline the process. Here's a breakdown:
Pros of Speedy Streaming Platform Launch Services:
No coding required: These services often use drag-and-drop interfaces or pre-built templates, eliminating the need for programming knowledge.
Faster setup: Compared to building from scratch, these platforms can get you up and running much quicker.
All-in-one solutions: Many services offer features like content management systems (CMS), video players, and monetization tools, reducing the need for multiple integrations.
Things to Consider:
Limited customization: These platforms may offer less flexibility in design and functionality compared to custom-built solutions.
Scalability: As your audience grows, you might need to upgrade to a more robust platform or encounter limitations with the "quick launch" option.
Features: Carefully evaluate which features are included and if they meet your specific needs (e.g., live streaming, subscription options).
Examples of Services for Launching Streaming Platforms:
Muvi [muvi com]
Uscreen [usencreen tv]
Alternatives to Consider:
Existing Streaming platforms: Platforms like YouTube or Twitch might be suitable for basic streaming needs, though monetization options might be limited.
Custom Development: While more time-consuming, custom development offers the most control and flexibility for your platform.
Overall, launching a streaming platform in minutes might not be entirely realistic, but these services can significantly speed up the process compared to building from scratch. Carefully consider your needs and budget when choosing the best option for you.
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.
Navigating the Metaverse: A Journey into Virtual Evolution"Donna Lenk
Join us for an exploration of the Metaverse's evolution, where innovation meets imagination. Discover new dimensions of virtual events, engage with thought-provoking discussions, and witness the transformative power of digital realms."
Essentials of Automations: The Art of Triggers and Actions in FMESafe Software
In this second installment of our Essentials of Automations webinar series, we’ll explore the landscape of triggers and actions, guiding you through the nuances of authoring and adapting workspaces for seamless automations. Gain an understanding of the full spectrum of triggers and actions available in FME, empowering you to enhance your workspaces for efficient automation.
We’ll kick things off by showcasing the most commonly used event-based triggers, introducing you to various automation workflows like manual triggers, schedules, directory watchers, and more. Plus, see how these elements play out in real scenarios.
Whether you’re tweaking your current setup or building from the ground up, this session will arm you with the tools and insights needed to transform your FME usage into a powerhouse of productivity. Join us to discover effective strategies that simplify complex processes, enhancing your productivity and transforming your data management practices with FME. Let’s turn complexity into clarity and make your workspaces work wonders!
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...informapgpstrackings
Keep tabs on your field staff effortlessly with Informap Technology Centre LLC. Real-time tracking, task assignment, and smart features for efficient management. Request a live demo today!
For more details, visit us : https://informapuae.com/field-staff-tracking/
How Recreation Management Software Can Streamline Your Operations.pptxwottaspaceseo
Recreation management software streamlines operations by automating key tasks such as scheduling, registration, and payment processing, reducing manual workload and errors. It provides centralized management of facilities, classes, and events, ensuring efficient resource allocation and facility usage. The software offers user-friendly online portals for easy access to bookings and program information, enhancing customer experience. Real-time reporting and data analytics deliver insights into attendance and preferences, aiding in strategic decision-making. Additionally, effective communication tools keep participants and staff informed with timely updates. Overall, recreation management software enhances efficiency, improves service delivery, and boosts customer satisfaction.
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.
Unleash Unlimited Potential with One-Time Purchase
BoxLang is more than just a language; it's a community. By choosing a Visionary License, you're not just investing in your success, you're actively contributing to the ongoing development and support of BoxLang.
Enterprise Resource Planning System includes various modules that reduce any business's workload. Additionally, it organizes the workflows, which drives towards enhancing productivity. Here are a detailed explanation of the ERP modules. Going through the points will help you understand how the software is changing the work dynamics.
To know more details here: https://blogs.nyggs.com/nyggs/enterprise-resource-planning-erp-system-modules/
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Mind IT Systems
Healthcare providers often struggle with the complexities of chronic conditions and remote patient monitoring, as each patient requires personalized care and ongoing monitoring. Off-the-shelf solutions may not meet these diverse needs, leading to inefficiencies and gaps in care. It’s here, custom healthcare software offers a tailored solution, ensuring improved care and effectiveness.
We describe the deployment and use of Globus Compute for remote computation. This content is aimed at researchers who wish to compute on remote resources using a unified programming interface, as well as system administrators who will deploy and operate Globus Compute services on their research computing infrastructure.
Check out the webinar slides to learn more about how XfilesPro transforms Salesforce document management by leveraging its world-class applications. For more details, please connect with sales@xfilespro.com
If you want to watch the on-demand webinar, please click here: https://www.xfilespro.com/webinars/salesforce-document-management-2-0-smarter-faster-better/
May Marketo Masterclass, London MUG May 22 2024.pdfAdele Miller
Can't make Adobe Summit in Vegas? No sweat because the EMEA Marketo Engage Champions are coming to London to share their Summit sessions, insights and more!
This is a MUG with a twist you don't want to miss.
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
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Introduction to Type Level Programming
1. Introduction to Type Level
Programming
Or: How to blame the Scala compiler when nothing works
Yuval Itzchakov
13/02/2018
2. YuvalItzchakov
2
• Developer @ Clicktale for the past 3 years
• Previously developer @ IDF (8200)
@yuvalitzchakov
https://stackoverflow.com/users/1870803/yuval-itzchakov
h http://asyncified.io
https://fpchat-invite.herokuapp.com/ (yuval.Itzchakov)
3. Agenda
3
• Type Level Programming In a Nutshell
• Show[A]
• Implicits
• Typeclass Pattern
• Generic Derivation
4. TypeLevelProgramming
4
• The compiler is the verification tool for our program.
• Can we make it do more?
• How about generating types at compile time for us?
6. Show[A]
6
trait Show[A] {
def show(a: A): String
}
• Defines a string representation for a type.
• Allows us to define custom representations for closed types.
7. PrintingaArray[Byte]
7
We want to print a byte array:
val bytes = Array[Byte](30, 57, 92)
println(bytes) // [B@6615435c
On the other hand, given a Show instance:
val showBytes = new Show[Array[Byte]] {
override def show(arr: Array[Byte]): String = arr.map("%02X" format _).mkString(",")
}
println(showBytes.show(bytes)) // 1E,39,5C
8. Wherewe’regoing
8
Given any case class:
case class Person(firstName: String, lastName: String, age: Int)
We’ll be able to automatically derive a Show instance for it:
val p = Person("yuval", "itzchakov", 30)
val personShower: Show[Person] = ??? // Magic
personShower.show(p) // yuval, itzchakov, 30
10. Nice,butalittleugly
10
• Can we do better?
• YES! IMPLICITS!
implicit val intEncoder: Show[Int] = new Show[Int] {
override def show(i: Int): String = i.toString
}
11. Implicits
11
• An implicit parameter is used to summon the Show[A] trait.
• Scala compiler searches for a suitable implicit in scope.
• If found, the compiler fills in the right instance at compile
time.
• Implicit resolution works recursively.
12. TypeclassPattern
13
• Defining common behavior for types, without
inheritance.
• Trait definition with a polymorphic type
• Concrete implicit instances
• Originated in Haskell
• A form of ad-hoc polymorphism (A.K.A
overloading)
13. TypeclassDefinition
14
Any method requiring the type class, asks for it implicitly from the
compiler:
def log[A](a: A)(implicit shower: Show[A]): String = {
shower.show(a)
}
println(log(10)) // log(10)(intEncoder) -> 10
14. TypeclassPattern
15
The implicit value must be in scope, otherwise:
Error:(45, 19) could not find implicit value for parameter
show: Show[Int]
println(log(10))
16. Canwedo better?
17
• Can the compiler resolve, based on existing primitive implicits,
more complex types?
• How about a Tuple2 of primitives?
type Person = (String, (String, Int))
type Person = Tuple2[String, Tuple2[String, Int]]
18. RecursiveImplicitResolution
19
type Person = Tuple2[String, Tuple2[String, Int]]
implicit def tupleShow[Head, Tail](
implicit
headShow: Show[Head],
tailShow: Show[Tail])
Show[String]
Do I have an implicit for Tuple2?
Show[Tuple[String, Int]]
Recurse
19. RecursiveImplicitResolution
20
type Person = Tuple2[String, Tuple2[String, Int]]
Do I have an implicit for Tuple2?
implicit def tupleShow[Head, Tail](
implicit
headShow: Show[Head],
tailShow: Show[Tail])
Show[String]
Show[Int]
20. But…
21
• In real life, we usually don’t encode types as tuples
• And we want to abstract over arity (Tuple3, Tuple4,
TupleN)
• We really want to encode with case classes
• Can we do that?
21. Whatarecaseclasses,really?
22
• Named tuples on steroids.
• Compiler generated method implementations.
• Can be of any arity ( >= Scala 2.11).
• How do we deal with that? Can they be represented
generically?
22. Yes,wecan!
23
• Using HList (Heterogenous List)
• Heterogenous for holding different types
val hlist: ::[String, ::[Boolean, ::[Int, HNil]]] =
"Scala-IL" :: true :: 42 :: HNil
val meetUp: String = hlist.head // “Scala-IL”
val isItAwesome: Boolean = hlist.tail.head // true
24. shapeless
25
“shapeless is a type class and dependent type based generic
programming library for Scala” (from GitHub).
• Provides us with a vast amount of building blocks for TLP
• Consumed by many popular libraries in the ecosystem:
• circe
• avro4s
• scodec
• spray
25. Interesting..
26
• Can we rework our example to derive a Show[A] instance
for any case class using HList?
• Let’s try!
26. Evolution
27
type Person = Tuple2[String, Tuple2[String, Int]]
case class Person(firstName: String, lastName: String, age: Int)
type Person =
shapeless.::[String, shapeless.::[String, shapeless.::[Int, HNil]]]
29. 30Confidential
• You’re probably using it already
• Building codecs (JSON, Avro, XML, or custom)
• Abstracting over arity
• Updating nested data structured (lenses)
• Type safe casts (when you really must)
Where TLP Meets You
30. 31Confidential
• The Scala compiler is a powerful tool.
• We can leverage it to do amazing things, like generically derive
types for us.
• shapeless is a powerful building block in that process.
• Mixing it all together, type level programming becomes
immensely powerful.
Conclusion
32. 33Confidential
• The Type Astronaut’s Guide to Shapeless (Dave Gurnell)
https://github.com/davegurnell/shapeless-guide
• Daniel Spiewak – High Wizardy in the Land Of Scala
https://vimeo.com/28793245
• Aaron Levin – Mastering Typeclass Induction
https://www.youtube.com/watch?v=Nm4OIhjjA2o
• Li Haoyi - Implicit Design Patterns in Scala
http://www.lihaoyi.com/post/ImplicitDesignPatternsinScala.html
Resources