Skip to content

Instantly share code, notes, and snippets.

@hgiasac
Created January 4, 2019 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hgiasac/9ccd6a6e481938a25ad32a74922460f2 to your computer and use it in GitHub Desktop.
Save hgiasac/9ccd6a6e481938a25ad32a74922460f2 to your computer and use it in GitHub Desktop.
dynFst :: Dynamic -> Maybe Dynamic
dynFst (Dyn (TrApp _ rpa rb) x)
= case rpa of
TrApp rp ra -> case eqT rp (typeRep :: TypeRep (,)) of
Just Refl -> Just $ Dyn ra (fst x)
Nothing -> Nothing
_ -> Nothing
dynFst _ = Nothing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment