on 137ebed help sign in
rel8/src/Rel8/Generic/Reify.hs
24 lines 548 B history raw
1{-# language StandaloneKindSignatures #-}
2{-# language TypeFamilies #-}
4module Rel8.Generic.Reify
5 ( ARep
6 )
7where
9-- base
10import Data.Functor.Contravariant ( Contravariant, contramap )
11import Data.Kind ( Type )
12import Data.Void ( Void, absurd )
13import GHC.Generics ( Generic, Rep, from, to )
14import Prelude
17type ARep :: (Type -> Type) -> Type
18newtype ARep rep = ARep (rep Void)
21instance (Contravariant rep, Functor rep) => Generic (ARep rep) where
22 type Rep (ARep rep) = rep
23 from (ARep a) = fmap absurd a
24 to = ARep . contramap absurd