• Save
Haskell
Upcoming SlideShare
Loading in...5
×
 

Haskell

on

  • 790 views

 

Statistics

Views

Total Views
790
Views on SlideShare
790
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Haskell Haskell Presentation Transcript

  • HaskellBy Jackson Oliveira @cyber_jso
  • The First Version Is From Nineties
  • In The Beginning, It Was Just to Learn
  • But With The Principal Functional Programming Resources Curryng Partial Processing FUNCTION COMPOSITIONMonads Lambda
  • So, What is Haskell Then?• A Pure Functional Language.• It’s Static Typed.• It implement the immutableconcept.
  • Complex Things Looks Like Easy
  • It Uses a Lot of Recursion There is No Loops
  • How Can We Compile Haskell Code? • Glaskell Haskell Compiler • NHC98 • Hugs (Intepreter) • LHC
  • Lets See Some code
  • Distributing an Applicationmodule Main wheremain = putStrLn "Hello Functional Society!“In the command line:> ghc -o hello main.hs> ./hello> Hello Functional Society!
  • List Handling> 0:[1,2] > map Char.toUpper "Hello World"[0,1,2] "HELLO WORLD“ > zipWith „ (++) [“foo”, “bye”] [“bar”, “ bye”]> 5:[1,2,3,4] [“foo bar”, “bye bye”][5,1,2,3,4] > foldr (+) 0 [3,8,12,5] 28 > foldl (+) 0 [3,8,12,5] 28
  • Recursionmodule QuickSort where > quickSort [3, 1, 4]quickSort [] = [] > [1, 3, 4]quickSort [x] = [x]quickSort (x : xs) = (quickSort less) ++ (x : equal) ++ (quickSort more) where less = filter (< x) xs equal = filter (== x) xs more = filter (> x) xs
  • The Previous Recursion Wrote in Cvoid qsort(int a[], int lo, int hi){ int h, l, p, t; if (lo < hi) { l = lo; h = hi; p = a[hi]; do { while ((l < h) && (a[l] <= p)) l = l+1; while ((h > l) && (a[h] >= p)) h = h-1; if (l < h) { t = a[l]; a[l] = a[h]; a[h] = t; } } while (l < h); a[hi] = a[l]; a[l] = p; qsort( a, lo, l-1 ); qsort( a, l+1, hi ); }}
  • Let/inletExample a b = let testValue = (+) a b in (((+) testValue 1), ((-) testValue 1))
  • Curryng> max 5 4 > max 44 > [function of max] 5 5 > f(x + y/2) = 2 > 5
  • Partial Processing> add x y = x + y> addOne = add 1> addOne 23
  • Wild Cards> caseExample x = > [1 .. 10] case x of [1,2,3,4,5,6,7,8,9,10] 0 -> 1 1 -> 5 > myFunction 3 = 3 2 -> 2 _ -> -1 > myFunction _ = 0
  • Advantages in Learn Haskell?• Open your mind!• Make your code cleaner• It has a community supporting• You have the control!
  • Ecosystem• Web Frameworks! • Persistence Frameworks• Test Frameworks. • Web Servers• Concurrency andSTM Frameworks
  • Disvantages• It can Looks like complex in thebeginning.• It isn’t performatic• Doesn’t implement some bstractionslike other functional languages
  • Thank You! Haskell By Jackson Oliveira @cyber_jso