**myMaybeToList:**
> myMaybeToList :: Maybe a -> [a]
> myMaybeToList = maybe [] (: [])
Derivation:
``` haskell
myMaybeToList = maybe _n _j
maybe _n _j Nothing = []
_n = []
maybe _n _j (Just x) = x : []
_j x = x : []
_j = (: [])
```

**mApply:**
> mApply :: b -> Maybe (a -> b) -> a -> b
> mApply defY mf x = maybe defY ($ x) mf
Derivation:
``` haskell
mApply _n _j Nothing = defY
_n = defY
mApply _n _j (Just f) = f x
_j f = f x
_j f = f $ x
_j = ($ x)
```

**myMap:**
> myMap :: (a -> b) -> [a] -> [b]
> myMap f = foldr (\x ys -> f x : ys) []
Derivation:
``` haskell
foldr _f _z [] = []
_z = []
foldr _f _z (x:xs) = f x : myMap f xs
_f x (foldr _f _z xs) = f x : myMap f xs
_f x (myMap f xs) = f x : myMap f xs
_f x ys = f x : ys
```

**myConcatMap:**
> myConcatMap :: (a -> [b]) -> [a] -> [b]
> myConcatMap f = foldr (\x ys -> f x ++ ys) []
Derivation:
``` haskell
foldr _f _z [] = []
_z = []
foldr _f _z (x:xs) = f x ++ myConcatMap f xs
_f x (foldr _f _z xs) = f x ++ myConcatMap f xs
_f x (myConcatMap f xs) = f x ++ myConcatMap f xs
_f x ys = f x ++ ys
```

**myFilter:**
> myFilter :: (a -> Bool) -> [a] -> [a]
> myFilter p =
> foldr (\x ys -> if p x then x : ys else ys) []
Derivation:
``` haskell
foldr _f _z [] = []
_z = []
foldr _f _z (x:xs) = if p x then x : myFilter p xs else myFilter p xs
_f x (foldr _f _z xs) = if p x then x : myFilter p xs else myFilter p xs
_f x (myFilter p xs) = if p x then x : myFilter p xs else myFilter p xs
_f x ys = if p x then x : ys else ys
```

**myDrop:**
> myDrop :: Int -> [a] -> [a]
> myDrop n xs = foldr f (const []) xs n
> where
> f x more n =
> if n <= 0
> then x : more 0
> else more (n - 1)
Derivation:
``` haskell
foldr _f _z [] n = []
_z n = []
_z = const []
foldr _f _z (x:xs) n =
if n <= 0
then x : xs
else foldr _f _z xs (n - 1)
_f x (foldr _f _z xs) n =
if n <= 0
then x : xs -- xs is not in scope, but ...
else foldr _f _z xs (n - 1)
_f x (foldr _f _z xs) n =
if n <= 0
then x : myDrop 0 xs -- xs = myDrop 0 xs
else foldr _f _z xs (n - 1)
_f x (foldr _f _z xs) n =
if n <= 0
then x : foldr _f _z xs 0
else foldr _f _z xs (n - 1)
_f x more n =
if n <= 0
then x : more 0
else more (n - 1)
```

**repInc:**
> repInc :: [a] -> [a]
> repInc xs = foldr f (const []) xs 1
> where
> f x more n = replicate n x ++ more (n + 1)
Derivation:
``` haskell
foldr _f _z [] n = []
_z n = []
_z = const []
foldr _f _z (x:xs) n = replicate n x ++ foldr _f _z xs (n + 1)
_f x (foldr _f _z xs) n = replicate n x ++ foldr _f _z xs (n + 1)
_f x more n = replicate n x ++ more (n + 1)
```

**(!!?):**
> (!!?) :: [a] -> Int -> Maybe a
> (!!?) = foldr f (const Nothing)
> where
> f x _ 0 = Just x
> f _ more n = more (n - 1)
Derivation method 1:
``` haskell
foldr _f _z [] n = Nothing
_z n = Nothing
_z = const Nothing
foldr _f _z (x:xs) n =
if n == 0 then Just x else xs !!? (n - 1)
_f x (foldr _f _z xs) n =
if n == 0 then Just x else xs !!? (n - 1)
_f x (foldr _f _z xs) n =
if n == 0 then Just x else foldr _f _z xs (n - 1)
_f x more n =
if n == 0 then Just x else more (n - 1)
```
Derivation method 2:
``` haskell
foldr _f _z [] n = Nothing
_z n = Nothing
_z = const Nothing
foldr _f _z (x:xs) 0 = Just x
_f x (foldr _f _z xs) 0 = Just x
_f x _ 0 = Just x
foldr _f _z (x:xs) n | n /= 0 = xs !!? (n - 1)
_f x (foldr _f _z xs) n | n /= 0 = xs !!? (n - 1)
_f x (foldr _f _z xs) n | n /= 0 = foldr _f _z xs (n - 1)
_f x more n | n /= 0 = more (n - 1)
```

**dropEveryOther:**
> dropEveryOther :: [a] -> [a]
> dropEveryOther xs = foldr f (const []) xs True
> where
> f _ more False = more True
> f x more True = x : more False
Derivation method 1:
``` haskell
foldr _f _z [] b = []
_z b = []
_z = const []
foldr _f _z (x:xs) b =
if b
then x : foldr _f _z xs False
else foldr _f _z xs True
_f x (foldr _f _z xs) b =
if b
then x : foldr _f _z xs False
else foldr _f _z xs True
_f x more b =
if b
then x : more False
else more True
```
Derivation method 2:
``` haskell
foldr _f _z [] b = []
_z b = []
_z = const []
foldr _f _z (x:xs) False = foldr _f _z xs True
_f x (foldr _f _z xs) False = foldr _f _z xs True
_f x more False = more True
foldr _f _z (x:xs) True = x : foldr _f _z xs False
_f x (foldr _f _z xs) True = x : foldr _f _z xs False
_f x more True = x : more False
```