DYEZ6CABMQQZD5GZR2DPR7NTHQH3GVT2ZI5ALX2YMEDWPS3YRNKQC
result <- liftIO $ withFile filename ReadMode
(ByteString.hGetContents >=> return . fromJson @Index . ByteString.fromStrict)
case result of
Nothing -> lift $ throwE "Unable to parse JSON into AlBhed.Index"
Just x -> return x
liftIO $ withFile filename ReadMode
(ByteStringLazy.hGetContents >=> printContent)
printContent :: (MonadFail m) => ByteString -> m Index
printContent = maybe (fail "Could not parse JSON into AlBhed.Index.Index") pure . fromJson @Index