Skip to content
Snippets Groups Projects
Commit 626a02d4 authored by Jean-Paul Calderone's avatar Jean-Paul Calderone
Browse files

LambdaCase, why not

parent 9484710e
No related branches found
No related tags found
1 merge request!15Use ExceptT
Pipeline #5555 passed
{-# 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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment