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/d2dc0d7e926a5fd7c561b2fe1c171441 to your computer and use it in GitHub Desktop.
Save hgiasac/d2dc0d7e926a5fd7c561b2fe1c171441 to your computer and use it in GitHub Desktop.
pattern App :: forall k2 (t :: k2). ()
=> forall k1 (a :: k1 -> k2) (b :: k1). (t ~ a b)
=> TypeRep a -> TypeRep b -> TypeRep t
pattern App f x <- TrApp _ f x
where App f x = mkTrApp f x
dynFst :: Dynamic -> Maybe Dynamic
dynFst (Dyn (App (App rp ra) rb) x) = do
Refl <- eqT rp (typeRep :: TypeRep (,))
return $ Dyn ra (fst x)
dynFst _ = Nothing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment