Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
applicative [2014/08/24 00:53]
nikolaj
applicative [2014/08/24 17:44]
nikolaj
Line 1: Line 1:
 ===== Applicative ===== ===== Applicative =====
 ==== Haskell class ==== ==== Haskell class ====
 +=== Definition ===
 <​code/​Haskell> ​ <​code/​Haskell> ​
 class Functor f => Applicative f where class Functor f => Applicative f where
Line 7: Line 8:
 </​code>​ </​code>​
  
-==== Discussion ==== +=== Laws === 
-Applicative is a functor together with a polymorphic function 'pure' lifting terms, as well as a function '(<*>)' which applies terms in the lifted function type to lifted terms. Note that 'f (a -> b)' is generally not a function space. E.g. the term '​Nothing'​ of 'Maybe (a->​b)'​ isn't a function.+pure id <​*> ​v $\ \leftrightsquigarrow\ $ v |
  
-=== Postulates === +pure f <*> pure x $\ \leftrightsquigarrow\ $ pure (f x) |
-^ pure id <*> v $\ \leftrightsquigarrow\ $ v ^ +
-pure f <*> pure x $\ \leftrightsquigarrow\ $ pure (f x) +
-^ u <*> pure y $\ \leftrightsquigarrow\ $ pure ($ y) <*> u ^ +
-^ u <*> (v <*> w) $\ \leftrightsquigarrow\ $ pure (.) <*> u <*> v <*> w ^+
  
-=== Associated methods ​=== +| u <*> pure y $\ \leftrightsquigarrow\ $ pure ($ y) <*> u | 
->todo+ 
 +| u <*> (v <*> w) $\ \leftrightsquigarrow\ $ pure (.) <*> u <*> v <*> w | 
 + 
 +==== Discussion ==== 
 +Applicative is a functor together with a polymorphic function '​pure'​ lifting terms, as well as a function '​(<​*>​)'​ which applies terms in the lifted function type to lifted terms. Note that 'f (a -> b)' is generally not a function space. E.g. the term '​Nothing'​ of 'Maybe (a->b)' isn't a function.
  
 === Reference === === Reference ===
Link to graph
Log In
Improvements of the human condition