Applicative.agda 604 B

12345678910111213141516171819202122232425
  1. module Logic.Structure.Applicative where
  2. data Applicative (f : Set -> Set) : Set1 where
  3. applicative :
  4. (pure : {a : Set} -> a -> f a)
  5. (_<*>_ : {a b : Set} -> f (a -> b) -> f a -> f b) ->
  6. Applicative f
  7. module ApplicativeM {f : Set -> Set}(App : Applicative f) where
  8. private
  9. pure' : Applicative f -> {a : Set} -> a -> f a
  10. pure' (applicative p _) = p
  11. app' : Applicative f -> {a b : Set} -> f (a -> b) -> f a -> f b
  12. app' (applicative _ a) = a
  13. pure : {a : Set} -> a -> f a
  14. pure = pure' App
  15. _<*>_ : {a b : Set} -> f (a -> b) -> f a -> f b
  16. _<*>_ = app' App