Advertisement
PonaFly

Untitled

Dec 11th, 2016
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import Data.Maybe
  2. import Control.Monad
  3. import Control.Applicative
  4. import Data.Tuple
  5. getplus :: [Integer] -> [(Integer->Integer)]
  6. getplus lst = fmap (+) lst
  7.  
  8. getspec :: Integer -> [Integer] -> [Integer]
  9. getspec n lst = fmap (+ n) lst
  10.  
  11. summ :: [Integer] -> [Integer] -> [Integer]
  12. summ lst1 lst2 =  getplus lst1 <*> lst2
  13.  
  14. decart :: [Integer] -> [Integer] -> [(Integer,Integer)]
  15. decart lst1 lst2 = (,) <$> lst1 <*> lst2
  16.  
  17. get3 ::  [Maybe Int] -> [ Maybe Int]
  18. get3 lst = fmap ((+3) <$> ) lst
  19.  
  20. comp1 :: (String,Int) -> Int -> (String,Int)
  21. comp1 ch n = (+ n) <$> ch
  22.  
  23. comp2 :: (Int,String) -> Int -> (String,Int)
  24. comp2 ch n = (+ n) <$> (swap ch)
  25.  
  26. incr :: [(String,Int)] -> Int -> [(String,Int)]
  27. incr lst n = fmap ((+n) <$>) lst
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement