@@ -17,6 +17,17 @@ instance Applicative id where
17 pure a = a
17 pure a = a
18 f <$> a = f a
18 f <$> a = f a
20+class (Applicative f, VerifiedFunctor f) => VerifiedApplicative (f : Type -> Type) where
21+ applicativeMap : (x : f a) -> (g : a -> b) ->
22+ map g x = pure g <$> x
23+ applicativeIdentity : (x : f a) -> pure id <$> x = x
24+ applicativeComposition : (x : f a) -> (g1 : f (a -> b)) -> (g2 : f (b -> c)) ->
25+ ((pure (.) <$> g2) <$> g1) <$> x = g2 <$> (g1 <$> x)
26+ applicativeHomomorphism : (x : a) -> (g : a -> b) ->
27+ (<$>) {f} (pure g) (pure x) = pure {f} (g x)
28+ applicativeInterchange : (x : a) -> (g : f (a -> b)) ->
29+ g <$> pure x = pure (\g' : a -> b => g' x) <$> g
20infixl 2 <$
31infixl 2 <$
21(<$) : Applicative f => f a -> f b -> f a
32(<$) : Applicative f => f a -> f b -> f a
22a <$ b = map const a <$> b
33a <$ b = map const a <$> b