Use more succinct definition

This commit is contained in:
Taylor Fausak 2021-05-28 16:03:47 -04:00 committed by GitHub
parent dc2af8f277
commit f5fc6ed6df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -254,9 +254,7 @@ instance TryFrom.TryFrom Int.Int64 Natural.Natural where
-- This should use @eitherTryFrom fromNonNegativeIntegral@, but that causes -- This should use @eitherTryFrom fromNonNegativeIntegral@, but that causes
-- a bug in GHC 9.0.1. -- a bug in GHC 9.0.1.
-- https://mail.haskell.org/pipermail/haskell-cafe/2021-March/133540.html -- https://mail.haskell.org/pipermail/haskell-cafe/2021-March/133540.html
tryFrom s = case TryFrom.tryFrom (From.from s :: Integer) of tryFrom = Utility.eitherTryFrom $ \ s -> TryFrom.tryFrom (From.from s :: Integer)
Left (TryFromException.TryFromException _ e) -> Left $ TryFromException.TryFromException s e
Right t -> Right t
-- | Uses 'fromIntegral' when the input is between -16,777,215 and 16,777,215 -- | Uses 'fromIntegral' when the input is between -16,777,215 and 16,777,215
-- inclusive. -- inclusive.