Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 13th, 2012  |  syntax: None  |  size: 0.46 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Haskell import and export
  2. t1.hs-----
  3. module t1 (add1) where
  4. add1 :: Int -> Int
  5. add1 x = x + 1
  6.  
  7. t2.hs-----
  8. module t2 where
  9. import t1
  10.    add1 2
  11.        
  12. module T1 (add1) where
  13. add1 :: Int -> Int
  14. add1 x = x + 1
  15.        
  16. module T2 where
  17. import T1
  18. main = do
  19.   let x = add1 2
  20.   putStrLn (show x)
  21.        
  22. t1.hs-----
  23. module T1 (add1) where
  24. add1 :: Int -> Int
  25. add1 x = x + 1
  26.  
  27. t2.hs-----
  28. module T2 where
  29. import T1
  30.    add1 2
  31.        
  32. t2.hs-----
  33. module t2 where
  34. import t1
  35.    add1to2 = add1 2