1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 06:41:45 +03:00

Define default implementations of pack1 and unpack1 for Generic1 types.

This commit is contained in:
Rob Rix 2018-03-07 18:56:50 -05:00
parent 9c49bb2f0c
commit e30a4d3f25

View File

@ -36,7 +36,12 @@ class Newtype1 n where
type O1 n :: * -> *
pack1 :: O1 n a -> n a
default pack1 :: (Generic1 n, GNewtype1 (Rep1 n), O1 n ~ GO1 (Rep1 n)) => O1 n a -> n a
pack1 = to1 . gpack1
unpack1 :: n a -> O1 n a
default unpack1 :: (Generic1 n, GNewtype1 (Rep1 n), O1 n ~ GO1 (Rep1 n)) => n a -> O1 n a
unpack1 = gunpack1 . from1
class GNewtype1 n where
type GO1 n :: * -> *