Advanced Topics in Haskell

3,057 views

Published on

A supplement to the talk for introduction to Haskell at Open Source Conference 2007

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,057
On SlideShare
0
From Embeds
0
Number of Embeds
33
Actions
Shares
0
Downloads
54
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Advanced Topics in Haskell

  1. 1. ikegami@madscientist.jp 1
  2. 2. 2
  3. 3. 3
  4. 4. 4
  5. 5. 5
  6. 6. 6
  7. 7. 7
  8. 8. 8
  9. 9. 9
  10. 10. a = 10 a = 10 a = 10 b = 20 b = 20 b = 20 c = 30 c = 30 c = 30 10
  11. 11. 11
  12. 12. a=b+c a=b+c where where b=2 { b = 2; c=3 c = 3; } 12
  13. 13. 13
  14. 14. 14
  15. 15. 15
  16. 16. 16
  17. 17. 17
  18. 18. 18
  19. 19. 19
  20. 20. 20
  21. 21. 21
  22. 22. 22
  23. 23. 23
  24. 24. 24
  25. 25. 25
  26. 26. 26
  27. 27. 27
  28. 28. 28
  29. 29. 29
  30. 30. main :: IO () main = mapM_ (putStrLn . fizzBuzz) [1..] fizzBuzz :: Integer -> String fizzBuzz x | x `mod` 15 == 0 = quot;FizzBuzzquot; | x `mod` 3 == 0 = quot;Fizzquot; | x `mod` 5 == 0 = quot;Buzzquot; | otherwise = show x 30
  31. 31. 31
  32. 32. unsafePerformIO import System.IO.Unsafe unsafePerformIO :: IO a -> a 32
  33. 33. unsafePerformIO import Data.Generics cast :: (Typeable a, Typeable b) => a -> Maybe b 33
  34. 34. Haskell FFI FFI = Foreign Function Interface import Foreign data CChar data CInt 34
  35. 35. Windows API import System.Win32 hKEY_CURRENT_USER :: HKEY 35
  36. 36. Dons’ eval http://www.cse.unsw.edu.au/~dons/hs-plugins/ eval :: Typeable a => String -> [Import] -> IO (Maybe a) 36

×