type Name = String type Table = [ (Name, Name) ] fathers :: Table fathers = [ ("a", "d"), ("b", "r") ] head' :: [a] -> a head' (x:xs) = x helper :: Integer -> [a] -> Integer helper acc (x:xs) = helper (acc + 1) xs helper acc ([]) = acc len' :: [a] -> Integer len' xs = helper 0 xs inv :: [a] -> [a] -> [a] inv acc (x:xs) = inv (x : acc) xs inv acc [] = acc rev :: [a] -> [a] rev xs = inv [] xs -- 1 : 2 : 3 : [] -- 3 : 2 : 1 : [] getF :: Name -> Maybe Name getF n = lookup n fathers