-
-
Save hgiasac/04d042773d726353b0258c1a4a38bcc7 to your computer and use it in GitHub Desktop.
This file contains 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
dynFst :: Dynamic -> Maybe Dynamic | |
-- dynFst (Dyn (rpab :: TypeRep pab) (x :: pab)) | |
dynFst (Dyn (TrApp _ (rpa :: TypeRep pa) (rb :: TypeRep b)) (x :: pab)) | |
-- introduces kind k2, and types pa :: k2 -> *; b :: k2 | |
= case rpa of | |
TrApp (rp :: TypeRep p) (ra :: TypeRep a) -> | |
-- introduces kind k1, and types p :: k1 -> k2 -> *, a :: k1 | |
case eqT rp (typeRep :: TypeRep (,)) of | |
Just Refl -> Just $ Dyn ra (fst x) | |
-- introduces p ~ (,) and (k1 -> k2 -> *) ~ (* -> * -> *) | |
Nothing -> Nothing | |
_ -> Nothing | |
dynFst _ = Nothing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment