{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MonoLocalBinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE UndecidableInstances #-}
module Data.Generics.Product.List
( IsList (..)
, IsRecord
, IsRecord'
) where
import Data.Generics.Product.Internal.List
import Data.Kind
import GHC.Generics
import GHC.TypeLits
import Data.Generics.Internal.Profunctor.Iso
class IsList
(m :: Type)
(f :: Type)
(g :: Type)
(as :: [(m, Type)])
(bs :: [(m, Type)]) | m f -> as, m g -> bs where
list :: Iso f g (List as) (List bs)
instance
( Generic f
, Generic g
, GIsList m (Rep f) (Rep g) as bs
) => IsList m f g as bs where
list = repIso . glist @m
{-# INLINE list #-}
class IsList Symbol f g as bs => IsRecord f g (as :: [(Symbol, Type)]) (bs :: [(Symbol, Type)]) | f -> as, g -> bs
instance IsList Symbol f g as bs => IsRecord f g as bs
class IsRecord f f as as => IsRecord' f (as :: [(Symbol, Type)]) | f -> as
instance IsRecord f f as as => IsRecord' f as