mirror of
https://github.com/tfausak/witch.git
synced 2024-11-22 14:58:13 +03:00
Improve documentation around try cast exceptions
This commit is contained in:
parent
feb1465a4f
commit
3da265dbf3
@ -1076,8 +1076,12 @@ instance Cast.Cast LazyText.Text LazyByteString.ByteString where
|
||||
|
||||
-- TryCastException
|
||||
|
||||
instance Cast.Cast (TryCastException.TryCastException s t0) (TryCastException.TryCastException s t1)
|
||||
-- | Uses @coerce@.
|
||||
instance Cast.Cast
|
||||
(TryCastException.TryCastException s u)
|
||||
(TryCastException.TryCastException s t)
|
||||
|
||||
-- | Uses 'show'.
|
||||
instance
|
||||
( Show s
|
||||
, Typeable.Typeable s
|
||||
@ -1085,6 +1089,7 @@ instance
|
||||
) => Cast.Cast (TryCastException.TryCastException s t) String where
|
||||
cast = show
|
||||
|
||||
-- | Converts via 'String'.
|
||||
instance
|
||||
( Show s
|
||||
, Typeable.Typeable s
|
||||
@ -1092,6 +1097,7 @@ instance
|
||||
) => Cast.Cast (TryCastException.TryCastException s t) Text.Text where
|
||||
cast = Utility.via @String
|
||||
|
||||
-- | Converts via 'String'.
|
||||
instance
|
||||
( Show s
|
||||
, Typeable.Typeable s
|
||||
|
@ -8,7 +8,9 @@ import qualified Data.Typeable as Typeable
|
||||
|
||||
-- | This exception is thrown when a @TryCast@ conversion fails. It has the
|
||||
-- original @source@ value that caused the failure and it knows the @target@
|
||||
-- type it was trying to convert into.
|
||||
-- type it was trying to convert into. It also has an optional
|
||||
-- 'Exception.SomeException' for communicating what went wrong while
|
||||
-- converting.
|
||||
data TryCastException source target = TryCastException
|
||||
source
|
||||
(Maybe Exception.SomeException)
|
||||
|
Loading…
Reference in New Issue
Block a user