SlideShare uma empresa Scribd logo
1 de 28
Baixar para ler offline
Welcome



woensdag 27 januari 2010
Haskell
                            Chris Eidhof




woensdag 27 januari 2010
Three things


                    • Strong types
                    • Purity
                    • Larger example


woensdag 27 januari 2010
Strong Types

                    • As programmers, we do a lot of testing:
                    • * Unit Testing
                    • * Debugging
                    • * Specification

woensdag 27 januari 2010
Strong Types


                    • Can we automate testing?



woensdag 27 januari 2010
List
                             Type-parameter
                                                   Constructor



                    •      data [a] = [] | a : [a]


              Type
                                     Constructor


woensdag 27 januari 2010
List Example


                             Example: List.hs




woensdag 27 januari 2010
Functions
                           Give me a list of a And I’ll return a
                                                  list of a

  •      reverse :: [a] -> [a]

  •      reverse []                      = []

  •      reverse (x:xs) = reverse xs ++ [x]

                Pattern Matching
                                    Example: Reverse.hs
woensdag 27 januari 2010
Purity



             •             State = Evil


woensdag 27 januari 2010
Purity

             •               Same Input
             •         ntial
                Refere cy
               Transp aren
                                 =
             •             Same output

woensdag 27 januari 2010
Purity

                    • No side effects:
                    • * Variables
                    • * I/O
                    • * launchMissiles()

woensdag 27 januari 2010
Example


                    •      sort :: [Int] -> [Int]


                     How do we know sort doesn’t launch missiles?




woensdag 27 januari 2010
Doing I/O


                    •      putStr :: String -> IO ()


                            The IO type shows us it’s not pure



woensdag 27 januari 2010
Laziness


                    •      if (x < 10 && x > 5)



                    •      Example: Lazy.hs




woensdag 27 januari 2010
Quickcheck


                    • Automatic testing of pure code.

                               Example: Reverse.hs


woensdag 27 januari 2010
Software
                           Transactional
                              Memory

                    • Composable transactions
                    • No deadlocks!


woensdag 27 januari 2010
Fusion



•   myFunction = map square . map toInt

•                          = map (square . toInt)


woensdag 27 januari 2010
Parallel code


                    •      map    :: (a -> b) -> [a] -> [b]

                    •      parMap :: (a -> b) -> [a] -> [b]




woensdag 27 januari 2010
Effects
                            Useful
                                         Most            Nirvana
                                       languages




                                                       Haskell

                           Useless
                                     Dangerous               Safe

                              Simon Peyton-Jones, Caging The Effects Monster
woensdag 27 januari 2010
Arc Challenge
                    •      Write a program that causes the url said (e.g. http://
                           localhost:port/said) to produce a page with an input field and
                           a submit button. When the submit button is pressed, that
                           should produce a second page with a single link saying "click
                           here." When that is clicked it should lead to a third page that
                           says "you said: ..." where ... is whatever the user typed in the
                           original input field. The third page must only show what the
                           user actually typed. I.e. the value entered in the input field
                           must not be passed in the url, or it would be possible to
                           change the behavior of the final page by editing the url.




woensdag 27 januari 2010
Arc Challenge
                    • Solution in Arc:
                    •      (defop said req

                             (aform [onlink "click here"
                               (pr "you said: " (arg _ "foo"))]
                               (input "foo")
                               (submit)))

                    •


woensdag 27 januari 2010
Arc Challenge


       arc = do name <- input
               link "click here"
               display $ "you said:" ++ name




                           See gist: http://gist.github.com/260052
woensdag 27 januari 2010
Arc Challenge (2)
                              input uses type-inference!

             arc2 = do  name  <- input
                        (x,y) <- input
                        link "click here"
                        display (add x y)
                        display ("you said:" ++ name)




woensdag 27 januari 2010
Read more
• Real World Haskell - http://book.realworldhaskell.org/
• Haskell.org - http://haskell.org
• Haskell Café - http://haskell.org/haskellwiki/Mailing_lists
• Planet Haskell - http://planet.haskell.org/
• Haskell reddit - http://haskell.reddit.com
•
woensdag 27 januari 2010
Getting Started

                    • 1. Install the Haskell Platform
                    • http://hackage.haskell.org/platform/
                    • 2. Haskell in 10 minutes
                    • http://haskell.org/haskellwiki/
                           Learn_Haskell_in_10_minutes



woensdag 27 januari 2010
Keep in touch


                    • http://github.com/chriseidhof
                    • @chriseidhof


woensdag 27 januari 2010
One more thing...




woensdag 27 januari 2010
Have fun



woensdag 27 januari 2010

Mais conteúdo relacionado

Mais procurados

String and string manipulation x
String and string manipulation xString and string manipulation x
String and string manipulation xShahjahan Samoon
 
A Prelude of Purity: Scaling Back ZIO
A Prelude of Purity: Scaling Back ZIOA Prelude of Purity: Scaling Back ZIO
A Prelude of Purity: Scaling Back ZIOJorge Vásquez
 
Property based Testing - generative data & executable domain rules
Property based Testing - generative data & executable domain rulesProperty based Testing - generative data & executable domain rules
Property based Testing - generative data & executable domain rulesDebasish Ghosh
 
Swift rocks! #1
Swift rocks! #1Swift rocks! #1
Swift rocks! #1Hackraft
 
Refinement Types for Haskell
Refinement Types for HaskellRefinement Types for Haskell
Refinement Types for HaskellMartin Ockajak
 
Swift Rocks #2: Going functional
Swift Rocks #2: Going functionalSwift Rocks #2: Going functional
Swift Rocks #2: Going functionalHackraft
 
Comparing Haskell & Scala
Comparing Haskell & ScalaComparing Haskell & Scala
Comparing Haskell & ScalaMartin Ockajak
 
Scala for Java Developers
Scala for Java DevelopersScala for Java Developers
Scala for Java DevelopersMartin Ockajak
 
Java Polymorphism Part 2
Java Polymorphism Part 2Java Polymorphism Part 2
Java Polymorphism Part 2AathikaJava
 
Scala: Functioneel programmeren in een object georiënteerde wereld
Scala: Functioneel programmeren in een object georiënteerde wereldScala: Functioneel programmeren in een object georiënteerde wereld
Scala: Functioneel programmeren in een object georiënteerde wereldWerner Hofstra
 
Value Objects, Full Throttle (to be updated for spring TC39 meetings)
Value Objects, Full Throttle (to be updated for spring TC39 meetings)Value Objects, Full Throttle (to be updated for spring TC39 meetings)
Value Objects, Full Throttle (to be updated for spring TC39 meetings)Brendan Eich
 
Yin Yangs of Software Development
Yin Yangs of Software DevelopmentYin Yangs of Software Development
Yin Yangs of Software DevelopmentNaveenkumar Muguda
 
Quark: A Purely-Functional Scala DSL for Data Processing & Analytics
Quark: A Purely-Functional Scala DSL for Data Processing & AnalyticsQuark: A Purely-Functional Scala DSL for Data Processing & Analytics
Quark: A Purely-Functional Scala DSL for Data Processing & AnalyticsJohn De Goes
 
Introduction to Simple.Data
Introduction to Simple.DataIntroduction to Simple.Data
Introduction to Simple.DataTim Bourguignon
 
From android/java to swift (3)
From android/java to swift (3)From android/java to swift (3)
From android/java to swift (3)allanh0526
 
The Ring programming language version 1.8 book - Part 37 of 202
The Ring programming language version 1.8 book - Part 37 of 202The Ring programming language version 1.8 book - Part 37 of 202
The Ring programming language version 1.8 book - Part 37 of 202Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 39 of 196
The Ring programming language version 1.7 book - Part 39 of 196The Ring programming language version 1.7 book - Part 39 of 196
The Ring programming language version 1.7 book - Part 39 of 196Mahmoud Samir Fayed
 
2.1 Recap From Day One
2.1 Recap From Day One2.1 Recap From Day One
2.1 Recap From Day Oneretronym
 

Mais procurados (20)

String and string manipulation x
String and string manipulation xString and string manipulation x
String and string manipulation x
 
A Prelude of Purity: Scaling Back ZIO
A Prelude of Purity: Scaling Back ZIOA Prelude of Purity: Scaling Back ZIO
A Prelude of Purity: Scaling Back ZIO
 
Property based Testing - generative data & executable domain rules
Property based Testing - generative data & executable domain rulesProperty based Testing - generative data & executable domain rules
Property based Testing - generative data & executable domain rules
 
Swift rocks! #1
Swift rocks! #1Swift rocks! #1
Swift rocks! #1
 
Refinement Types for Haskell
Refinement Types for HaskellRefinement Types for Haskell
Refinement Types for Haskell
 
Swift Rocks #2: Going functional
Swift Rocks #2: Going functionalSwift Rocks #2: Going functional
Swift Rocks #2: Going functional
 
Comparing Haskell & Scala
Comparing Haskell & ScalaComparing Haskell & Scala
Comparing Haskell & Scala
 
Scala for Java Developers
Scala for Java DevelopersScala for Java Developers
Scala for Java Developers
 
Java Polymorphism Part 2
Java Polymorphism Part 2Java Polymorphism Part 2
Java Polymorphism Part 2
 
Scala: Functioneel programmeren in een object georiënteerde wereld
Scala: Functioneel programmeren in een object georiënteerde wereldScala: Functioneel programmeren in een object georiënteerde wereld
Scala: Functioneel programmeren in een object georiënteerde wereld
 
Value Objects, Full Throttle (to be updated for spring TC39 meetings)
Value Objects, Full Throttle (to be updated for spring TC39 meetings)Value Objects, Full Throttle (to be updated for spring TC39 meetings)
Value Objects, Full Throttle (to be updated for spring TC39 meetings)
 
Yin Yangs of Software Development
Yin Yangs of Software DevelopmentYin Yangs of Software Development
Yin Yangs of Software Development
 
SacalaZa #1
SacalaZa #1SacalaZa #1
SacalaZa #1
 
Quark: A Purely-Functional Scala DSL for Data Processing & Analytics
Quark: A Purely-Functional Scala DSL for Data Processing & AnalyticsQuark: A Purely-Functional Scala DSL for Data Processing & Analytics
Quark: A Purely-Functional Scala DSL for Data Processing & Analytics
 
Python3
Python3Python3
Python3
 
Introduction to Simple.Data
Introduction to Simple.DataIntroduction to Simple.Data
Introduction to Simple.Data
 
From android/java to swift (3)
From android/java to swift (3)From android/java to swift (3)
From android/java to swift (3)
 
The Ring programming language version 1.8 book - Part 37 of 202
The Ring programming language version 1.8 book - Part 37 of 202The Ring programming language version 1.8 book - Part 37 of 202
The Ring programming language version 1.8 book - Part 37 of 202
 
The Ring programming language version 1.7 book - Part 39 of 196
The Ring programming language version 1.7 book - Part 39 of 196The Ring programming language version 1.7 book - Part 39 of 196
The Ring programming language version 1.7 book - Part 39 of 196
 
2.1 Recap From Day One
2.1 Recap From Day One2.1 Recap From Day One
2.1 Recap From Day One
 

Destaque

Functional Programming
Functional ProgrammingFunctional Programming
Functional Programmingchriseidhof
 
Web programming in Haskell
Web programming in HaskellWeb programming in Haskell
Web programming in Haskellchriseidhof
 
Reasonable RPC with Remotely
Reasonable RPC with RemotelyReasonable RPC with Remotely
Reasonable RPC with RemotelyTimothy Perrett
 
Iglesia de San Nicolás. Un monumento árabe en Madrid
Iglesia de San Nicolás. Un monumento árabe en MadridIglesia de San Nicolás. Un monumento árabe en Madrid
Iglesia de San Nicolás. Un monumento árabe en MadridLa Gatera de la Villa
 
Compositional I/O Stream in Scala
Compositional I/O Stream in ScalaCompositional I/O Stream in Scala
Compositional I/O Stream in ScalaC4Media
 
Visualising Data on Interactive Maps
Visualising Data on Interactive MapsVisualising Data on Interactive Maps
Visualising Data on Interactive MapsAnna Pawlicka
 
Caching In The Cloud
Caching In The CloudCaching In The Cloud
Caching In The CloudAlex Miller
 
Groovy concurrency
Groovy concurrencyGroovy concurrency
Groovy concurrencyAlex Miller
 
Scaling Your Cache
Scaling Your CacheScaling Your Cache
Scaling Your CacheAlex Miller
 
Stream Execution with Clojure and Fork/join
Stream Execution with Clojure and Fork/joinStream Execution with Clojure and Fork/join
Stream Execution with Clojure and Fork/joinAlex Miller
 
Scaling Hibernate with Terracotta
Scaling Hibernate with TerracottaScaling Hibernate with Terracotta
Scaling Hibernate with TerracottaAlex Miller
 
Project Fortress
Project FortressProject Fortress
Project FortressAlex Miller
 
Cracking clojure
Cracking clojureCracking clojure
Cracking clojureAlex Miller
 
Purely Functional I/O
Purely Functional I/OPurely Functional I/O
Purely Functional I/OC4Media
 
Java Concurrency Gotchas
Java Concurrency GotchasJava Concurrency Gotchas
Java Concurrency GotchasAlex Miller
 
Clojure: The Art of Abstraction
Clojure: The Art of AbstractionClojure: The Art of Abstraction
Clojure: The Art of AbstractionAlex Miller
 

Destaque (19)

Functional Programming
Functional ProgrammingFunctional Programming
Functional Programming
 
Web programming in Haskell
Web programming in HaskellWeb programming in Haskell
Web programming in Haskell
 
Reasonable RPC with Remotely
Reasonable RPC with RemotelyReasonable RPC with Remotely
Reasonable RPC with Remotely
 
Iglesia de San Nicolás. Un monumento árabe en Madrid
Iglesia de San Nicolás. Un monumento árabe en MadridIglesia de San Nicolás. Un monumento árabe en Madrid
Iglesia de San Nicolás. Un monumento árabe en Madrid
 
Compositional I/O Stream in Scala
Compositional I/O Stream in ScalaCompositional I/O Stream in Scala
Compositional I/O Stream in Scala
 
Visualising Data on Interactive Maps
Visualising Data on Interactive MapsVisualising Data on Interactive Maps
Visualising Data on Interactive Maps
 
Beyond Mere Actors
Beyond Mere ActorsBeyond Mere Actors
Beyond Mere Actors
 
Blogging ZOMG
Blogging ZOMGBlogging ZOMG
Blogging ZOMG
 
Caching In The Cloud
Caching In The CloudCaching In The Cloud
Caching In The Cloud
 
Groovy concurrency
Groovy concurrencyGroovy concurrency
Groovy concurrency
 
Cold Hard Cache
Cold Hard CacheCold Hard Cache
Cold Hard Cache
 
Scaling Your Cache
Scaling Your CacheScaling Your Cache
Scaling Your Cache
 
Stream Execution with Clojure and Fork/join
Stream Execution with Clojure and Fork/joinStream Execution with Clojure and Fork/join
Stream Execution with Clojure and Fork/join
 
Scaling Hibernate with Terracotta
Scaling Hibernate with TerracottaScaling Hibernate with Terracotta
Scaling Hibernate with Terracotta
 
Project Fortress
Project FortressProject Fortress
Project Fortress
 
Cracking clojure
Cracking clojureCracking clojure
Cracking clojure
 
Purely Functional I/O
Purely Functional I/OPurely Functional I/O
Purely Functional I/O
 
Java Concurrency Gotchas
Java Concurrency GotchasJava Concurrency Gotchas
Java Concurrency Gotchas
 
Clojure: The Art of Abstraction
Clojure: The Art of AbstractionClojure: The Art of Abstraction
Clojure: The Art of Abstraction
 

Semelhante a HN NL - Haskell

Behavior-Driven Development с RSpec и Cucumber
Behavior-Driven Development с RSpec и CucumberBehavior-Driven Development с RSpec и Cucumber
Behavior-Driven Development с RSpec и CucumberStefan Kanev
 
Campus Party 2010
Campus Party 2010Campus Party 2010
Campus Party 2010Fabio Akita
 
Value objects in JS - an ES7 work in progress
Value objects in JS - an ES7 work in progressValue objects in JS - an ES7 work in progress
Value objects in JS - an ES7 work in progressBrendan Eich
 
Пак ли този Rails?
Пак ли този Rails?Пак ли този Rails?
Пак ли този Rails?Stefan Kanev
 
2011 july-nyc-gtug-go
2011 july-nyc-gtug-go2011 july-nyc-gtug-go
2011 july-nyc-gtug-goikailan
 
Optimization In R
Optimization In ROptimization In R
Optimization In Rsyou6162
 

Semelhante a HN NL - Haskell (9)

Behavior-Driven Development с RSpec и Cucumber
Behavior-Driven Development с RSpec и CucumberBehavior-Driven Development с RSpec и Cucumber
Behavior-Driven Development с RSpec и Cucumber
 
Campus Party 2010
Campus Party 2010Campus Party 2010
Campus Party 2010
 
Mongo db
Mongo dbMongo db
Mongo db
 
Value objects in JS - an ES7 work in progress
Value objects in JS - an ES7 work in progressValue objects in JS - an ES7 work in progress
Value objects in JS - an ES7 work in progress
 
Web futures
Web futuresWeb futures
Web futures
 
Пак ли този Rails?
Пак ли този Rails?Пак ли този Rails?
Пак ли този Rails?
 
2011 july-nyc-gtug-go
2011 july-nyc-gtug-go2011 july-nyc-gtug-go
2011 july-nyc-gtug-go
 
Nagoya.R #1 Part 1
Nagoya.R #1 Part 1Nagoya.R #1 Part 1
Nagoya.R #1 Part 1
 
Optimization In R
Optimization In ROptimization In R
Optimization In R
 

Último

WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 

Último (20)

WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 

HN NL - Haskell

  • 2. Haskell Chris Eidhof woensdag 27 januari 2010
  • 3. Three things • Strong types • Purity • Larger example woensdag 27 januari 2010
  • 4. Strong Types • As programmers, we do a lot of testing: • * Unit Testing • * Debugging • * Specification woensdag 27 januari 2010
  • 5. Strong Types • Can we automate testing? woensdag 27 januari 2010
  • 6. List Type-parameter Constructor • data [a] = [] | a : [a] Type Constructor woensdag 27 januari 2010
  • 7. List Example Example: List.hs woensdag 27 januari 2010
  • 8. Functions Give me a list of a And I’ll return a list of a • reverse :: [a] -> [a] • reverse [] = [] • reverse (x:xs) = reverse xs ++ [x] Pattern Matching Example: Reverse.hs woensdag 27 januari 2010
  • 9. Purity • State = Evil woensdag 27 januari 2010
  • 10. Purity • Same Input • ntial Refere cy Transp aren = • Same output woensdag 27 januari 2010
  • 11. Purity • No side effects: • * Variables • * I/O • * launchMissiles() woensdag 27 januari 2010
  • 12. Example • sort :: [Int] -> [Int] How do we know sort doesn’t launch missiles? woensdag 27 januari 2010
  • 13. Doing I/O • putStr :: String -> IO () The IO type shows us it’s not pure woensdag 27 januari 2010
  • 14. Laziness • if (x < 10 && x > 5) • Example: Lazy.hs woensdag 27 januari 2010
  • 15. Quickcheck • Automatic testing of pure code. Example: Reverse.hs woensdag 27 januari 2010
  • 16. Software Transactional Memory • Composable transactions • No deadlocks! woensdag 27 januari 2010
  • 17. Fusion • myFunction = map square . map toInt • = map (square . toInt) woensdag 27 januari 2010
  • 18. Parallel code • map  :: (a -> b) -> [a] -> [b] • parMap :: (a -> b) -> [a] -> [b] woensdag 27 januari 2010
  • 19. Effects Useful Most Nirvana languages Haskell Useless Dangerous Safe Simon Peyton-Jones, Caging The Effects Monster woensdag 27 januari 2010
  • 20. Arc Challenge • Write a program that causes the url said (e.g. http:// localhost:port/said) to produce a page with an input field and a submit button. When the submit button is pressed, that should produce a second page with a single link saying "click here." When that is clicked it should lead to a third page that says "you said: ..." where ... is whatever the user typed in the original input field. The third page must only show what the user actually typed. I.e. the value entered in the input field must not be passed in the url, or it would be possible to change the behavior of the final page by editing the url. woensdag 27 januari 2010
  • 21. Arc Challenge • Solution in Arc: • (defop said req (aform [onlink "click here" (pr "you said: " (arg _ "foo"))] (input "foo") (submit))) • woensdag 27 januari 2010
  • 22. Arc Challenge arc = do name <- input           link "click here"           display $ "you said:" ++ name See gist: http://gist.github.com/260052 woensdag 27 januari 2010
  • 23. Arc Challenge (2) input uses type-inference! arc2 = do  name  <- input            (x,y) <- input            link "click here"            display (add x y)            display ("you said:" ++ name) woensdag 27 januari 2010
  • 24. Read more • Real World Haskell - http://book.realworldhaskell.org/ • Haskell.org - http://haskell.org • Haskell Café - http://haskell.org/haskellwiki/Mailing_lists • Planet Haskell - http://planet.haskell.org/ • Haskell reddit - http://haskell.reddit.com • woensdag 27 januari 2010
  • 25. Getting Started • 1. Install the Haskell Platform • http://hackage.haskell.org/platform/ • 2. Haskell in 10 minutes • http://haskell.org/haskellwiki/ Learn_Haskell_in_10_minutes woensdag 27 januari 2010
  • 26. Keep in touch • http://github.com/chriseidhof • @chriseidhof woensdag 27 januari 2010
  • 27. One more thing... woensdag 27 januari 2010
  • 28. Have fun woensdag 27 januari 2010