Last active
February 1, 2017 09:36
-
-
Save kosmikus/68fd4a4cb1f7b15d91310c7367b2d297 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE AllowAmbiguousTypes, ConstraintKinds, RankNTypes, ScopedTypeVariables #-} | |
module CompTest where | |
import Generics.SOP | |
import Generics.SOP.Constraint | |
-- hcmap :: (HAp h, AllN (Prod h) c xs) => proxy c -> (forall a . c a => f a -> f' a) -> h f xs -> h f' xs | |
-- hcollapse :: (HCollapse h, SListIN h xs) => h (K a) xs -> CollapseTo h a | |
hcmapQ :: | |
forall h c b xs proxy . | |
(HAp h, AllN (Prod h) c xs, HCollapse h, SListIN h xs) | |
=> proxy c -> (forall a . c a => a -> b) -> h I xs -> CollapseTo h b | |
hcmapQ p f x = hcollapse (hcmap p g x :: h (K b) xs) | |
where | |
g :: forall a xs . c a => I a -> K b a | |
g = K . f . unI |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment