ПК
Size: a a a
ПК
AV
ПК
instance CommandFirst Show where?
show Start = "start"
show Quit = "quit"
a
unsafeCoerceY
instance CommandFirst Show where?
show Start = "start"
show Quit = "quit"
data CommandFirst = <…> deriving (Show, Read)
newtype CommandFirstShow = CFS {unCFS :: CommandFirst}
instance Show CommandFirstShow where
show = uncap . show . unCFS
instance Read CommandFirstShow where
read = CFS . read . cap
AV
unsafeCoerceAV
AV
data CommandFirst = <…> deriving (Show, Read)
newtype CommandFirstShow = CFS {unCFS :: CommandFirst}
instance Show CommandFirstShow where
show = uncap . show . unCFS
instance Read CommandFirstShow where
read = CFS . read . cap
AV
AV
unsafeCoerceПК
data CommandFirst = <…> deriving (Show, Read)
newtype CommandFirstShow = CFS {unCFS :: CommandFirst}
instance Show CommandFirstShow where
show = uncap . show . unCFS
instance Read CommandFirstShow where
read = CFS . read . cap
a
s в Reifies s a инстансе если обернёшь свой енум в ньютайп который сохраняет проксюλ> reify ([1,2,3] :: [Int]) $ \l -> foldr (+) 0 (reflect l)
6
AV
AV
AV
YR
class X a where x :: String -> Maybe a
newtype Helper a = Helper a
instance X a => SomeClass (Helper a) where ....
data DDD = ....
deriving SomeClass via (X DDD)
Helper DDD. Но оно как-то из инстанса для Helper DDD выводит инстанс для DDD. То есть он сркыто внизу использует как бы deriving newtype? На нем получается базируется deriving via? А если Helper не newtype, а data? Тогда он как выведет?