why use haskell?

Download Why Use Haskell?

Post on 12-May-2015




0 download

Embed Size (px)


A few times now, I've been asked, "Haskell looks cool, but what should I use it for?" This presentation attempts to showcase some of the unique parts of Haskell in order to make it easier to understand why you might be interested in learning it.


  • 1.Why use Haskell?

2. Haskell was made by some really smart guys (with PhDs). - Learn You a Haskell 3. Haskell is a purely functional programming language. 4. Easier to Understand 5. Ruby def plan_name @user.account.plan.name endHaskell planName :: User -> String planName = name . plan . account 6. Ruby def slugs(projects) projects. map { |project| project. name. downcase }. uniq endHaskell slugs :: [Project] -> [String] slugs = uniq . map (downcase . projectName) 7. Less Buggy No distinction between pass by reference, pass by value.Dont need to worry about dup, freeze, and friends. 8. Easier to Write 9. RubyHaskelldef combine(elements, new_element) combine :: Combinable a => Seq a -> existing_index = a -> elements. Seq a find_index { |existing| combine xs x = existing. case existingIndex of combinable?(new_element) Just i -> } adjust (combine x) i xs if existing_index Nothing -> existing_element = x Int !data Square = Square Int instance Shape Square where area (Square length) = length * length !data Rectangle = Rectangle Int Int instance Shape Rectangle where area (Rectangle width length) = width * length 24. Ruby def plan_name(user) if user.account user.account.plan.name end endHaskell planName :: User -> String planName user = (name . plan) account user 25. Ruby def plan_name(user) user.account.plan.name endAirbrake ErrorHaskell planName :: User -> String planName user = name $ plan $ account userCompile Error 26. Haskell is fun, safe, and fast. Clearer code with types and less boilerplate.Fewer bugs with type safety and immutable objects.Compiled code runs quickly, even in parallel. 27. Getting Started brew install haskell-platform Learn You a Haskell http://learnyouahaskell.com