From 626a02d48f630eaf21e05ed2b3733e6feedbc17d Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone <exarkun@twistedmatrix.com> Date: Tue, 14 Nov 2023 14:42:15 -0500 Subject: [PATCH] LambdaCase, why not --- download-sdmf/Main.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/download-sdmf/Main.hs b/download-sdmf/Main.hs index b6e3f8b..1f38473 100644 --- a/download-sdmf/Main.hs +++ b/download-sdmf/Main.hs @@ -1,4 +1,5 @@ {-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE LambdaCase #-} module Main where @@ -23,16 +24,16 @@ main = =<< ( runExceptT $ do [announcementPath, readCap] <- lift getArgs - -- Parse read capability - cap <- mightFail "Failed to parse capability: " . pure . parse pCapability "<argv>" . T.pack $ readCap -- Load server announcements announcements <- mightFail "Failed to parse announcements: " $ decodeFileEither announcementPath - case cap of - (SDMFVerifier _) -> ExceptT . pure . Left . Failed $ "Nothing implemented for verifier capabilities." - (SDMFWriter rwcap) -> go announcements (writerReader rwcap) - (SDMFReader rocap) -> go announcements rocap + -- Parse read capability + (mightFail "Failed to parse capability: " . pure . parse pCapability "<argv>" . T.pack) readCap + >>= \case + SDMFVerifier _ -> ExceptT . pure . Left . Failed $ "Nothing implemented for verifier capabilities." + SDMFWriter rwcap -> go announcements (writerReader rwcap) + SDMFReader rocap -> go announcements rocap ) where go :: Announcements -> Reader -> ExceptT Failed IO BL.ByteString -- GitLab