From b64a6c258a1d149fc7438ce0513530bbca0b931c Mon Sep 17 00:00:00 2001
From: Neil Smith <NeilNjae@users.noreply.github.com>
Date: Mon, 5 Dec 2022 11:38:38 +0000
Subject: [PATCH] With catMaybes

---
 advent05/Main.hs | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/advent05/Main.hs b/advent05/Main.hs
index 727822d..21daf43 100644
--- a/advent05/Main.hs
+++ b/advent05/Main.hs
@@ -52,9 +52,7 @@ extractName (Crate c) = c
 
 makeWharf :: [[Maybe Crate]] -> [Int] -> Wharf
 makeWharf wharfLines colNames = M.fromList $ zip colNames wharfCols
-  where wharfCols = fmap (fmap fromJust)
-                  $ fmap (dropWhile isNothing) 
-                  $ transpose wharfLines
+  where wharfCols = fmap catMaybes $ transpose wharfLines
 
 applyMoves1 :: Wharf -> [Move] -> Wharf
 applyMoves1 wharf moves = foldl' applyMove1 wharf moves
-- 
2.43.0