The slides are for Tokyo Kabukiza.tech Meetup #9 "Programming Languages Battle Royal." An introduction to Frege - Haskell for JVM, focusing on the Java interoperation with monads. The original talk is in Japanese (http://www.slideshare.net/y_taka_23/frege).
Kotlin advanced - language reference for android developersBartosz Kosarzycki
StxNext Lightning Talks - Mar 11, 2016
Kotlin Advanced - language reference for Android developers
This presentation contains the second talk on Kotlin language we had at STXNext. We try go deeper into language specifics and look at the positive impact new syntax can have on boilerplate removal and readability improvement.
Kotlin really shines in Android development when one looks at “Enum translation”, “Extension functions”, “SAM conversions”, “Infix notation”, “Closures” and “Fluent interfaces” applied to lists. The talk, however, compares language-specifics of Java & Kotlin in terms of “Type Variance”, “Generics” and “IDE tools” as well.
We present real-world example based on Stx-Insider project written in Kotlin which incorporates Dagger 2, Kotterknife, Retrofit2 and is composed of 5+ Activities.
Full agenda
Live templates
Enum translation
Calling extension functions from Kotlin/Java
Constructors with backing fields
Warnings
F-bound polymorphism
Variance (Covariance/Contravariance)
Variance comparison in Kotlin/Java/Scala
Annotation processing - KAPT
SAM conversions
Type equality
Lambda vs Closure
Reified generics
Fluent interfaces
Infix notation
Static extension methods in Kotlin
Generic types
Sealed classes
Dokka - documentation in Kotlin
J2K converter
Real-world example
Reflection
Presentation is accompanied with an example project (StxInsider):
https://github.com/kosiara/stx-insider
Groovy is a dynamic language that provides different types of metaprogramming techniques. In this talk we’ll mainly see runtime metaprogramming. You’ll understand the Groovy Meta-Object-Protocol (MOP), the metaclass, how to intercept method calls, how to deal with method missing and property missing, the use of mixins, traits and categories. All of these topics will be explained with examples in order to understand them. Also, you’ll see a little bit about compile-time metaprogramming with AST Transformations. AST Transformations provide a wonderful way of manipulating code at compile time via modifications of the Abstract Syntax Tree. You’ll see a basic but powerful example of what we can do with AST transformations.
Kotlin advanced - language reference for android developersBartosz Kosarzycki
StxNext Lightning Talks - Mar 11, 2016
Kotlin Advanced - language reference for Android developers
This presentation contains the second talk on Kotlin language we had at STXNext. We try go deeper into language specifics and look at the positive impact new syntax can have on boilerplate removal and readability improvement.
Kotlin really shines in Android development when one looks at “Enum translation”, “Extension functions”, “SAM conversions”, “Infix notation”, “Closures” and “Fluent interfaces” applied to lists. The talk, however, compares language-specifics of Java & Kotlin in terms of “Type Variance”, “Generics” and “IDE tools” as well.
We present real-world example based on Stx-Insider project written in Kotlin which incorporates Dagger 2, Kotterknife, Retrofit2 and is composed of 5+ Activities.
Full agenda
Live templates
Enum translation
Calling extension functions from Kotlin/Java
Constructors with backing fields
Warnings
F-bound polymorphism
Variance (Covariance/Contravariance)
Variance comparison in Kotlin/Java/Scala
Annotation processing - KAPT
SAM conversions
Type equality
Lambda vs Closure
Reified generics
Fluent interfaces
Infix notation
Static extension methods in Kotlin
Generic types
Sealed classes
Dokka - documentation in Kotlin
J2K converter
Real-world example
Reflection
Presentation is accompanied with an example project (StxInsider):
https://github.com/kosiara/stx-insider
Groovy is a dynamic language that provides different types of metaprogramming techniques. In this talk we’ll mainly see runtime metaprogramming. You’ll understand the Groovy Meta-Object-Protocol (MOP), the metaclass, how to intercept method calls, how to deal with method missing and property missing, the use of mixins, traits and categories. All of these topics will be explained with examples in order to understand them. Also, you’ll see a little bit about compile-time metaprogramming with AST Transformations. AST Transformations provide a wonderful way of manipulating code at compile time via modifications of the Abstract Syntax Tree. You’ll see a basic but powerful example of what we can do with AST transformations.
Slides from the talk we did with Maurice Naftalin for Devoxx Belgium 2019.
Functional programmers have been saying for decades that they know the way to the future.
Clearly they have been wrong, since imperative languages are still far more popular.
Clearly they have also been right, as the advantages of functional programming have become increasingly obvious. Is it possible to face both ways, and combine the two models?
Scala is one language that does this, and Java too has been on a journey, which still continues, of learning from functional languages and carefully adding features from them.
In this talk, we will review what Java has learned from functional languages, what it can still learn, and how its added features compare to Scala's original ones.
StxNext Lightning Talks - Feb 12, 2016
Kotlin - one of the popular programming languages built on top of Java that runs on JVM. Thanks to JetBrains support and excellent IDE integration, it’s an ideal choice when it comes to Android development. 100% Java compatibility, interoperability and no runtime overhead is just the beginning of a long list of strengths. Kotlin is supposed to be a subset of SCALA, on one hand covering major advantages for developers and on the other - keeping short compile times.
This presentation is a Developer Starter - a set of hand-picked information allowing a person with no knowledge of Kotlin to start writing basic Android activities and set up an Android-kotlin project. It starts with language background, reasons for its creation and advantages. Then presents basic use cases, syntax, structures and patterns. Later on Kotlin is presented in Android context. Simple project structure, imports and Kotlin usage with Android SDK is explained. In the end cost of Kotlin usage is presented and the language is compared to SCALA and SWIFT.
This presentation is from the 22nd Tcl Conference (Manassas, VA, 21-23 October 2015). It's where I describe where we've got up to with compiling Tcl to native machine code.
Will talk about kotlin the language and new concepts introduced in the language including functional programming.
And how to use your springframework knowlege to write more concise and elegant backend systems.
We will demo a backend written in spring boot and kotlin and will see how it is so easy to interoperate between java and kotlin code.
This was a presentation I gave at the 17th Tcl Conference, in Oakbrook Terrace, IL, in 2010. It describes some of the more sophisticated things that it is possible to do with the new Tcl object system, TclOO.
The Kotlin 101 presentation was the very first presentation of the Kotlin Usergroup Vienna (https://www.meetup.com/Kotlin-Vienna/), held at a meeting from the Java Student Usergroup in 2016 (https://www.meetup.com/Java-Vienna/). It explains the raw (syntactical) fundamentals of the language targeting a Java developer audience.
Since the release of Java 1.4.2 most of the developers thought the language designed by Sun was a blast for object-oriented programming and through the years a lot of so-called Java-design-patterns infected object-thinking and development process showing us tedious language syntax and dark magics. Then, 15 years later, a language by JetBrains tries to simplify the things: Kotlin, what is it? What does it try to simplify? Let's see at least 7 inconvenient Java aspects fixed in Kotlin
Gadsu is a home made software to aid a Shiatsu practitioner in managing clients, appointments and medical data in combination with an expert system providing TCM inferred diagnosis.
It's written in Kotlin, using good old Swing.
Le slide deck de l'Université que nous avons donnée avec Rémi Forax à Devoxx France 2019.
Comme promis, Java sort sa version majeure tous les 6 mois. Le train passe et amène son lot de nouveautés. Parmi elles, certaines sont sorties : une nouvelle syntaxe pour les clauses switch et l'instruction de byte code CONSTANT_DYNAMIC. D'autres sont en chantier, plus ou moins avancé : une nouvelle façon d'écrire des méthodes de façon condensée, un instanceof 'intelligent', des constantes évaluées au moment où elles sont utilisées. Les projets progressent. Loom, et son nouveau modèle de programmation concurrente que l'ont peut tester avec Jetty. Amber, qui introduit les data types et des nouvelles syntaxes. Valhalla, dont les value types donnent leurs premiers résultats. S'il est difficile de prévoir une date de sortie pour ces nouveautés, on sait en revanche qu'une fois prêtes elles sortiront en moins de 6 mois. De tout ceci nous parlerons donc au futur et en public, avec des démonstrations de code, des slides, du code, de la joie et de la bonne humeur !
Slides from the talk we did with Maurice Naftalin for Devoxx Belgium 2019.
Functional programmers have been saying for decades that they know the way to the future.
Clearly they have been wrong, since imperative languages are still far more popular.
Clearly they have also been right, as the advantages of functional programming have become increasingly obvious. Is it possible to face both ways, and combine the two models?
Scala is one language that does this, and Java too has been on a journey, which still continues, of learning from functional languages and carefully adding features from them.
In this talk, we will review what Java has learned from functional languages, what it can still learn, and how its added features compare to Scala's original ones.
StxNext Lightning Talks - Feb 12, 2016
Kotlin - one of the popular programming languages built on top of Java that runs on JVM. Thanks to JetBrains support and excellent IDE integration, it’s an ideal choice when it comes to Android development. 100% Java compatibility, interoperability and no runtime overhead is just the beginning of a long list of strengths. Kotlin is supposed to be a subset of SCALA, on one hand covering major advantages for developers and on the other - keeping short compile times.
This presentation is a Developer Starter - a set of hand-picked information allowing a person with no knowledge of Kotlin to start writing basic Android activities and set up an Android-kotlin project. It starts with language background, reasons for its creation and advantages. Then presents basic use cases, syntax, structures and patterns. Later on Kotlin is presented in Android context. Simple project structure, imports and Kotlin usage with Android SDK is explained. In the end cost of Kotlin usage is presented and the language is compared to SCALA and SWIFT.
This presentation is from the 22nd Tcl Conference (Manassas, VA, 21-23 October 2015). It's where I describe where we've got up to with compiling Tcl to native machine code.
Will talk about kotlin the language and new concepts introduced in the language including functional programming.
And how to use your springframework knowlege to write more concise and elegant backend systems.
We will demo a backend written in spring boot and kotlin and will see how it is so easy to interoperate between java and kotlin code.
This was a presentation I gave at the 17th Tcl Conference, in Oakbrook Terrace, IL, in 2010. It describes some of the more sophisticated things that it is possible to do with the new Tcl object system, TclOO.
The Kotlin 101 presentation was the very first presentation of the Kotlin Usergroup Vienna (https://www.meetup.com/Kotlin-Vienna/), held at a meeting from the Java Student Usergroup in 2016 (https://www.meetup.com/Java-Vienna/). It explains the raw (syntactical) fundamentals of the language targeting a Java developer audience.
Since the release of Java 1.4.2 most of the developers thought the language designed by Sun was a blast for object-oriented programming and through the years a lot of so-called Java-design-patterns infected object-thinking and development process showing us tedious language syntax and dark magics. Then, 15 years later, a language by JetBrains tries to simplify the things: Kotlin, what is it? What does it try to simplify? Let's see at least 7 inconvenient Java aspects fixed in Kotlin
Gadsu is a home made software to aid a Shiatsu practitioner in managing clients, appointments and medical data in combination with an expert system providing TCM inferred diagnosis.
It's written in Kotlin, using good old Swing.
Le slide deck de l'Université que nous avons donnée avec Rémi Forax à Devoxx France 2019.
Comme promis, Java sort sa version majeure tous les 6 mois. Le train passe et amène son lot de nouveautés. Parmi elles, certaines sont sorties : une nouvelle syntaxe pour les clauses switch et l'instruction de byte code CONSTANT_DYNAMIC. D'autres sont en chantier, plus ou moins avancé : une nouvelle façon d'écrire des méthodes de façon condensée, un instanceof 'intelligent', des constantes évaluées au moment où elles sont utilisées. Les projets progressent. Loom, et son nouveau modèle de programmation concurrente que l'ont peut tester avec Jetty. Amber, qui introduit les data types et des nouvelles syntaxes. Valhalla, dont les value types donnent leurs premiers résultats. S'il est difficile de prévoir une date de sortie pour ces nouveautés, on sait en revanche qu'une fois prêtes elles sortiront en moins de 6 mois. De tout ceci nous parlerons donc au futur et en public, avec des démonstrations de code, des slides, du code, de la joie et de la bonne humeur !
Meetup di GDG Italia - Leonardo Pirro - Codemotion Rome 2018 Codemotion
I Google Developer Group (GDG) sono una community internazionale di appassionati delle tecnologie: sviluppatori, designer e startupper. Sono suddivisi per città, e GDG Italia è la famiglia che rappresenta tutti i gruppi presenti sul territorio locale. Mike Trizio e Carmelo Ventimiglia introdurranno i GDG, le loro attività e perchè è utile e divertente farne parte. Leonardo Pirro invece ci introdurrà Kotlin, un linguaggio di programmazione che ha avuto un crescente successo negli ultimi anni. Analizzeremo le caratteristiche principali del linguaggio e i suoi vantaggi/benefici rispetto a Java.
Madrid gug - sacando partido a las transformaciones ast de groovyIván López Martín
Groovy es un gran lenguaje con capacidades muy potentes de metaprogramación en tiempo de compilación. ¿Sabías que hay más de 40 transformaciones AST disponibles para hacernos la vida más fácil como desarrolladores?
En esta charla aprenderás las transformaciones más importantes que proporciona Groovy a través de muchos ejemplos para explicar todos los conceptos.
Kotlin is a JVM language developed by Jetbrains. Its version 1.0 (production ready) was released at the beginning of the year and made some buzz within the android community. This session proposes to discover this language, which takes up some aspects of groovy or scala, and that is very close to swift in syntax and concepts. We will see how Kotlin boosts the productivity of Java & Android application development and how well it accompanies reactive development.
Groovy is a great language with extremely powerful capabilities about compile time meta-programming. Do you know that provides more than 40 AST transformations out-of-the box just to make your life as a developer easier?
In this talk you will learn the most important transformations provided by Groovy. I'll use a lot of code examples to explain all the concepts.
Ever wonder what this "new" Kotlin thing is? Curious what the syntax looks like? Unsure how to implement this at your own company? Or do you just want to know what Nick and Cody's favorite things are about this language?
All that and (maybe) more are revealed in Privet Kotlin.
Groovy speech I held last year for introducing a new JVM language as substitute of Java. Easy and intuitive, it offers new features unknow to its parent yet.
HotSpot, the JVM we all know and love, is the brain in which our Java and Scala juices flow. At its core lies the JIT (“Just-In-Time”) compiler, whose sole purpose is to make your code run fast. Here are some of the more interesting optimizations performed by it.
Greach 2015 AST – Groovy Transformers: More than meets the eye!Iván López Martín
Slides for my Greach 2015 talk: http://greachconf.com/speakers/ivan-lopez-ast-groovy-transformers-more-than-meets-the-eye/
The source code is: https://github.com/lmivan/greach2015
Groovy is a great language with extremely powerful capabilities about compile time meta-programming. Do you know that provides more than 40 AST transformations out-of-the box just to make your life as a developer easier?
In this talk you will learn the most important transformations provided by Groovy. I’ll use a lot of code examples to explain all the concepts.
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
"Impact of front-end architecture on development cost", Viktor TurskyiFwdays
I have heard many times that architecture is not important for the front-end. Also, many times I have seen how developers implement features on the front-end just following the standard rules for a framework and think that this is enough to successfully launch the project, and then the project fails. How to prevent this and what approach to choose? I have launched dozens of complex projects and during the talk we will analyze which approaches have worked for me and which have not.
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
Here is something new! In our next Connector Corner webinar, we will demonstrate how you can use a single workflow to:
Create a campaign using Mailchimp with merge tags/fields
Send an interactive Slack channel message (using buttons)
Have the message received by managers and peers along with a test email for review
But there’s more:
In a second workflow supporting the same use case, you’ll see:
Your campaign sent to target colleagues for approval
If the “Approve” button is clicked, a Jira/Zendesk ticket is created for the marketing design team
But—if the “Reject” button is pushed, colleagues will be alerted via Slack message
Join us to learn more about this new, human-in-the-loop capability, brought to you by Integration Service connectors.
And...
Speakers:
Akshay Agnihotri, Product Manager
Charlie Greenberg, Host
Search and Society: Reimagining Information Access for Radical FuturesBhaskar Mitra
The field of Information retrieval (IR) is currently undergoing a transformative shift, at least partly due to the emerging applications of generative AI to information access. In this talk, we will deliberate on the sociotechnical implications of generative AI for information access. We will argue that there is both a critical necessity and an exciting opportunity for the IR community to re-center our research agendas on societal needs while dismantling the artificial separation between the work on fairness, accountability, transparency, and ethics in IR and the rest of IR research. Instead of adopting a reactionary strategy of trying to mitigate potential social harms from emerging technologies, the community should aim to proactively set the research agenda for the kinds of systems we should build inspired by diverse explicitly stated sociotechnical imaginaries. The sociotechnical imaginaries that underpin the design and development of information access technologies needs to be explicitly articulated, and we need to develop theories of change in context of these diverse perspectives. Our guiding future imaginaries must be informed by other academic fields, such as democratic theory and critical theory, and should be co-developed with social science scholars, legal scholars, civil rights and social justice activists, and artists, among others.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
6. Frege’s Essence
● Pure, non-strict functional language
● Strictly-typed, Hindley-Milner type inference
● Java interoperation with elegance
7. “Hello, World” in Haskell
module Hello where
greeting :: String -> String
greeting name = “Hello, ” ++ name
main :: IO ()
main = do
putStrLn $ greeting “World”
8. “Hello, World” in Frege
module Hello where
greeting :: String -> String
greeting name = “Hello, ” ++ name
main :: [String] -> IO ()
main args = do
putStrLn $ greeting “World”
10. “Learn you a Haskell” Translation
● All example snipets into Frege
○ https://github.com/y-taka-23/learn-you-a-frege
● Compilable even in “dead-copied” translation
11. Compatibility with Haskell
● Syntax, standard libs : almost compatible!
● Hard to use in “practical” Haskell
○ External dependencies
○ Most of GHC extensions
○ Template Haskell
● Java interoperation is necessary
13. Advantage of JVM Languages
● Platform-independent
○ Frege compiler generates Java source codes
● Feel free to invoke Java libraries
○ But pretty different regarding side-effects
■ Frege : Pure
■ Java : Impure, objects have own states
14. Can we invoke Java in nicer way
with Frege’s purity?
15. “Levels” of Java’s Impurity
● Immutable
○ ???
● Mutable, but without I/O
○ ???
● With I/O
○ ???
16. “Levels” of Java’s Impurity
● Immutable
○ Maps to Frege’s data types directly
● Mutable, but without I/O
○ ???
● With I/O
○ ???
17. Immutable Classes
data JBigInt =
pure native java.math.BigInteger where
pure native new :: String -> JBigInt
pure native add :: JBigInt -> JBigInt
-> JBigInt
add3 :: JBigInt -> JBigInt -> JBigInt
-> JBigInt
add3 n1 n2 n3 = (n1.add n2).add n3
18. Immutable Classes
data JBigInt =
pure native java.math.BigInteger where
pure native new :: String -> JBigInt
pure native add :: JBigInt -> JBigInt
-> JBigInt
add3 :: JBigInt -> JBigInt -> JBigInt
-> JBigInt
add3 n1 n2 n3 = (n1.add n2).add n3
the identifier for Frege
19. Immutable Classes
data JBigInt =
pure native java.math.BigInteger where
pure native new :: String -> JBigInt
pure native add :: JBigInt -> JBigInt
-> JBigInt
add3 :: JBigInt -> JBigInt -> JBigInt
-> JBigInt
add3 n1 n2 n3 = (n1.add n2).add n3
“pure native”, if it’s immutable
20. Immutable Classes
data JBigInt =
pure native java.math.BigInteger where
pure native new :: String -> JBigInt
pure native add :: JBigInt -> JBigInt
-> JBigInt
add3 :: JBigInt -> JBigInt -> JBigInt
-> JBigInt
add3 n1 n2 n3 = (n1.add n2).add n3
the FQCN in Java
21. Immutable Classes
data JBigInt =
pure native java.math.BigInteger where
pure native new :: String -> JBigInt
pure native add :: JBigInt -> JBigInt
-> JBigInt
add3 :: JBigInt -> JBigInt -> JBigInt
-> JBigInt
add3 n1 n2 n3 = (n1.add n2).add n3
the constructor
22. Immutable Classes
data JBigInt =
pure native java.math.BigInteger where
pure native new :: String -> JBigInt
pure native add :: JBigInt -> JBigInt
-> JBigInt
add3 :: JBigInt -> JBigInt -> JBigInt
-> JBigInt
add3 n1 n2 n3 = (n1.add n2).add n3
BigInteger#add in Java
23. Immutable Classes
data JBigInt =
pure native java.math.BigInteger where
pure native new :: String -> JBigInt
pure native add :: JBigInt -> JBigInt
-> JBigInt
add3 :: JBigInt -> JBigInt -> JBigInt
-> JBigInt
add3 n1 n2 n3 = (n1.add n2).add n3
invoke the method by dot-notations
24. “Levels” of Java’s Impurity
● Immutable
○ Maps to Frege’s data types directly
● Mutable, but without I/O
○ ???
● With I/O
○ Maps to IO monads
25. Classes with I/O
data JFReader =
mutable native java.io.FileReader where
native new :: String -> IO JFReader
native read :: JFReader -> IO Int
readOneFrom :: String -> IO Int
readOneFrom filename = do
fr <- JFReader.new filename
fr.read
26. Classes with I/O
data JFReader =
mutable native java.io.FileReader where
native new :: String -> IO JFReader
native read :: JFReader -> IO Int
readOneFrom :: String -> IO Int
readOneFrom filename = do
fr <- JFReader.new filename
fr.read
“mutable native”, if it acts on I/O
27. Classes with I/O
data JFReader =
mutable native java.io.FileReader where
native new :: String -> IO JFReader
native read :: JFReader -> IO Int
readOneFrom :: String -> IO Int
readOneFrom filename = do
fr <- JFReader.new filename
fr.read
the return values are in IO contexts
28. Classes with I/O
data JFReader =
mutable native java.io.FileReader where
native new :: String -> IO JFReader
native read :: JFReader -> IO Int
readOneFrom :: String -> IO Int
readOneFrom filename = do
fr <- JFReader.new filename
fr.read
use them as IO monads
29. “Levels” of Java’s Impurity
● Immutable
○ Maps to Frege’s data types directly
● Mutable, but without I/O
○ ???
● With I/O
○ Maps to IO monads
30. “Outwardly Pure” Methods
public String greeting(String name) {
StringBuilder sb =
new StringBuilder(“Hello, ”);
sb.append(name);
return sb.toString();
}
32. “Outwardly Pure” Methods
public String greeting(String name) {
StringBuilder sb =
new StringBuilder(“Hello, ”);
sb.append(name);
return sb.toString();
}
but the return value is pure, though
34. “Levels” of Java’s Impurity
● Immutable
○ Maps to Frege’s data types directly
● Mutable, but without I/O
○ Maps to ST monads
● With I/O
○ Maps to IO monads
35. ST (State Transformer) Monads
● Encapsulates destructive mutations
● ST s TypeName
○ s represents ”unobservable” internal states
○ s must be a type variable
● We can retrieve pure values from the contexts
○ Unlike IO monads
36. Mutable Classes
data JBuilder =
native java.lang.StringBuilder where
native new :: String
-> ST s (Mutable s JBuilder)
native append :: Mutable s JBuilder
-> String
-> ST s (Mutable s JBuilder)
37. Mutable Classes
data JBuilder =
native java.lang.StringBuilder where
native new :: String
-> ST s (Mutable s JBuilder)
native append :: Mutable s JBuilder
-> String
-> ST s (Mutable s JBuilder)
“native”, if it has no I/O effects
38. Mutable Classes
data JBuilder =
native java.lang.StringBuilder where
native new :: String
-> ST s (Mutable s JBuilder)
native append :: Mutable s JBuilder
-> String
-> ST s (Mutable s JBuilder)
“unobservable” states
39. Mutable Classes
data JBuilder =
native java.lang.StringBuilder where
native new :: String
-> ST s (Mutable s JBuilder)
native append :: Mutable s JBuilder
-> String
-> ST s (Mutable s JBuilder)
wrap the values in “Mutable s”
40. Mutable Classes
data JBuilder =
native java.lang.StringBuilder where
native new :: String
-> ST s (Mutable s JBuilder)
native append :: Mutable s JBuilder
-> String
-> ST s (Mutable s JBuilder)
the return values are in ST contexts
41. Mutable Classes
greeting :: String -> ST s String
greeting name = do
sb <- JBuilder.new “Hello, ”
sb.append name
sb.toString
pureFunc :: String -> String
pureFunc name = (greeting name).run
42. Mutable Classes
greeting :: String -> ST s String
greeting name = do
sb <- JBuilder.new “Hello, ”
sb.append name
sb.toString
pureFunc :: String -> String
pureFunc name = (greeting name).run
use them as ST monads
43. Mutable Classes
greeting :: String -> ST s String
greeting name = do
sb <- JBuilder.new “Hello, ”
sb.append name
sb.toString
pureFunc :: String -> String
pureFunc name = (greeting name).run
“run” it to retrieve the pure value
44. Mutable Classes
greeting :: String -> ST s String
greeting name = do
sb <- JBuilder.new “Hello, ”
sb.append name
sb.toString
pureFunc :: String -> String
pureFunc name = (greeting name).run
we can regard it as a pure function
45. Summary
● Frege is the very Haskell for JVM
○ Syntax is just like Haskell’s
○ Pretty low learning cost for Haskellers
● Java interoperation with elegance
○ Compatible with the Haskell-like type system
○ Classify side-effects into pure, ST and IO
46. Have a Nice Frege Coding!
Presented by
CheshireCat (@y_taka_23)