Add an instance for untagging values

This commit is contained in:
Taylor Fausak 2022-10-01 13:53:08 +00:00 committed by GitHub
parent 7c5226d034
commit 80ce46e898
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -1278,6 +1278,9 @@ instance From.From Time.ZonedTime Time.UTCTime where
-- | Uses @coerce@. Essentially the same as 'Tagged.Tagged'.
instance From.From a (Tagged.Tagged t a)
-- | Uses @coerce@. Essentially the same as 'Tagged.unTagged'.
instance From.From (Tagged.Tagged t a) a
--
realFloatToRational ::

View File

@ -2076,6 +2076,11 @@ spec = describe "Witch" $ do
it "works" $ do
f False `shouldBe` Tagged.Tagged False
describe "From (Tagged t a) a" $ do
let f = Witch.from @(Tagged.Tagged () Bool) @Bool
it "works" $ do
f (Tagged.Tagged False) `shouldBe` False
newtype Age
= Age Int.Int8
deriving (Eq, Show)