SlideShare a Scribd company logo
1 of 101
Download to read offline
Why Haskell?
   Susan Potter




   March 2012
What is Haskell?




    Figure:   "pure functional, lazy, polymorphic, statically and strongly typed with type inference . . . "
How can I drive this thing?




 Figure: Photo from "If programming languages were cars" blog post
           http://machinegestalt.posterous.com/if-programming-languages-were-cars
Can I drive Haskell without all this?




 Figure: No need to know Category Theory proofs, just some intuitions!
# finger $(whoami)


Login: susan               Name: Susan Potter
Directory: /home/susan     Shell: /bin/zsh
Practicing since 1997-09-29 21:18 (GMT) on tty1 from :0
Too much unread mail on me@susanpotter.net
Now working at Desk.com! Looking for smart developers!;)
Plan:
  github: mbbx6spp
  twitter: @SusanPotter
Are we "doing it wrong"?




         Figure: Maybe! ;)
          http://absolutelymadness.tumblr.com/post/17567574522
Overview: Choosing a language

    Many considerations
    political, human, technical


    Runtime
    performance, reliability, configurability


    Knowledge
    culture, mindshare, resources, signal to noise ratio


    Tooling
    development, build/release, configuration, deployment
Overview: Choosing a language

    Many considerations
    political, human, technical


    Runtime
    performance, reliability, configurability


    Knowledge
    culture, mindshare, resources, signal to noise ratio


    Tooling
    development, build/release, configuration, deployment
Overview: Choosing a language

    Many considerations
    political, human, technical


    Runtime
    performance, reliability, configurability


    Knowledge
    culture, mindshare, resources, signal to noise ratio


    Tooling
    development, build/release, configuration, deployment
Overview: Choosing a language

    Many considerations
    political, human, technical


    Runtime
    performance, reliability, configurability


    Knowledge
    culture, mindshare, resources, signal to noise ratio


    Tooling
    development, build/release, configuration, deployment
Overview: Agenda
    My Claims / Hypotheses

    Laziness, Functional, Type System

    Toolkit & Runtime

    Library Ecosystem

    Pitfalls & Hurdles
My Claims
    Performance is reasonable
    on par with Java and C# Mono; 2-3x CPU times of C (approx); BUT always doubt benchmarks

    http://shootout.alioth.debian.org/u64q/haskell.php



    Productivity with long-term benefits
    after initial steep learning curve



    Haskell types offer stronger verifiability
    strong and meaningful checks applied



    Pure functional code is easier to test
    probably not controversial
My Claims
    Performance is reasonable
    on par with Java and C# Mono; 2-3x CPU times of C (approx); BUT always doubt benchmarks

    http://shootout.alioth.debian.org/u64q/haskell.php



    Productivity with long-term benefits
    after initial steep learning curve



    Haskell types offer stronger verifiability
    strong and meaningful checks applied



    Pure functional code is easier to test
    probably not controversial
My Claims
    Performance is reasonable
    on par with Java and C# Mono; 2-3x CPU times of C (approx); BUT always doubt benchmarks

    http://shootout.alioth.debian.org/u64q/haskell.php



    Productivity with long-term benefits
    after initial steep learning curve



    Haskell types offer stronger verifiability
    strong and meaningful checks applied



    Pure functional code is easier to test
    probably not controversial
My Claims
    Performance is reasonable
    on par with Java and C# Mono; 2-3x CPU times of C (approx); BUT always doubt benchmarks

    http://shootout.alioth.debian.org/u64q/haskell.php



    Productivity with long-term benefits
    after initial steep learning curve



    Haskell types offer stronger verifiability
    strong and meaningful checks applied



    Pure functional code is easier to test
    probably not controversial
Haskell "lazy" by default




       Figure: Photo by Mark Fischer
            http://www.flickr.com/photos/tom_ruaat/4431626234/
Haskell "lazy" by default




       Figure: Photo by Mark Fischer
            http://www.flickr.com/photos/tom_ruaat/4431626234/



           (jarring for mainstream programmers)
Example: doubleSum 3 (2 + 3)
       Call by value

    doubleSum 3 (2 + 3)
     → doubleSum 3 5
     → 2 * (3 + 5)
     → 2 * 8
     → 16

       Call by name

    doubleSum 3 (2 + 3)
     → (λ x -> 2 * (3 + x)) (2 + 3)
Example: doubleSum 3 (2 + 3)
       Call by value

    doubleSum 3 (2 + 3)
     → doubleSum 3 5
     → 2 * (3 + 5)
     → 2 * 8
     → 16

       Call by name

    doubleSum 3 (2 + 3)
     → (λ x -> 2 * (3 + x)) (2 + 3)
Example: doubleSum 3 (2 + 3)
       Call by value

    doubleSum 3 (2 + 3)
     → doubleSum 3 5
     → 2 * (3 + 5)
     → 2 * 8
     → 16

       Call by name

    doubleSum 3 (2 + 3)
     → (λ x -> 2 * (3 + x)) (2 + 3)
Example: doubleSum 3 (2 + 3)
       Call by value

    doubleSum 3 (2 + 3)
     → doubleSum 3 5
     → 2 * (3 + 5)
     → 2 * 8
     → 16

       Call by name

    doubleSum 3 (2 + 3)
     → (λ x -> 2 * (3 + x)) (2 + 3)
Example: doubleSum 3 (2 + 3)
       Call by value

    doubleSum 3 (2 + 3)
     → doubleSum 3 5
     → 2 * (3 + 5)
     → 2 * 8
     → 16

       Call by name

    doubleSum 3 (2 + 3)
     → (λ x -> 2 * (3 + x)) (2 + 3)
Example: doubleSum 3 (2 + 3)
       Call by value

    doubleSum 3 (2 + 3)
     → doubleSum 3 5
     → 2 * (3 + 5)
     → 2 * 8
     → 16

       Call by name

    doubleSum 3 (2 + 3)
     → (λ x -> 2 * (3 + x)) (2 + 3)
Example: doubleSum 3 (2 + 3)
       Call by value
       (evaluates inner-most expressions first)



    doubleSum 3 (2 + 3)
     → doubleSum 3 5
     → 2 * (3 + 5)
     → 2 * 8
     → 16

       Call by name

    doubleSum 3 (2 + 3)
     → (λ x -> 2 * (3 + x)) (2 + 3)
Example: doubleSum 3 (2 + 3)
       Call by value
       (evaluates inner-most expressions first)



    doubleSum 3 (2 + 3)
     → doubleSum 3 5
     → 2 * (3 + 5)
     → 2 * 8
     → 16

       Call by name

    doubleSum 3 (2 + 3)
     → (λ x -> 2 * (3 + x)) (2 + 3)
Example: doubleSum 3 (2 + 3)
       Call by value
       (evaluates inner-most expressions first)



    doubleSum 3 (2 + 3)
     → doubleSum 3 5
     → 2 * (3 + 5)
     → 2 * 8
     → 16

       Call by name

    doubleSum 3 (2 + 3)
     → (λ x -> 2 * (3 + x)) (2 + 3)
Example: doubleSum 3 (2 + 3)
       Call by value
       (evaluates inner-most expressions first)



    doubleSum 3 (2 + 3)
     → doubleSum 3 5
     → 2 * (3 + 5)
     → 2 * 8
     → 16

       Call by name

    doubleSum 3 (2 + 3)
     → (λ x -> 2 * (3 + x)) (2 + 3)
Example: doubleSum 3 (2 + 3)
       Call by value
       (evaluates inner-most expressions first)



    doubleSum 3 (2 + 3)
     → doubleSum 3 5
     → 2 * (3 + 5)
     → 2 * 8
     → 16

       Call by name
       (evaluates outer-most expressions first)



    doubleSum 3 (2 + 3)
     → (λ x -> 2 * (3 + x)) (2 + 3)
Laziness in Haskell is . . .

 CallByName

 + SharingOptimization

 + PossibleMinorOverhead
Laziness: Buyer Beware
    filter (λ x → x < 6) [1..]
    (never terminates)



    takeWhile (λ x → x < 6) [1..]
    (does terminate)



    dropWhile (λ x → x >= 6) [1..]
    (does not terminate)



    Need to understand implications
    of laziness on functions



    Laziness with I/O implications
    lazy I/O with handles is problematic, but iteratee idiom solves most of these. There are a number of libraries

    available to help with this: enumerator, pipes, . . .
Laziness: Buyer Beware
    filter (λ x → x < 6) [1..]
    (never terminates)



    takeWhile (λ x → x < 6) [1..]
    (does terminate)



    dropWhile (λ x → x >= 6) [1..]
    (does not terminate)



    Need to understand implications
    of laziness on functions



    Laziness with I/O implications
    lazy I/O with handles is problematic, but iteratee idiom solves most of these. There are a number of libraries

    available to help with this: enumerator, pipes, . . .
Laziness: Buyer Beware
    filter (λ x → x < 6) [1..]
    (never terminates)



    takeWhile (λ x → x < 6) [1..]
    (does terminate)



    dropWhile (λ x → x >= 6) [1..]
    (does not terminate)



    Need to understand implications
    of laziness on functions



    Laziness with I/O implications
    lazy I/O with handles is problematic, but iteratee idiom solves most of these. There are a number of libraries

    available to help with this: enumerator, pipes, . . .
Laziness: Buyer Beware
    filter (λ x → x < 6) [1..]
    (never terminates)



    takeWhile (λ x → x < 6) [1..]
    (does terminate)



    dropWhile (λ x → x >= 6) [1..]
    (does not terminate)



    Need to understand implications
    of laziness on functions



    Laziness with I/O implications
    lazy I/O with handles is problematic, but iteratee idiom solves most of these. There are a number of libraries

    available to help with this: enumerator, pipes, . . .
Laziness: Buyer Beware
    filter (λ x → x < 6) [1..]
    (never terminates)



    takeWhile (λ x → x < 6) [1..]
    (does terminate)



    dropWhile (λ x → x >= 6) [1..]
    (does not terminate)



    Need to understand implications
    of laziness on functions



    Laziness with I/O implications
    lazy I/O with handles is problematic, but iteratee idiom solves most of these. There are a number of libraries

    available to help with this: enumerator, pipes, . . .
Laziness: Also Pretty Suuweeeet!

     Infinite sequences/lists
     made possible



     Recursive functions
     become practical



     Recursive types
     become simple



     Much more as well ...
Laziness: Also Pretty Suuweeeet!

     Infinite sequences/lists
     made possible



     Recursive functions
     become practical



     Recursive types
     become simple



     Much more as well ...
Laziness: Also Pretty Suuweeeet!

     Infinite sequences/lists
     made possible



     Recursive functions
     become practical



     Recursive types
     become simple



     Much more as well ...
Laziness: Also Pretty Suuweeeet!

     Infinite sequences/lists
     made possible



     Recursive functions
     become practical



     Recursive types
     become simple



     Much more as well ...
Purity + Laziness=> Reasoning


     Equality (referential transparency)
     Can replace occurrences of LHS with RHS



     Higher Order Functions
     encourage exploitation of higher-level patterns



     Function Composition
     leads to greater reuse
Purity + Laziness=> Reasoning


     Equality (referential transparency)
     Can replace occurrences of LHS with RHS



     Higher Order Functions
     encourage exploitation of higher-level patterns



     Function Composition
     leads to greater reuse
Purity + Laziness=> Reasoning


     Equality (referential transparency)
     Can replace occurrences of LHS with RHS



     Higher Order Functions
     encourage exploitation of higher-level patterns



     Function Composition
     leads to greater reuse
mysum :: Num a => [a] -> a
mysum xs = foldr (+) 0 xs

myproduct :: Num a => [a] -> a
myproduct xs = foldr (*) 1 xs

myany :: (a -> Bool) -> [a] -> Bool
myany pred xs = foldr ( x b -> b || pred x) False xs

myall :: (a -> Bool) -> [a] -> Bool
myall pred xs = foldr ( x b -> b && pred x) True xs
mysum :: Num a => [a] -> a
mysum xs = foldr (+) 0 xs

myproduct :: Num a => [a] -> a
myproduct xs = foldr (*) 1 xs

myany :: (a -> Bool) -> [a] -> Bool
myany pred xs = foldr ( x b -> b || pred x) False xs

myall :: (a -> Bool) -> [a] -> Bool
myall pred xs = foldr ( x b -> b && pred x) True xs
mysum :: Num a => [a] -> a
mysum xs = foldr (+) 0 xs

myproduct :: Num a => [a] -> a
myproduct xs = foldr (*) 1 xs

myany :: (a -> Bool) -> [a] -> Bool
myany pred xs = foldr ( x b -> b || pred x) False xs

myall :: (a -> Bool) -> [a] -> Bool
myall pred xs = foldr ( x b -> b && pred x) True xs
mysum :: Num a => [a] -> a
mysum xs = foldr (+) 0 xs

myproduct :: Num a => [a] -> a
myproduct xs = foldr (*) 1 xs

myany :: (a -> Bool) -> [a] -> Bool
myany pred xs = foldr ( x b -> b || pred x) False xs

myall :: (a -> Bool) -> [a] -> Bool
myall pred xs = foldr ( x b -> b && pred x) True xs
mysum :: Num a => [a] -> a
mysum xs = foldr (+) 0 xs

myproduct :: Num a => [a] -> a
myproduct xs = foldr (*) 1 xs

myany :: (a -> Bool) -> [a] -> Bool
myany pred xs = foldr ( x b -> b || pred x) False xs

myall :: (a -> Bool) -> [a] -> Bool
myall pred xs = foldr ( x b -> b && pred x) True xs
mysum :: Num a => [a] -> a
mysum xs = foldr (+) 0 xs

myproduct :: Num a => [a] -> a
myproduct xs = foldr (*) 1 xs

myany :: (a -> Bool) -> [a] -> Bool
myany pred xs = foldr ( x b -> b || pred x) False xs

myall :: (a -> Bool) -> [a] -> Bool
myall pred xs = foldr ( x b -> b && pred x) True xs
mysum :: Num a => [a] -> a
mysum xs = foldr (+) 0 xs

myproduct :: Num a => [a] -> a
myproduct xs = foldr (*) 1 xs

myany :: (a -> Bool) -> [a] -> Bool
myany pred xs = foldr ( x b -> b || pred x) False xs

myall :: (a -> Bool) -> [a] -> Bool
myall pred xs = foldr ( x b -> b && pred x) True xs
class Monoid m where
  mappend :: m -> m -> m
  mempty :: m

instance Num a => Monoid a where
  mappend :: m -> m -> m
  mappend x y = (+) x y
  mempty :: m
  mempty = 0

instance Monoid Bool where
  mappend :: m -> m -> m
  mappend True _ = True
  mappend _ True = True
  mappend _ _ = False
  mempty :: m
class Monoid m where
  mappend :: m -> m -> m
  mempty :: m

instance Num a => Monoid a where
  mappend :: m -> m -> m
  mappend x y = (+) x y
  mempty :: m
  mempty = 0

instance Monoid Bool where
  mappend :: m -> m -> m
  mappend True _ = True
  mappend _ True = True
  mappend _ _ = False
  mempty :: m
class Monoid m where
  mappend :: m -> m -> m
  mempty :: m

instance Num a => Monoid a where
  mappend :: m -> m -> m
  mappend x y = (+) x y
  mempty :: m
  mempty = 0

instance Monoid Bool where
  mappend :: m -> m -> m
  mappend True _ = True
  mappend _ True = True
  mappend _ _ = False
  mempty :: m
Haskell type signatures can . . .
     express side effects
     e.g. String -> IO Int

     declare computational strategies
     e.g. Num a => [a] -> Sum a

     impose constraints
     e.g. Num a => a -> a

     question value availability
     e.g. String -> Maybe Int

     verify client-server protocol dialogs?
     an exercise for reader ;)
Haskell type signatures can . . .
     express side effects
     e.g. String -> IO Int

     declare computational strategies
     e.g. Num a => [a] -> Sum a

     impose constraints
     e.g. Num a => a -> a

     question value availability
     e.g. String -> Maybe Int

     verify client-server protocol dialogs?
     an exercise for reader ;)
Haskell type signatures can . . .
     express side effects
     e.g. String -> IO Int

     declare computational strategies
     e.g. Num a => [a] -> Sum a

     impose constraints
     e.g. Num a => a -> a

     question value availability
     e.g. String -> Maybe Int

     verify client-server protocol dialogs?
     an exercise for reader ;)
Haskell type signatures can . . .
     express side effects
     e.g. String -> IO Int

     declare computational strategies
     e.g. Num a => [a] -> Sum a

     impose constraints
     e.g. Num a => a -> a

     question value availability
     e.g. String -> Maybe Int

     verify client-server protocol dialogs?
     an exercise for reader ;)
Haskell type signatures can . . .
     express side effects
     e.g. String -> IO Int

     declare computational strategies
     e.g. Num a => [a] -> Sum a

     impose constraints
     e.g. Num a => a -> a

     question value availability
     e.g. String -> Maybe Int

     verify client-server protocol dialogs?
     an exercise for reader ;)
Interfaces in OO . . .




  Figure: Class definitions are married to the interfaces they implement.
Interfaces in Haskell: Typeclasses. . .

     Decouple type definition from interface
     Allow upstream implementations
     Extend thirdparty libraries easily
     Redefine implementations upstream
     No meaningless "any type" functions

     Very flexible
Interfaces in Haskell: Typeclasses. . .

     Decouple type definition from interface
     Allow upstream implementations
     Extend thirdparty libraries easily
     Redefine implementations upstream
     No meaningless "any type" functions

     Very flexible
Interfaces in Haskell: Typeclasses. . .

     Decouple type definition from interface
     Allow upstream implementations
     Extend thirdparty libraries easily
     Redefine implementations upstream
     No meaningless "any type" functions

     Very flexible
Interfaces in Haskell: Typeclasses. . .

     Decouple type definition from interface
     Allow upstream implementations
     Extend thirdparty libraries easily
     Redefine implementations upstream
     No meaningless "any type" functions

     Very flexible
Interfaces in Haskell: Typeclasses. . .

     Decouple type definition from interface
     Allow upstream implementations
     Extend thirdparty libraries easily
     Redefine implementations upstream
     No meaningless "any type" functions

     Very flexible
Interfaces in Haskell: Typeclasses. . .

     Decouple type definition from interface
     Allow upstream implementations
     Extend thirdparty libraries easily
     Redefine implementations upstream
     No meaningless "any type" functions

     Very flexible
class (Eq a) => Ord a where
  compare                 :: a -> a -> Ordering
  compare x y | x == y    = EQ
              | x <= y    = LT
              | otherwise = GT
  (<), (>), (>=), (<=)    :: a -> a -> Bool
  ...
  max, min                :: a -> a -> a
  ...
Typically this just works . . .
   data SimpleShape = Square { size :: Double }
                    | Circle { radius :: Double }
                    deriving (Eq, Ord, Show)
     We explicitly use the default definitions


. . . and when it doesn’t . . .
   instance Ord SimpleShape where
     ...
Are you awake?




 Figure: http://absolutelymadness.tumblr.com/post/18126913457
Haskell Tooling: Libraries


         Quite a few
         Practical libraries
         Often freely available
         Permissive OSS licenses
Haskell Tooling: Libraries


         Quite a few
         Practical libraries
         Often freely available
         Permissive OSS licenses
Haskell Tooling: Libraries


         Quite a few
         Practical libraries
         Often freely available
         Permissive OSS licenses
Haskell Tooling: Libraries


         Quite a few
         Practical libraries
         Often freely available
         Permissive OSS licenses
Haskell Tooling: Runtime


         Reasonably performant
         between JVM 7 and C# Mono performance



         GC settings easily customized
         Numerous other runtime options
Haskell Tooling: Runtime


         Reasonably performant
         between JVM 7 and C# Mono performance



         GC settings easily customized
         Numerous other runtime options
Haskell Tooling: Runtime


         Reasonably performant
         between JVM 7 and C# Mono performance



         GC settings easily customized
         Numerous other runtime options
Haskell Tooling: Tools

         Testing tools
         QuickCheck, HUnit



         Documentation tools
         Haddock, Hoogle (lookup documentation)



         Build tools
         Cabal, cabal-dev, cabal-nirvana, see "next slide"
Haskell Tooling: Tools

         Testing tools
         QuickCheck, HUnit



         Documentation tools
         Haddock, Hoogle (lookup documentation)



         Build tools
         Cabal, cabal-dev, cabal-nirvana, see "next slide"
Haskell Tooling: Tools

         Testing tools
         QuickCheck, HUnit



         Documentation tools
         Haddock, Hoogle (lookup documentation)



         Build tools
         Cabal, cabal-dev, cabal-nirvana, see "next slide"
Haskell Tooling: Dependency
Management
        Hackage
        database of freely available Haskell libraries



        Cabal
        great to get started, BUT . . .



        cabal-dev & similar
        provides sandboxing, list RVM with gemsets; more important for statically typed environments



        cabal-nirvana
        think compatible distribution snapshot of Hackage DB
Haskell Tooling: Dependency
Management
        Hackage
        database of freely available Haskell libraries



        Cabal
        great to get started, BUT . . .



        cabal-dev & similar
        provides sandboxing, list RVM with gemsets; more important for statically typed environments



        cabal-nirvana
        think compatible distribution snapshot of Hackage DB
Haskell Tooling: Dependency
Management
        Hackage
        database of freely available Haskell libraries



        Cabal
        great to get started, BUT . . .



        cabal-dev & similar
        provides sandboxing, list RVM with gemsets; more important for statically typed environments



        cabal-nirvana
        think compatible distribution snapshot of Hackage DB
Haskell Tooling: Dependency
Management
        Hackage
        database of freely available Haskell libraries



        Cabal
        great to get started, BUT . . .



        cabal-dev & similar
        provides sandboxing, list RVM with gemsets; more important for statically typed environments



        cabal-nirvana
        think compatible distribution snapshot of Hackage DB
Haskell Tooling: Don’ts for Newbies

     Use GHC (not HUGS)
     Hugs written for educational purposes not industrial usage



     Forget what you know (imperative/OO)
     relearn programming in a functional-style



     return is a function name
     it does not mean return in the C/Java/C# way



     class does not mean OO-class
     think decoupled interface with optional default impelementations and a lot more power
Haskell Tooling: Don’ts for Newbies

     Use GHC (not HUGS)
     Hugs written for educational purposes not industrial usage



     Forget what you know (imperative/OO)
     relearn programming in a functional-style



     return is a function name
     it does not mean return in the C/Java/C# way



     class does not mean OO-class
     think decoupled interface with optional default impelementations and a lot more power
Haskell Tooling: Don’ts for Newbies

     Use GHC (not HUGS)
     Hugs written for educational purposes not industrial usage



     Forget what you know (imperative/OO)
     relearn programming in a functional-style



     return is a function name
     it does not mean return in the C/Java/C# way



     class does not mean OO-class
     think decoupled interface with optional default impelementations and a lot more power
Haskell Tooling: Don’ts for Newbies

     Use GHC (not HUGS)
     Hugs written for educational purposes not industrial usage



     Forget what you know (imperative/OO)
     relearn programming in a functional-style



     return is a function name
     it does not mean return in the C/Java/C# way



     class does not mean OO-class
     think decoupled interface with optional default impelementations and a lot more power
Haskell Tooling: Suggestions

         Explicit language extensions
         Intentionally and explicitly enable per module



         Sandbox your builds
         with cabal-dev or similar



         Think in types and shapes
         and use Hoogle to lookup based on types and function "shapes"
Haskell Tooling: Suggestions

         Explicit language extensions
         Intentionally and explicitly enable per module



         Sandbox your builds
         with cabal-dev or similar



         Think in types and shapes
         and use Hoogle to lookup based on types and function "shapes"
Haskell Tooling: Suggestions

         Explicit language extensions
         Intentionally and explicitly enable per module



         Sandbox your builds
         with cabal-dev or similar



         Think in types and shapes
         and use Hoogle to lookup based on types and function "shapes"
Oh, the possibilities!
     Parallel / Concurrency Options
     threads, dataflow, par, seq



     "Cloud" Haskell
     A kind of Erlang/OTP clone in Haskell



     Data Parallel Haskell
     GHC extensions to support nested data parallelism accounting, "Nepal"



     Haskell’s Foreign Function Interface (FFI)
     Interface with native code from Haskell



     GPU Programming in Haskell
     Obsidian, Nikola, GpuGen, numerous papers on this too



     Much more. . .
     Research meeting industrial application
Oh, the possibilities!
     Parallel / Concurrency Options
     threads, dataflow, par, seq



     "Cloud" Haskell
     A kind of Erlang/OTP clone in Haskell



     Data Parallel Haskell
     GHC extensions to support nested data parallelism accounting, "Nepal"



     Haskell’s Foreign Function Interface (FFI)
     Interface with native code from Haskell



     GPU Programming in Haskell
     Obsidian, Nikola, GpuGen, numerous papers on this too



     Much more. . .
     Research meeting industrial application
Oh, the possibilities!
     Parallel / Concurrency Options
     threads, dataflow, par, seq



     "Cloud" Haskell
     A kind of Erlang/OTP clone in Haskell



     Data Parallel Haskell
     GHC extensions to support nested data parallelism accounting, "Nepal"



     Haskell’s Foreign Function Interface (FFI)
     Interface with native code from Haskell



     GPU Programming in Haskell
     Obsidian, Nikola, GpuGen, numerous papers on this too



     Much more. . .
     Research meeting industrial application
Oh, the possibilities!
     Parallel / Concurrency Options
     threads, dataflow, par, seq



     "Cloud" Haskell
     A kind of Erlang/OTP clone in Haskell



     Data Parallel Haskell
     GHC extensions to support nested data parallelism accounting, "Nepal"



     Haskell’s Foreign Function Interface (FFI)
     Interface with native code from Haskell



     GPU Programming in Haskell
     Obsidian, Nikola, GpuGen, numerous papers on this too



     Much more. . .
     Research meeting industrial application
Oh, the possibilities!
     Parallel / Concurrency Options
     threads, dataflow, par, seq



     "Cloud" Haskell
     A kind of Erlang/OTP clone in Haskell



     Data Parallel Haskell
     GHC extensions to support nested data parallelism accounting, "Nepal"



     Haskell’s Foreign Function Interface (FFI)
     Interface with native code from Haskell



     GPU Programming in Haskell
     Obsidian, Nikola, GpuGen, numerous papers on this too



     Much more. . .
     Research meeting industrial application
Oh, the possibilities!
     Parallel / Concurrency Options
     threads, dataflow, par, seq



     "Cloud" Haskell
     A kind of Erlang/OTP clone in Haskell



     Data Parallel Haskell
     GHC extensions to support nested data parallelism accounting, "Nepal"



     Haskell’s Foreign Function Interface (FFI)
     Interface with native code from Haskell



     GPU Programming in Haskell
     Obsidian, Nikola, GpuGen, numerous papers on this too



     Much more. . .
     Research meeting industrial application
Questions?




        Figure:   http://www.flickr.com/photos/42682395@N04/




         @SusanPotter
Questions?




        Figure:   http://www.flickr.com/photos/42682395@N04/




         @SusanPotter
Bonus: References / Resources
    Channel 9 Lectures (Erik Meijer)
    http://channel9.msdn.com/Shows/Going+Deep/

    Lecture-Series-Erik-Meijer-Functional-Programming-Fundamentals-Chapter-1



    Learn You A Haskell
    http://learnyouahaskell.com



    Haskell Reddit
    http://www.reddit.com/r/haskell/



    Haskell Cafe
    http://www.haskell.org/mailman/listinfo/haskell-cafe



    Real World Haskell
    http://book.realworldhaskell.org/
Bonus: References / Resources
    Channel 9 Lectures (Erik Meijer)
    http://channel9.msdn.com/Shows/Going+Deep/

    Lecture-Series-Erik-Meijer-Functional-Programming-Fundamentals-Chapter-1



    Learn You A Haskell
    http://learnyouahaskell.com



    Haskell Reddit
    http://www.reddit.com/r/haskell/



    Haskell Cafe
    http://www.haskell.org/mailman/listinfo/haskell-cafe



    Real World Haskell
    http://book.realworldhaskell.org/
Bonus: References / Resources
    Channel 9 Lectures (Erik Meijer)
    http://channel9.msdn.com/Shows/Going+Deep/

    Lecture-Series-Erik-Meijer-Functional-Programming-Fundamentals-Chapter-1



    Learn You A Haskell
    http://learnyouahaskell.com



    Haskell Reddit
    http://www.reddit.com/r/haskell/



    Haskell Cafe
    http://www.haskell.org/mailman/listinfo/haskell-cafe



    Real World Haskell
    http://book.realworldhaskell.org/
Bonus: References / Resources
    Channel 9 Lectures (Erik Meijer)
    http://channel9.msdn.com/Shows/Going+Deep/

    Lecture-Series-Erik-Meijer-Functional-Programming-Fundamentals-Chapter-1



    Learn You A Haskell
    http://learnyouahaskell.com



    Haskell Reddit
    http://www.reddit.com/r/haskell/



    Haskell Cafe
    http://www.haskell.org/mailman/listinfo/haskell-cafe



    Real World Haskell
    http://book.realworldhaskell.org/
Bonus: References / Resources
    Channel 9 Lectures (Erik Meijer)
    http://channel9.msdn.com/Shows/Going+Deep/

    Lecture-Series-Erik-Meijer-Functional-Programming-Fundamentals-Chapter-1



    Learn You A Haskell
    http://learnyouahaskell.com



    Haskell Reddit
    http://www.reddit.com/r/haskell/



    Haskell Cafe
    http://www.haskell.org/mailman/listinfo/haskell-cafe



    Real World Haskell
    http://book.realworldhaskell.org/
Bonus: Brief QuickCheck Example

module Tests where


import Test.QuickCheck (quickCheck)


propReverseReverse :: [Char] -> Bool
propReverseReverse s = (reverse . reverse) s == s


  excuse the weird syntax form, indenting didn’t show up ;(
main = do {quickCheck propReverseReverse }

More Related Content

What's hot

Humble introduction to category theory in haskell
Humble introduction to category theory in haskellHumble introduction to category theory in haskell
Humble introduction to category theory in haskellJongsoo Lee
 
Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)Jonas Bonér
 
Functional programming with haskell
Functional programming with haskellFunctional programming with haskell
Functional programming with haskellfaradjpour
 
First-Class Patterns
First-Class PatternsFirst-Class Patterns
First-Class PatternsJohn De Goes
 
Swift rocks! #1
Swift rocks! #1Swift rocks! #1
Swift rocks! #1Hackraft
 
Design Patterns - Compiler Case Study - Hands-on Examples
Design Patterns - Compiler Case Study - Hands-on ExamplesDesign Patterns - Compiler Case Study - Hands-on Examples
Design Patterns - Compiler Case Study - Hands-on ExamplesGanesh Samarthyam
 
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
 
Reasoning about laziness
Reasoning about lazinessReasoning about laziness
Reasoning about lazinessJohan Tibell
 
Swift Rocks #2: Going functional
Swift Rocks #2: Going functionalSwift Rocks #2: Going functional
Swift Rocks #2: Going functionalHackraft
 
Hey! There's OCaml in my Rust!
Hey! There's OCaml in my Rust!Hey! There's OCaml in my Rust!
Hey! There's OCaml in my Rust!Kel Cecil
 
"Немного о функциональном программирование в JavaScript" Алексей Коваленко
"Немного о функциональном программирование в JavaScript" Алексей Коваленко"Немного о функциональном программирование в JavaScript" Алексей Коваленко
"Немного о функциональном программирование в JavaScript" Алексей КоваленкоFwdays
 
Coding Guidelines - Crafting Clean Code
Coding Guidelines - Crafting Clean CodeCoding Guidelines - Crafting Clean Code
Coding Guidelines - Crafting Clean CodeGanesh Samarthyam
 
Demystifying functional programming with Scala
Demystifying functional programming with ScalaDemystifying functional programming with Scala
Demystifying functional programming with ScalaDenis
 
Quicksort - a whistle-stop tour of the algorithm in five languages and four p...
Quicksort - a whistle-stop tour of the algorithm in five languages and four p...Quicksort - a whistle-stop tour of the algorithm in five languages and four p...
Quicksort - a whistle-stop tour of the algorithm in five languages and four p...Philip Schwarz
 
Procedural Programming: It’s Back? It Never Went Away
Procedural Programming: It’s Back? It Never Went AwayProcedural Programming: It’s Back? It Never Went Away
Procedural Programming: It’s Back? It Never Went AwayKevlin Henney
 

What's hot (20)

Humble introduction to category theory in haskell
Humble introduction to category theory in haskellHumble introduction to category theory in haskell
Humble introduction to category theory in haskell
 
Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)
 
Functional programming with haskell
Functional programming with haskellFunctional programming with haskell
Functional programming with haskell
 
Haskell
HaskellHaskell
Haskell
 
Pune Clojure Course Outline
Pune Clojure Course OutlinePune Clojure Course Outline
Pune Clojure Course Outline
 
First-Class Patterns
First-Class PatternsFirst-Class Patterns
First-Class Patterns
 
Swift rocks! #1
Swift rocks! #1Swift rocks! #1
Swift rocks! #1
 
Design Patterns - Compiler Case Study - Hands-on Examples
Design Patterns - Compiler Case Study - Hands-on ExamplesDesign Patterns - Compiler Case Study - Hands-on Examples
Design Patterns - Compiler Case Study - Hands-on Examples
 
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
 
Reasoning about laziness
Reasoning about lazinessReasoning about laziness
Reasoning about laziness
 
Swift Rocks #2: Going functional
Swift Rocks #2: Going functionalSwift Rocks #2: Going functional
Swift Rocks #2: Going functional
 
Python Cheat Sheet
Python Cheat SheetPython Cheat Sheet
Python Cheat Sheet
 
Hey! There's OCaml in my Rust!
Hey! There's OCaml in my Rust!Hey! There's OCaml in my Rust!
Hey! There's OCaml in my Rust!
 
"Немного о функциональном программирование в JavaScript" Алексей Коваленко
"Немного о функциональном программирование в JavaScript" Алексей Коваленко"Немного о функциональном программирование в JavaScript" Алексей Коваленко
"Немного о функциональном программирование в JavaScript" Алексей Коваленко
 
Joy of scala
Joy of scalaJoy of scala
Joy of scala
 
Coding Guidelines - Crafting Clean Code
Coding Guidelines - Crafting Clean CodeCoding Guidelines - Crafting Clean Code
Coding Guidelines - Crafting Clean Code
 
Demystifying functional programming with Scala
Demystifying functional programming with ScalaDemystifying functional programming with Scala
Demystifying functional programming with Scala
 
Quicksort - a whistle-stop tour of the algorithm in five languages and four p...
Quicksort - a whistle-stop tour of the algorithm in five languages and four p...Quicksort - a whistle-stop tour of the algorithm in five languages and four p...
Quicksort - a whistle-stop tour of the algorithm in five languages and four p...
 
What's New In C# 7
What's New In C# 7What's New In C# 7
What's New In C# 7
 
Procedural Programming: It’s Back? It Never Went Away
Procedural Programming: It’s Back? It Never Went AwayProcedural Programming: It’s Back? It Never Went Away
Procedural Programming: It’s Back? It Never Went Away
 

Viewers also liked

Haskell vs. F# vs. Scala
Haskell vs. F# vs. ScalaHaskell vs. F# vs. Scala
Haskell vs. F# vs. Scalapt114
 
Haskell is Not For Production and Other Tales
Haskell is Not For Production and Other TalesHaskell is Not For Production and Other Tales
Haskell is Not For Production and Other TalesKatie Ots
 
Haskell for the Real World
Haskell for the Real WorldHaskell for the Real World
Haskell for the Real WorldBryan O'Sullivan
 
Introduction to haskell
Introduction to haskellIntroduction to haskell
Introduction to haskellLuca Molteni
 
Camomile : A Unicode library for OCaml
Camomile : A Unicode library for OCamlCamomile : A Unicode library for OCaml
Camomile : A Unicode library for OCamlYamagata Yoriyuki
 
Distributed Developer Workflows using Git
Distributed Developer Workflows using GitDistributed Developer Workflows using Git
Distributed Developer Workflows using GitSusan Potter
 
Dynamo: Not Just For Datastores
Dynamo: Not Just For DatastoresDynamo: Not Just For Datastores
Dynamo: Not Just For DatastoresSusan Potter
 
Writing Bullet-Proof Javascript: By Using CoffeeScript
Writing Bullet-Proof Javascript: By Using CoffeeScriptWriting Bullet-Proof Javascript: By Using CoffeeScript
Writing Bullet-Proof Javascript: By Using CoffeeScriptSusan Potter
 
Link Walking with Riak
Link Walking with RiakLink Walking with Riak
Link Walking with RiakSusan Potter
 
Using functional programming within an industrial product group: perspectives...
Using functional programming within an industrial product group: perspectives...Using functional programming within an industrial product group: perspectives...
Using functional programming within an industrial product group: perspectives...Anil Madhavapeddy
 
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016Susan Potter
 
From Zero to Application Delivery with NixOS
From Zero to Application Delivery with NixOSFrom Zero to Application Delivery with NixOS
From Zero to Application Delivery with NixOSSusan Potter
 
Ricon/West 2013: Adventures with Riak Pipe
Ricon/West 2013: Adventures with Riak PipeRicon/West 2013: Adventures with Riak Pipe
Ricon/West 2013: Adventures with Riak PipeSusan Potter
 
Introduction to functional programming using Ocaml
Introduction to functional programming using OcamlIntroduction to functional programming using Ocaml
Introduction to functional programming using Ocamlpramode_ce
 
Mirage: ML kernels in the cloud (ML Workshop 2010)
Mirage: ML kernels in the cloud (ML Workshop 2010)Mirage: ML kernels in the cloud (ML Workshop 2010)
Mirage: ML kernels in the cloud (ML Workshop 2010)Anil Madhavapeddy
 
Lisp Programming Languge
Lisp Programming LangugeLisp Programming Languge
Lisp Programming LangugeYaser Jaradeh
 
Designing for Concurrency
Designing for ConcurrencyDesigning for Concurrency
Designing for ConcurrencySusan Potter
 

Viewers also liked (20)

Haskell vs. F# vs. Scala
Haskell vs. F# vs. ScalaHaskell vs. F# vs. Scala
Haskell vs. F# vs. Scala
 
Haskell is Not For Production and Other Tales
Haskell is Not For Production and Other TalesHaskell is Not For Production and Other Tales
Haskell is Not For Production and Other Tales
 
Haskell for the Real World
Haskell for the Real WorldHaskell for the Real World
Haskell for the Real World
 
Haskell - Functional Programming
Haskell - Functional ProgrammingHaskell - Functional Programming
Haskell - Functional Programming
 
Introduction to haskell
Introduction to haskellIntroduction to haskell
Introduction to haskell
 
Camomile : A Unicode library for OCaml
Camomile : A Unicode library for OCamlCamomile : A Unicode library for OCaml
Camomile : A Unicode library for OCaml
 
Distributed Developer Workflows using Git
Distributed Developer Workflows using GitDistributed Developer Workflows using Git
Distributed Developer Workflows using Git
 
Dynamo: Not Just For Datastores
Dynamo: Not Just For DatastoresDynamo: Not Just For Datastores
Dynamo: Not Just For Datastores
 
Writing Bullet-Proof Javascript: By Using CoffeeScript
Writing Bullet-Proof Javascript: By Using CoffeeScriptWriting Bullet-Proof Javascript: By Using CoffeeScript
Writing Bullet-Proof Javascript: By Using CoffeeScript
 
Link Walking with Riak
Link Walking with RiakLink Walking with Riak
Link Walking with Riak
 
A taste of Functional Programming
A taste of Functional ProgrammingA taste of Functional Programming
A taste of Functional Programming
 
Using functional programming within an industrial product group: perspectives...
Using functional programming within an industrial product group: perspectives...Using functional programming within an industrial product group: perspectives...
Using functional programming within an industrial product group: perspectives...
 
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
 
Ocaml
OcamlOcaml
Ocaml
 
From Zero to Application Delivery with NixOS
From Zero to Application Delivery with NixOSFrom Zero to Application Delivery with NixOS
From Zero to Application Delivery with NixOS
 
Ricon/West 2013: Adventures with Riak Pipe
Ricon/West 2013: Adventures with Riak PipeRicon/West 2013: Adventures with Riak Pipe
Ricon/West 2013: Adventures with Riak Pipe
 
Introduction to functional programming using Ocaml
Introduction to functional programming using OcamlIntroduction to functional programming using Ocaml
Introduction to functional programming using Ocaml
 
Mirage: ML kernels in the cloud (ML Workshop 2010)
Mirage: ML kernels in the cloud (ML Workshop 2010)Mirage: ML kernels in the cloud (ML Workshop 2010)
Mirage: ML kernels in the cloud (ML Workshop 2010)
 
Lisp Programming Languge
Lisp Programming LangugeLisp Programming Languge
Lisp Programming Languge
 
Designing for Concurrency
Designing for ConcurrencyDesigning for Concurrency
Designing for Concurrency
 

Similar to Why Haskell? An Overview of the Benefits and Challenges

Lambda? You Keep Using that Letter
Lambda? You Keep Using that LetterLambda? You Keep Using that Letter
Lambda? You Keep Using that LetterKevlin Henney
 
Is Haskell an acceptable Perl?
Is Haskell an acceptable Perl?Is Haskell an acceptable Perl?
Is Haskell an acceptable Perl?osfameron
 
Haskell retrospective
Haskell retrospectiveHaskell retrospective
Haskell retrospectivechenge2k
 
JSDC 2014 - functional java script, why or why not
JSDC 2014 - functional java script, why or why notJSDC 2014 - functional java script, why or why not
JSDC 2014 - functional java script, why or why notChengHui Weng
 
42: Rise of the dependent types
42: Rise of the dependent types42: Rise of the dependent types
42: Rise of the dependent typesGeorge Leontiev
 
Haskell - Being lazy with class
Haskell - Being lazy with classHaskell - Being lazy with class
Haskell - Being lazy with classTiago Babo
 
Introduction to Functional Languages
Introduction to Functional LanguagesIntroduction to Functional Languages
Introduction to Functional Languagessuthi
 
Lambda? You Keep Using that Letter
Lambda? You Keep Using that LetterLambda? You Keep Using that Letter
Lambda? You Keep Using that LetterKevlin Henney
 
Python_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdfPython_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdfsagar414433
 
Python_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdfPython_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdfsagar414433
 
Fp in scala part 2
Fp in scala part 2Fp in scala part 2
Fp in scala part 2Hang Zhao
 
Monads and Monoids by Oleksiy Dyagilev
Monads and Monoids by Oleksiy DyagilevMonads and Monoids by Oleksiy Dyagilev
Monads and Monoids by Oleksiy DyagilevJavaDayUA
 
Thinking Functionally In Ruby
Thinking Functionally In RubyThinking Functionally In Ruby
Thinking Functionally In RubyRoss Lawley
 
Class 31: Deanonymizing
Class 31: DeanonymizingClass 31: Deanonymizing
Class 31: DeanonymizingDavid Evans
 
Pharo - I have a dream @ Smalltalks Conference 2009
Pharo -  I have a dream @ Smalltalks Conference 2009Pharo -  I have a dream @ Smalltalks Conference 2009
Pharo - I have a dream @ Smalltalks Conference 2009Pharo
 
Why Haskell Matters
Why Haskell MattersWhy Haskell Matters
Why Haskell Mattersromanandreg
 
Lec2_cont.pptx galgotias University questions
Lec2_cont.pptx galgotias University questionsLec2_cont.pptx galgotias University questions
Lec2_cont.pptx galgotias University questionsYashJain47002
 
Scala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecScala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecLoïc Descotte
 

Similar to Why Haskell? An Overview of the Benefits and Challenges (20)

Lambda? You Keep Using that Letter
Lambda? You Keep Using that LetterLambda? You Keep Using that Letter
Lambda? You Keep Using that Letter
 
Is Haskell an acceptable Perl?
Is Haskell an acceptable Perl?Is Haskell an acceptable Perl?
Is Haskell an acceptable Perl?
 
Haskell retrospective
Haskell retrospectiveHaskell retrospective
Haskell retrospective
 
Template Haskell
Template HaskellTemplate Haskell
Template Haskell
 
JSDC 2014 - functional java script, why or why not
JSDC 2014 - functional java script, why or why notJSDC 2014 - functional java script, why or why not
JSDC 2014 - functional java script, why or why not
 
42: Rise of the dependent types
42: Rise of the dependent types42: Rise of the dependent types
42: Rise of the dependent types
 
Haskell - Being lazy with class
Haskell - Being lazy with classHaskell - Being lazy with class
Haskell - Being lazy with class
 
Introduction to Functional Languages
Introduction to Functional LanguagesIntroduction to Functional Languages
Introduction to Functional Languages
 
Lambda? You Keep Using that Letter
Lambda? You Keep Using that LetterLambda? You Keep Using that Letter
Lambda? You Keep Using that Letter
 
Python_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdfPython_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdf
 
Python_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdfPython_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdf
 
Fp in scala part 2
Fp in scala part 2Fp in scala part 2
Fp in scala part 2
 
Monads and Monoids by Oleksiy Dyagilev
Monads and Monoids by Oleksiy DyagilevMonads and Monoids by Oleksiy Dyagilev
Monads and Monoids by Oleksiy Dyagilev
 
Thinking Functionally In Ruby
Thinking Functionally In RubyThinking Functionally In Ruby
Thinking Functionally In Ruby
 
Class 31: Deanonymizing
Class 31: DeanonymizingClass 31: Deanonymizing
Class 31: Deanonymizing
 
Pharo - I have a dream @ Smalltalks Conference 2009
Pharo -  I have a dream @ Smalltalks Conference 2009Pharo -  I have a dream @ Smalltalks Conference 2009
Pharo - I have a dream @ Smalltalks Conference 2009
 
DA_02_algorithms.pptx
DA_02_algorithms.pptxDA_02_algorithms.pptx
DA_02_algorithms.pptx
 
Why Haskell Matters
Why Haskell MattersWhy Haskell Matters
Why Haskell Matters
 
Lec2_cont.pptx galgotias University questions
Lec2_cont.pptx galgotias University questionsLec2_cont.pptx galgotias University questions
Lec2_cont.pptx galgotias University questions
 
Scala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecScala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar Prokopec
 

More from Susan Potter

Thinking in Properties
Thinking in PropertiesThinking in Properties
Thinking in PropertiesSusan Potter
 
Champaign-Urbana Javascript Meetup Talk (Jan 2020)
Champaign-Urbana Javascript Meetup Talk (Jan 2020)Champaign-Urbana Javascript Meetup Talk (Jan 2020)
Champaign-Urbana Javascript Meetup Talk (Jan 2020)Susan Potter
 
From Zero to Haskell: Lessons Learned
From Zero to Haskell: Lessons LearnedFrom Zero to Haskell: Lessons Learned
From Zero to Haskell: Lessons LearnedSusan Potter
 
Dynamically scaling a political news and activism hub (up to 5x the traffic i...
Dynamically scaling a political news and activism hub (up to 5x the traffic i...Dynamically scaling a political news and activism hub (up to 5x the traffic i...
Dynamically scaling a political news and activism hub (up to 5x the traffic i...Susan Potter
 
Functional Operations (Functional Programming at Comcast Labs Connect)
Functional Operations (Functional Programming at Comcast Labs Connect)Functional Operations (Functional Programming at Comcast Labs Connect)
Functional Operations (Functional Programming at Comcast Labs Connect)Susan Potter
 
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014Susan Potter
 
Deploying distributed software services to the cloud without breaking a sweat
Deploying distributed software services to the cloud without breaking a sweatDeploying distributed software services to the cloud without breaking a sweat
Deploying distributed software services to the cloud without breaking a sweatSusan Potter
 

More from Susan Potter (8)

Thinking in Properties
Thinking in PropertiesThinking in Properties
Thinking in Properties
 
Champaign-Urbana Javascript Meetup Talk (Jan 2020)
Champaign-Urbana Javascript Meetup Talk (Jan 2020)Champaign-Urbana Javascript Meetup Talk (Jan 2020)
Champaign-Urbana Javascript Meetup Talk (Jan 2020)
 
From Zero to Haskell: Lessons Learned
From Zero to Haskell: Lessons LearnedFrom Zero to Haskell: Lessons Learned
From Zero to Haskell: Lessons Learned
 
Dynamically scaling a political news and activism hub (up to 5x the traffic i...
Dynamically scaling a political news and activism hub (up to 5x the traffic i...Dynamically scaling a political news and activism hub (up to 5x the traffic i...
Dynamically scaling a political news and activism hub (up to 5x the traffic i...
 
Functional Operations (Functional Programming at Comcast Labs Connect)
Functional Operations (Functional Programming at Comcast Labs Connect)Functional Operations (Functional Programming at Comcast Labs Connect)
Functional Operations (Functional Programming at Comcast Labs Connect)
 
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
 
Twitter4R OAuth
Twitter4R OAuthTwitter4R OAuth
Twitter4R OAuth
 
Deploying distributed software services to the cloud without breaking a sweat
Deploying distributed software services to the cloud without breaking a sweatDeploying distributed software services to the cloud without breaking a sweat
Deploying distributed software services to the cloud without breaking a sweat
 

Recently uploaded

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
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
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 

Recently uploaded (20)

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
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
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 

Why Haskell? An Overview of the Benefits and Challenges

  • 1. Why Haskell? Susan Potter March 2012
  • 2. What is Haskell? Figure: "pure functional, lazy, polymorphic, statically and strongly typed with type inference . . . "
  • 3. How can I drive this thing? Figure: Photo from "If programming languages were cars" blog post http://machinegestalt.posterous.com/if-programming-languages-were-cars
  • 4. Can I drive Haskell without all this? Figure: No need to know Category Theory proofs, just some intuitions!
  • 5. # finger $(whoami) Login: susan Name: Susan Potter Directory: /home/susan Shell: /bin/zsh Practicing since 1997-09-29 21:18 (GMT) on tty1 from :0 Too much unread mail on me@susanpotter.net Now working at Desk.com! Looking for smart developers!;) Plan: github: mbbx6spp twitter: @SusanPotter
  • 6. Are we "doing it wrong"? Figure: Maybe! ;) http://absolutelymadness.tumblr.com/post/17567574522
  • 7. Overview: Choosing a language Many considerations political, human, technical Runtime performance, reliability, configurability Knowledge culture, mindshare, resources, signal to noise ratio Tooling development, build/release, configuration, deployment
  • 8. Overview: Choosing a language Many considerations political, human, technical Runtime performance, reliability, configurability Knowledge culture, mindshare, resources, signal to noise ratio Tooling development, build/release, configuration, deployment
  • 9. Overview: Choosing a language Many considerations political, human, technical Runtime performance, reliability, configurability Knowledge culture, mindshare, resources, signal to noise ratio Tooling development, build/release, configuration, deployment
  • 10. Overview: Choosing a language Many considerations political, human, technical Runtime performance, reliability, configurability Knowledge culture, mindshare, resources, signal to noise ratio Tooling development, build/release, configuration, deployment
  • 11. Overview: Agenda My Claims / Hypotheses Laziness, Functional, Type System Toolkit & Runtime Library Ecosystem Pitfalls & Hurdles
  • 12. My Claims Performance is reasonable on par with Java and C# Mono; 2-3x CPU times of C (approx); BUT always doubt benchmarks http://shootout.alioth.debian.org/u64q/haskell.php Productivity with long-term benefits after initial steep learning curve Haskell types offer stronger verifiability strong and meaningful checks applied Pure functional code is easier to test probably not controversial
  • 13. My Claims Performance is reasonable on par with Java and C# Mono; 2-3x CPU times of C (approx); BUT always doubt benchmarks http://shootout.alioth.debian.org/u64q/haskell.php Productivity with long-term benefits after initial steep learning curve Haskell types offer stronger verifiability strong and meaningful checks applied Pure functional code is easier to test probably not controversial
  • 14. My Claims Performance is reasonable on par with Java and C# Mono; 2-3x CPU times of C (approx); BUT always doubt benchmarks http://shootout.alioth.debian.org/u64q/haskell.php Productivity with long-term benefits after initial steep learning curve Haskell types offer stronger verifiability strong and meaningful checks applied Pure functional code is easier to test probably not controversial
  • 15. My Claims Performance is reasonable on par with Java and C# Mono; 2-3x CPU times of C (approx); BUT always doubt benchmarks http://shootout.alioth.debian.org/u64q/haskell.php Productivity with long-term benefits after initial steep learning curve Haskell types offer stronger verifiability strong and meaningful checks applied Pure functional code is easier to test probably not controversial
  • 16. Haskell "lazy" by default Figure: Photo by Mark Fischer http://www.flickr.com/photos/tom_ruaat/4431626234/
  • 17. Haskell "lazy" by default Figure: Photo by Mark Fischer http://www.flickr.com/photos/tom_ruaat/4431626234/ (jarring for mainstream programmers)
  • 18. Example: doubleSum 3 (2 + 3) Call by value doubleSum 3 (2 + 3) → doubleSum 3 5 → 2 * (3 + 5) → 2 * 8 → 16 Call by name doubleSum 3 (2 + 3) → (λ x -> 2 * (3 + x)) (2 + 3)
  • 19. Example: doubleSum 3 (2 + 3) Call by value doubleSum 3 (2 + 3) → doubleSum 3 5 → 2 * (3 + 5) → 2 * 8 → 16 Call by name doubleSum 3 (2 + 3) → (λ x -> 2 * (3 + x)) (2 + 3)
  • 20. Example: doubleSum 3 (2 + 3) Call by value doubleSum 3 (2 + 3) → doubleSum 3 5 → 2 * (3 + 5) → 2 * 8 → 16 Call by name doubleSum 3 (2 + 3) → (λ x -> 2 * (3 + x)) (2 + 3)
  • 21. Example: doubleSum 3 (2 + 3) Call by value doubleSum 3 (2 + 3) → doubleSum 3 5 → 2 * (3 + 5) → 2 * 8 → 16 Call by name doubleSum 3 (2 + 3) → (λ x -> 2 * (3 + x)) (2 + 3)
  • 22. Example: doubleSum 3 (2 + 3) Call by value doubleSum 3 (2 + 3) → doubleSum 3 5 → 2 * (3 + 5) → 2 * 8 → 16 Call by name doubleSum 3 (2 + 3) → (λ x -> 2 * (3 + x)) (2 + 3)
  • 23. Example: doubleSum 3 (2 + 3) Call by value doubleSum 3 (2 + 3) → doubleSum 3 5 → 2 * (3 + 5) → 2 * 8 → 16 Call by name doubleSum 3 (2 + 3) → (λ x -> 2 * (3 + x)) (2 + 3)
  • 24. Example: doubleSum 3 (2 + 3) Call by value (evaluates inner-most expressions first) doubleSum 3 (2 + 3) → doubleSum 3 5 → 2 * (3 + 5) → 2 * 8 → 16 Call by name doubleSum 3 (2 + 3) → (λ x -> 2 * (3 + x)) (2 + 3)
  • 25. Example: doubleSum 3 (2 + 3) Call by value (evaluates inner-most expressions first) doubleSum 3 (2 + 3) → doubleSum 3 5 → 2 * (3 + 5) → 2 * 8 → 16 Call by name doubleSum 3 (2 + 3) → (λ x -> 2 * (3 + x)) (2 + 3)
  • 26. Example: doubleSum 3 (2 + 3) Call by value (evaluates inner-most expressions first) doubleSum 3 (2 + 3) → doubleSum 3 5 → 2 * (3 + 5) → 2 * 8 → 16 Call by name doubleSum 3 (2 + 3) → (λ x -> 2 * (3 + x)) (2 + 3)
  • 27. Example: doubleSum 3 (2 + 3) Call by value (evaluates inner-most expressions first) doubleSum 3 (2 + 3) → doubleSum 3 5 → 2 * (3 + 5) → 2 * 8 → 16 Call by name doubleSum 3 (2 + 3) → (λ x -> 2 * (3 + x)) (2 + 3)
  • 28. Example: doubleSum 3 (2 + 3) Call by value (evaluates inner-most expressions first) doubleSum 3 (2 + 3) → doubleSum 3 5 → 2 * (3 + 5) → 2 * 8 → 16 Call by name (evaluates outer-most expressions first) doubleSum 3 (2 + 3) → (λ x -> 2 * (3 + x)) (2 + 3)
  • 29. Laziness in Haskell is . . . CallByName + SharingOptimization + PossibleMinorOverhead
  • 30. Laziness: Buyer Beware filter (λ x → x < 6) [1..] (never terminates) takeWhile (λ x → x < 6) [1..] (does terminate) dropWhile (λ x → x >= 6) [1..] (does not terminate) Need to understand implications of laziness on functions Laziness with I/O implications lazy I/O with handles is problematic, but iteratee idiom solves most of these. There are a number of libraries available to help with this: enumerator, pipes, . . .
  • 31. Laziness: Buyer Beware filter (λ x → x < 6) [1..] (never terminates) takeWhile (λ x → x < 6) [1..] (does terminate) dropWhile (λ x → x >= 6) [1..] (does not terminate) Need to understand implications of laziness on functions Laziness with I/O implications lazy I/O with handles is problematic, but iteratee idiom solves most of these. There are a number of libraries available to help with this: enumerator, pipes, . . .
  • 32. Laziness: Buyer Beware filter (λ x → x < 6) [1..] (never terminates) takeWhile (λ x → x < 6) [1..] (does terminate) dropWhile (λ x → x >= 6) [1..] (does not terminate) Need to understand implications of laziness on functions Laziness with I/O implications lazy I/O with handles is problematic, but iteratee idiom solves most of these. There are a number of libraries available to help with this: enumerator, pipes, . . .
  • 33. Laziness: Buyer Beware filter (λ x → x < 6) [1..] (never terminates) takeWhile (λ x → x < 6) [1..] (does terminate) dropWhile (λ x → x >= 6) [1..] (does not terminate) Need to understand implications of laziness on functions Laziness with I/O implications lazy I/O with handles is problematic, but iteratee idiom solves most of these. There are a number of libraries available to help with this: enumerator, pipes, . . .
  • 34. Laziness: Buyer Beware filter (λ x → x < 6) [1..] (never terminates) takeWhile (λ x → x < 6) [1..] (does terminate) dropWhile (λ x → x >= 6) [1..] (does not terminate) Need to understand implications of laziness on functions Laziness with I/O implications lazy I/O with handles is problematic, but iteratee idiom solves most of these. There are a number of libraries available to help with this: enumerator, pipes, . . .
  • 35. Laziness: Also Pretty Suuweeeet! Infinite sequences/lists made possible Recursive functions become practical Recursive types become simple Much more as well ...
  • 36. Laziness: Also Pretty Suuweeeet! Infinite sequences/lists made possible Recursive functions become practical Recursive types become simple Much more as well ...
  • 37. Laziness: Also Pretty Suuweeeet! Infinite sequences/lists made possible Recursive functions become practical Recursive types become simple Much more as well ...
  • 38. Laziness: Also Pretty Suuweeeet! Infinite sequences/lists made possible Recursive functions become practical Recursive types become simple Much more as well ...
  • 39. Purity + Laziness=> Reasoning Equality (referential transparency) Can replace occurrences of LHS with RHS Higher Order Functions encourage exploitation of higher-level patterns Function Composition leads to greater reuse
  • 40. Purity + Laziness=> Reasoning Equality (referential transparency) Can replace occurrences of LHS with RHS Higher Order Functions encourage exploitation of higher-level patterns Function Composition leads to greater reuse
  • 41. Purity + Laziness=> Reasoning Equality (referential transparency) Can replace occurrences of LHS with RHS Higher Order Functions encourage exploitation of higher-level patterns Function Composition leads to greater reuse
  • 42. mysum :: Num a => [a] -> a mysum xs = foldr (+) 0 xs myproduct :: Num a => [a] -> a myproduct xs = foldr (*) 1 xs myany :: (a -> Bool) -> [a] -> Bool myany pred xs = foldr ( x b -> b || pred x) False xs myall :: (a -> Bool) -> [a] -> Bool myall pred xs = foldr ( x b -> b && pred x) True xs
  • 43. mysum :: Num a => [a] -> a mysum xs = foldr (+) 0 xs myproduct :: Num a => [a] -> a myproduct xs = foldr (*) 1 xs myany :: (a -> Bool) -> [a] -> Bool myany pred xs = foldr ( x b -> b || pred x) False xs myall :: (a -> Bool) -> [a] -> Bool myall pred xs = foldr ( x b -> b && pred x) True xs
  • 44. mysum :: Num a => [a] -> a mysum xs = foldr (+) 0 xs myproduct :: Num a => [a] -> a myproduct xs = foldr (*) 1 xs myany :: (a -> Bool) -> [a] -> Bool myany pred xs = foldr ( x b -> b || pred x) False xs myall :: (a -> Bool) -> [a] -> Bool myall pred xs = foldr ( x b -> b && pred x) True xs
  • 45. mysum :: Num a => [a] -> a mysum xs = foldr (+) 0 xs myproduct :: Num a => [a] -> a myproduct xs = foldr (*) 1 xs myany :: (a -> Bool) -> [a] -> Bool myany pred xs = foldr ( x b -> b || pred x) False xs myall :: (a -> Bool) -> [a] -> Bool myall pred xs = foldr ( x b -> b && pred x) True xs
  • 46. mysum :: Num a => [a] -> a mysum xs = foldr (+) 0 xs myproduct :: Num a => [a] -> a myproduct xs = foldr (*) 1 xs myany :: (a -> Bool) -> [a] -> Bool myany pred xs = foldr ( x b -> b || pred x) False xs myall :: (a -> Bool) -> [a] -> Bool myall pred xs = foldr ( x b -> b && pred x) True xs
  • 47. mysum :: Num a => [a] -> a mysum xs = foldr (+) 0 xs myproduct :: Num a => [a] -> a myproduct xs = foldr (*) 1 xs myany :: (a -> Bool) -> [a] -> Bool myany pred xs = foldr ( x b -> b || pred x) False xs myall :: (a -> Bool) -> [a] -> Bool myall pred xs = foldr ( x b -> b && pred x) True xs
  • 48. mysum :: Num a => [a] -> a mysum xs = foldr (+) 0 xs myproduct :: Num a => [a] -> a myproduct xs = foldr (*) 1 xs myany :: (a -> Bool) -> [a] -> Bool myany pred xs = foldr ( x b -> b || pred x) False xs myall :: (a -> Bool) -> [a] -> Bool myall pred xs = foldr ( x b -> b && pred x) True xs
  • 49. class Monoid m where mappend :: m -> m -> m mempty :: m instance Num a => Monoid a where mappend :: m -> m -> m mappend x y = (+) x y mempty :: m mempty = 0 instance Monoid Bool where mappend :: m -> m -> m mappend True _ = True mappend _ True = True mappend _ _ = False mempty :: m
  • 50. class Monoid m where mappend :: m -> m -> m mempty :: m instance Num a => Monoid a where mappend :: m -> m -> m mappend x y = (+) x y mempty :: m mempty = 0 instance Monoid Bool where mappend :: m -> m -> m mappend True _ = True mappend _ True = True mappend _ _ = False mempty :: m
  • 51. class Monoid m where mappend :: m -> m -> m mempty :: m instance Num a => Monoid a where mappend :: m -> m -> m mappend x y = (+) x y mempty :: m mempty = 0 instance Monoid Bool where mappend :: m -> m -> m mappend True _ = True mappend _ True = True mappend _ _ = False mempty :: m
  • 52. Haskell type signatures can . . . express side effects e.g. String -> IO Int declare computational strategies e.g. Num a => [a] -> Sum a impose constraints e.g. Num a => a -> a question value availability e.g. String -> Maybe Int verify client-server protocol dialogs? an exercise for reader ;)
  • 53. Haskell type signatures can . . . express side effects e.g. String -> IO Int declare computational strategies e.g. Num a => [a] -> Sum a impose constraints e.g. Num a => a -> a question value availability e.g. String -> Maybe Int verify client-server protocol dialogs? an exercise for reader ;)
  • 54. Haskell type signatures can . . . express side effects e.g. String -> IO Int declare computational strategies e.g. Num a => [a] -> Sum a impose constraints e.g. Num a => a -> a question value availability e.g. String -> Maybe Int verify client-server protocol dialogs? an exercise for reader ;)
  • 55. Haskell type signatures can . . . express side effects e.g. String -> IO Int declare computational strategies e.g. Num a => [a] -> Sum a impose constraints e.g. Num a => a -> a question value availability e.g. String -> Maybe Int verify client-server protocol dialogs? an exercise for reader ;)
  • 56. Haskell type signatures can . . . express side effects e.g. String -> IO Int declare computational strategies e.g. Num a => [a] -> Sum a impose constraints e.g. Num a => a -> a question value availability e.g. String -> Maybe Int verify client-server protocol dialogs? an exercise for reader ;)
  • 57. Interfaces in OO . . . Figure: Class definitions are married to the interfaces they implement.
  • 58. Interfaces in Haskell: Typeclasses. . . Decouple type definition from interface Allow upstream implementations Extend thirdparty libraries easily Redefine implementations upstream No meaningless "any type" functions Very flexible
  • 59. Interfaces in Haskell: Typeclasses. . . Decouple type definition from interface Allow upstream implementations Extend thirdparty libraries easily Redefine implementations upstream No meaningless "any type" functions Very flexible
  • 60. Interfaces in Haskell: Typeclasses. . . Decouple type definition from interface Allow upstream implementations Extend thirdparty libraries easily Redefine implementations upstream No meaningless "any type" functions Very flexible
  • 61. Interfaces in Haskell: Typeclasses. . . Decouple type definition from interface Allow upstream implementations Extend thirdparty libraries easily Redefine implementations upstream No meaningless "any type" functions Very flexible
  • 62. Interfaces in Haskell: Typeclasses. . . Decouple type definition from interface Allow upstream implementations Extend thirdparty libraries easily Redefine implementations upstream No meaningless "any type" functions Very flexible
  • 63. Interfaces in Haskell: Typeclasses. . . Decouple type definition from interface Allow upstream implementations Extend thirdparty libraries easily Redefine implementations upstream No meaningless "any type" functions Very flexible
  • 64. class (Eq a) => Ord a where compare :: a -> a -> Ordering compare x y | x == y = EQ | x <= y = LT | otherwise = GT (<), (>), (>=), (<=) :: a -> a -> Bool ... max, min :: a -> a -> a ...
  • 65. Typically this just works . . . data SimpleShape = Square { size :: Double } | Circle { radius :: Double } deriving (Eq, Ord, Show) We explicitly use the default definitions . . . and when it doesn’t . . . instance Ord SimpleShape where ...
  • 66. Are you awake? Figure: http://absolutelymadness.tumblr.com/post/18126913457
  • 67. Haskell Tooling: Libraries Quite a few Practical libraries Often freely available Permissive OSS licenses
  • 68. Haskell Tooling: Libraries Quite a few Practical libraries Often freely available Permissive OSS licenses
  • 69. Haskell Tooling: Libraries Quite a few Practical libraries Often freely available Permissive OSS licenses
  • 70. Haskell Tooling: Libraries Quite a few Practical libraries Often freely available Permissive OSS licenses
  • 71. Haskell Tooling: Runtime Reasonably performant between JVM 7 and C# Mono performance GC settings easily customized Numerous other runtime options
  • 72. Haskell Tooling: Runtime Reasonably performant between JVM 7 and C# Mono performance GC settings easily customized Numerous other runtime options
  • 73. Haskell Tooling: Runtime Reasonably performant between JVM 7 and C# Mono performance GC settings easily customized Numerous other runtime options
  • 74. Haskell Tooling: Tools Testing tools QuickCheck, HUnit Documentation tools Haddock, Hoogle (lookup documentation) Build tools Cabal, cabal-dev, cabal-nirvana, see "next slide"
  • 75. Haskell Tooling: Tools Testing tools QuickCheck, HUnit Documentation tools Haddock, Hoogle (lookup documentation) Build tools Cabal, cabal-dev, cabal-nirvana, see "next slide"
  • 76. Haskell Tooling: Tools Testing tools QuickCheck, HUnit Documentation tools Haddock, Hoogle (lookup documentation) Build tools Cabal, cabal-dev, cabal-nirvana, see "next slide"
  • 77. Haskell Tooling: Dependency Management Hackage database of freely available Haskell libraries Cabal great to get started, BUT . . . cabal-dev & similar provides sandboxing, list RVM with gemsets; more important for statically typed environments cabal-nirvana think compatible distribution snapshot of Hackage DB
  • 78. Haskell Tooling: Dependency Management Hackage database of freely available Haskell libraries Cabal great to get started, BUT . . . cabal-dev & similar provides sandboxing, list RVM with gemsets; more important for statically typed environments cabal-nirvana think compatible distribution snapshot of Hackage DB
  • 79. Haskell Tooling: Dependency Management Hackage database of freely available Haskell libraries Cabal great to get started, BUT . . . cabal-dev & similar provides sandboxing, list RVM with gemsets; more important for statically typed environments cabal-nirvana think compatible distribution snapshot of Hackage DB
  • 80. Haskell Tooling: Dependency Management Hackage database of freely available Haskell libraries Cabal great to get started, BUT . . . cabal-dev & similar provides sandboxing, list RVM with gemsets; more important for statically typed environments cabal-nirvana think compatible distribution snapshot of Hackage DB
  • 81. Haskell Tooling: Don’ts for Newbies Use GHC (not HUGS) Hugs written for educational purposes not industrial usage Forget what you know (imperative/OO) relearn programming in a functional-style return is a function name it does not mean return in the C/Java/C# way class does not mean OO-class think decoupled interface with optional default impelementations and a lot more power
  • 82. Haskell Tooling: Don’ts for Newbies Use GHC (not HUGS) Hugs written for educational purposes not industrial usage Forget what you know (imperative/OO) relearn programming in a functional-style return is a function name it does not mean return in the C/Java/C# way class does not mean OO-class think decoupled interface with optional default impelementations and a lot more power
  • 83. Haskell Tooling: Don’ts for Newbies Use GHC (not HUGS) Hugs written for educational purposes not industrial usage Forget what you know (imperative/OO) relearn programming in a functional-style return is a function name it does not mean return in the C/Java/C# way class does not mean OO-class think decoupled interface with optional default impelementations and a lot more power
  • 84. Haskell Tooling: Don’ts for Newbies Use GHC (not HUGS) Hugs written for educational purposes not industrial usage Forget what you know (imperative/OO) relearn programming in a functional-style return is a function name it does not mean return in the C/Java/C# way class does not mean OO-class think decoupled interface with optional default impelementations and a lot more power
  • 85. Haskell Tooling: Suggestions Explicit language extensions Intentionally and explicitly enable per module Sandbox your builds with cabal-dev or similar Think in types and shapes and use Hoogle to lookup based on types and function "shapes"
  • 86. Haskell Tooling: Suggestions Explicit language extensions Intentionally and explicitly enable per module Sandbox your builds with cabal-dev or similar Think in types and shapes and use Hoogle to lookup based on types and function "shapes"
  • 87. Haskell Tooling: Suggestions Explicit language extensions Intentionally and explicitly enable per module Sandbox your builds with cabal-dev or similar Think in types and shapes and use Hoogle to lookup based on types and function "shapes"
  • 88. Oh, the possibilities! Parallel / Concurrency Options threads, dataflow, par, seq "Cloud" Haskell A kind of Erlang/OTP clone in Haskell Data Parallel Haskell GHC extensions to support nested data parallelism accounting, "Nepal" Haskell’s Foreign Function Interface (FFI) Interface with native code from Haskell GPU Programming in Haskell Obsidian, Nikola, GpuGen, numerous papers on this too Much more. . . Research meeting industrial application
  • 89. Oh, the possibilities! Parallel / Concurrency Options threads, dataflow, par, seq "Cloud" Haskell A kind of Erlang/OTP clone in Haskell Data Parallel Haskell GHC extensions to support nested data parallelism accounting, "Nepal" Haskell’s Foreign Function Interface (FFI) Interface with native code from Haskell GPU Programming in Haskell Obsidian, Nikola, GpuGen, numerous papers on this too Much more. . . Research meeting industrial application
  • 90. Oh, the possibilities! Parallel / Concurrency Options threads, dataflow, par, seq "Cloud" Haskell A kind of Erlang/OTP clone in Haskell Data Parallel Haskell GHC extensions to support nested data parallelism accounting, "Nepal" Haskell’s Foreign Function Interface (FFI) Interface with native code from Haskell GPU Programming in Haskell Obsidian, Nikola, GpuGen, numerous papers on this too Much more. . . Research meeting industrial application
  • 91. Oh, the possibilities! Parallel / Concurrency Options threads, dataflow, par, seq "Cloud" Haskell A kind of Erlang/OTP clone in Haskell Data Parallel Haskell GHC extensions to support nested data parallelism accounting, "Nepal" Haskell’s Foreign Function Interface (FFI) Interface with native code from Haskell GPU Programming in Haskell Obsidian, Nikola, GpuGen, numerous papers on this too Much more. . . Research meeting industrial application
  • 92. Oh, the possibilities! Parallel / Concurrency Options threads, dataflow, par, seq "Cloud" Haskell A kind of Erlang/OTP clone in Haskell Data Parallel Haskell GHC extensions to support nested data parallelism accounting, "Nepal" Haskell’s Foreign Function Interface (FFI) Interface with native code from Haskell GPU Programming in Haskell Obsidian, Nikola, GpuGen, numerous papers on this too Much more. . . Research meeting industrial application
  • 93. Oh, the possibilities! Parallel / Concurrency Options threads, dataflow, par, seq "Cloud" Haskell A kind of Erlang/OTP clone in Haskell Data Parallel Haskell GHC extensions to support nested data parallelism accounting, "Nepal" Haskell’s Foreign Function Interface (FFI) Interface with native code from Haskell GPU Programming in Haskell Obsidian, Nikola, GpuGen, numerous papers on this too Much more. . . Research meeting industrial application
  • 94. Questions? Figure: http://www.flickr.com/photos/42682395@N04/ @SusanPotter
  • 95. Questions? Figure: http://www.flickr.com/photos/42682395@N04/ @SusanPotter
  • 96. Bonus: References / Resources Channel 9 Lectures (Erik Meijer) http://channel9.msdn.com/Shows/Going+Deep/ Lecture-Series-Erik-Meijer-Functional-Programming-Fundamentals-Chapter-1 Learn You A Haskell http://learnyouahaskell.com Haskell Reddit http://www.reddit.com/r/haskell/ Haskell Cafe http://www.haskell.org/mailman/listinfo/haskell-cafe Real World Haskell http://book.realworldhaskell.org/
  • 97. Bonus: References / Resources Channel 9 Lectures (Erik Meijer) http://channel9.msdn.com/Shows/Going+Deep/ Lecture-Series-Erik-Meijer-Functional-Programming-Fundamentals-Chapter-1 Learn You A Haskell http://learnyouahaskell.com Haskell Reddit http://www.reddit.com/r/haskell/ Haskell Cafe http://www.haskell.org/mailman/listinfo/haskell-cafe Real World Haskell http://book.realworldhaskell.org/
  • 98. Bonus: References / Resources Channel 9 Lectures (Erik Meijer) http://channel9.msdn.com/Shows/Going+Deep/ Lecture-Series-Erik-Meijer-Functional-Programming-Fundamentals-Chapter-1 Learn You A Haskell http://learnyouahaskell.com Haskell Reddit http://www.reddit.com/r/haskell/ Haskell Cafe http://www.haskell.org/mailman/listinfo/haskell-cafe Real World Haskell http://book.realworldhaskell.org/
  • 99. Bonus: References / Resources Channel 9 Lectures (Erik Meijer) http://channel9.msdn.com/Shows/Going+Deep/ Lecture-Series-Erik-Meijer-Functional-Programming-Fundamentals-Chapter-1 Learn You A Haskell http://learnyouahaskell.com Haskell Reddit http://www.reddit.com/r/haskell/ Haskell Cafe http://www.haskell.org/mailman/listinfo/haskell-cafe Real World Haskell http://book.realworldhaskell.org/
  • 100. Bonus: References / Resources Channel 9 Lectures (Erik Meijer) http://channel9.msdn.com/Shows/Going+Deep/ Lecture-Series-Erik-Meijer-Functional-Programming-Fundamentals-Chapter-1 Learn You A Haskell http://learnyouahaskell.com Haskell Reddit http://www.reddit.com/r/haskell/ Haskell Cafe http://www.haskell.org/mailman/listinfo/haskell-cafe Real World Haskell http://book.realworldhaskell.org/
  • 101. Bonus: Brief QuickCheck Example module Tests where import Test.QuickCheck (quickCheck) propReverseReverse :: [Char] -> Bool propReverseReverse s = (reverse . reverse) s == s excuse the weird syntax form, indenting didn’t show up ;( main = do {quickCheck propReverseReverse }