mirror of
https://github.com/tfausak/witch.git
synced 2024-11-29 11:47:44 +03:00
Add an instance for untagging values
This commit is contained in:
parent
7c5226d034
commit
80ce46e898
@ -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 ::
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user