mirror of
https://github.com/tfausak/witch.git
synced 2024-11-26 09:43:03 +03:00
Remove some From
instances for TryFromException
This commit is contained in:
parent
74b833fffb
commit
b28f2920fa
@ -25,7 +25,6 @@ import qualified Data.Text as Text
|
||||
import qualified Data.Text.Encoding as Text
|
||||
import qualified Data.Text.Lazy as LazyText
|
||||
import qualified Data.Text.Lazy.Encoding as LazyText
|
||||
import qualified Data.Typeable as Typeable
|
||||
import qualified Data.Word as Word
|
||||
import qualified GHC.Float as Float
|
||||
import qualified Numeric.Natural as Natural
|
||||
@ -1080,30 +1079,6 @@ instance From.From
|
||||
(TryFromException.TryFromException s u)
|
||||
(TryFromException.TryFromException s t)
|
||||
|
||||
-- | Uses 'show'.
|
||||
instance
|
||||
( Show s
|
||||
, Typeable.Typeable s
|
||||
, Typeable.Typeable t
|
||||
) => From.From (TryFromException.TryFromException s t) String where
|
||||
from = show
|
||||
|
||||
-- | Converts via 'String'.
|
||||
instance
|
||||
( Show s
|
||||
, Typeable.Typeable s
|
||||
, Typeable.Typeable t
|
||||
) => From.From (TryFromException.TryFromException s t) Text.Text where
|
||||
from = Utility.via @String
|
||||
|
||||
-- | Converts via 'String'.
|
||||
instance
|
||||
( Show s
|
||||
, Typeable.Typeable s
|
||||
, Typeable.Typeable t
|
||||
) => From.From (TryFromException.TryFromException s t) LazyText.Text where
|
||||
from = Utility.via @String
|
||||
|
||||
fromNonNegativeIntegral
|
||||
:: (Integral s, Num t) => s -> Either Exception.ArithException t
|
||||
fromNonNegativeIntegral x =
|
||||
|
@ -1641,19 +1641,6 @@ main = Hspec.hspec . Hspec.describe "Witch" $ do
|
||||
Hspec.describe "From (TryFromException s t0) (TryFromException s t1)" $ do
|
||||
Hspec.it "needs tests" Hspec.pending
|
||||
|
||||
Hspec.describe "From (TryFromException s t) String" $ do
|
||||
test $ Witch.from (Witch.TryFromException Nothing Nothing :: Witch.TryFromException (Maybe Bool) (Maybe Int)) `Hspec.shouldBe` "TryFromException @(Maybe Bool) @(Maybe Int) Nothing Nothing"
|
||||
let f = Witch.from @(Witch.TryFromException Bool Int) @String
|
||||
test $ f (Witch.TryFromException False Nothing) `Hspec.shouldBe` "TryFromException @Bool @Int False Nothing"
|
||||
|
||||
Hspec.describe "From (TryFromException s t) Text" $ do
|
||||
let f = Witch.from @(Witch.TryFromException Bool Int) @Text.Text
|
||||
test $ f (Witch.TryFromException False Nothing) `Hspec.shouldBe` Text.pack "TryFromException @Bool @Int False Nothing"
|
||||
|
||||
Hspec.describe "From (TryFromException s t) LazyText" $ do
|
||||
let f = Witch.from @(Witch.TryFromException Bool Int) @LazyText.Text
|
||||
test $ f (Witch.TryFromException False Nothing) `Hspec.shouldBe` LazyText.pack "TryFromException @Bool @Int False Nothing"
|
||||
|
||||
test :: Hspec.Example a => a -> Hspec.SpecWith (Hspec.Arg a)
|
||||
test = Hspec.it ""
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user