Module Utils

This module provides some utility operations.

Author: Jan Tikovsky

Version: January 2018

Summary of exported operations:

zipWithM_ :: Monad a => (b -> c -> a d) -> [b] -> [c] -> a ()   
(<$>) :: Monad a => (b -> c) -> a b -> a c   
Apply a pure function to the result of a monadic action.
(<*>) :: Monad a => a (b -> c) -> a b -> a c   
Apply a function originating from the first monadic computation to the result of the second monadic action.
rpad :: Int -> String -> String   
Pad a string to a specific length with space from the right side.
swap :: (a,b) -> (b,a)   
swap the components of a tuple
zip3 :: [a] -> [b] -> [c] -> [(a,b,c)]   
zip three lists
ppFM :: ((a,b) -> Doc) -> FM a b -> Doc   
Pretty print finite map
inDirectory :: String -> IO a -> IO a   
Perform an IO action in the given directory and return to the previous directory afterwards
mapFst :: (a -> b) -> (a,c) -> (b,c)   
mapSnd :: (a -> b) -> (c,a) -> (c,b)   
fst3 :: (a,b,c) -> a   
snd3 :: (a,b,c) -> b   
trd3 :: (a,b,c) -> c   
trTpl3 :: (a -> b) -> (c -> d) -> (e -> f) -> (a,c,e) -> (b,d,f)   

Exported operations:

zipWithM_ :: Monad a => (b -> c -> a d) -> [b] -> [c] -> a ()   

(<$>) :: Monad a => (b -> c) -> a b -> a c   

Apply a pure function to the result of a monadic action.

Further infos:
  • defined as left-associative infix operator with precedence 4

(<*>) :: Monad a => a (b -> c) -> a b -> a c   

Apply a function originating from the first monadic computation to the result of the second monadic action.

Further infos:
  • defined as left-associative infix operator with precedence 4

rpad :: Int -> String -> String   

Pad a string to a specific length with space from the right side.

swap :: (a,b) -> (b,a)   

swap the components of a tuple

Further infos:
  • solution complete, i.e., able to compute all solutions

zip3 :: [a] -> [b] -> [c] -> [(a,b,c)]   

zip three lists

ppFM :: ((a,b) -> Doc) -> FM a b -> Doc   

Pretty print finite map

inDirectory :: String -> IO a -> IO a   

Perform an IO action in the given directory and return to the previous directory afterwards

mapFst :: (a -> b) -> (a,c) -> (b,c)   

mapSnd :: (a -> b) -> (c,a) -> (c,b)   

fst3 :: (a,b,c) -> a   

Further infos:
  • solution complete, i.e., able to compute all solutions

snd3 :: (a,b,c) -> b   

Further infos:
  • solution complete, i.e., able to compute all solutions

trd3 :: (a,b,c) -> c   

Further infos:
  • solution complete, i.e., able to compute all solutions

trTpl3 :: (a -> b) -> (c -> d) -> (e -> f) -> (a,c,e) -> (b,d,f)