mirror of
https://github.com/i-am-tom/higgledy.git
synced 2024-08-17 03:50:23 +03:00
Expose a generic rep for HKD
All we do is expose the internal rep "as" the generic rep. I need to do a bit of experimentation, but this _might_ actually make the generic lenses here redundant...
This commit is contained in:
parent
7527a89678
commit
b34a9c707e
@ -34,6 +34,7 @@ module Data.Generic.HKD.Types
|
||||
import Data.Barbie (ConstraintsB (..), FunctorB (..), ProductB (..), ProductBC (..), TraversableB (..))
|
||||
import Data.Barbie.Constraints (Dict (..))
|
||||
import Data.Function (on)
|
||||
import Data.Functor.Contravariant (Contravariant (..), phantom)
|
||||
import Data.Functor.Product (Product (..))
|
||||
import Data.Kind (Constraint, Type)
|
||||
import Data.Proxy (Proxy (..))
|
||||
@ -82,6 +83,13 @@ import Test.QuickCheck.Function (Function (..), functionMap)
|
||||
newtype HKD (structure :: Type) (f :: Type -> Type)
|
||||
= HKD { runHKD :: HKD_ f structure Void }
|
||||
|
||||
instance (Contravariant (HKD_ f structure), Functor (HKD_ f structure))
|
||||
=> Generic (HKD structure f) where
|
||||
type Rep (HKD structure f) = HKD_ f structure
|
||||
|
||||
from = phantom . runHKD
|
||||
to = HKD . phantom
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
-- | Calculate the "partial representation" of a type.
|
||||
|
Loading…
Reference in New Issue
Block a user