Exponential type generalization

How (if at all) does exponential interpretation (->)( a -> blike $ b ^ a $) generalize to categories other than Hask / Set? For example, it would seem that the interpretation of the category of non-deterministic functions is approximately equal Kliesli [] a bto $ 2 ^ (a * b) $ (a → b → Bool).

+4
source share
1 answer

The concept of an exponent can be defined in general terms outside of a Hask / Set. A category with exhibitors and products is called a Cartesian closed category . This is a key concept in theoretical informatics, since each cc category is essentially a model of typed lambda calculus.

, a,b :

  • (a * b)
  • (b^ab)

  • eval : (b^a)*a -> b ( Haskell: \(f,x) -> f x, AKA)
  • f : (a*b)->c Lf : a -> (c^b) ( Haskell: curry f)

" ", .. f : (a*b)->c, :

  • f = (Lf * id_a) ; eval

Haskell :

  • f = \(x :: (a,b), y :: a) -> apply (curry f x, id y) where apply (g,z) = g z

, ,

  • f = (curry f *** id) >>> apply where apply (g,z) = g z
+4

Source: https://habr.com/ru/post/1569066/


All Articles