5df1fb660c0cb3a41e18e21802e482e7ea75fb7a — Christopher Vollick 2 years ago 04b7770
Replace Non-Exhaustive Pattern with Case

I did this because in newer versions of GHC things like this require a
MonadFail instance, whereas explicitly handling it like this does not.

Now, we don't currently require those newer versions, but since I happened to
have a new one it was causing me trouble. And this new way works in both
versions, so I think it's safe to just throw it in here.
1 files changed, 6 insertions(+), 5 deletions(-)

M StoreChunks.hs
M StoreChunks.hs => StoreChunks.hs +6 -5
@@ 34,11 34,12 @@ storeChunks storePath tmpName getChunk = loop hashInit hashInit hashInit
	tmpPath = storePath ++ "/tmp/" ++ tmpName
	cidPath digest = storePath ++ "/" ++ textToString (digestCID digest)
	loop sha1 sha256 sha512 = do
			Just chunk <- UIO.lift getChunk
			if ByteString.null chunk then
				finish sha1 sha256 sha512
				step sha1 sha256 sha512 chunk
		maybeChunk <- UIO.lift getChunk
		case maybeChunk of
			Nothing -> return $ Left $ userError "Failed to getChunk"
			Just chunk
				| ByteString.null chunk -> finish sha1 sha256 sha512
				| otherwise -> step sha1 sha256 sha512 chunk

	step sha1 sha256 sha512 chunk = do
		result <- UIO.fromIO' (error.show) $ do