
Hmmmm...
On Fri, Sep 10, 2010 at 6:47 PM, Jan Christiansen
instance Applicative Proj where pure = Proj . const Proj f <*> Proj x = Proj (\p -> f (False:p) (x (True:p)))
(pure f) <*> Proj x === Proj (const f) <*> Proj x === Proj (\p -> (const f) (False:p) (x (True:p))) === Proj (\p -> f (x (True:p))) Proj f <*> (pure x) === Proj f <*> Proj (const x) === Proj (\p -> f (False:p) ((const x) (True:p))) === Proj (\p -> f (False:p) x))
instance Applicative Proj where pure x = Pure x Pure f <*> Pure x = Pure (f x) Pure f <*> Proj x = Proj (\p -> f (x p)) Proj f <*> Pure x = Proj (\p -> f p x) Proj f <*> Proj x = Proj (\p -> f (False:p) (x (True:p)))
(pure f) <*> Proj x === Pure f <*> Proj x === Proj (\p -> f (x p)) (Proj f) <*> (pure x) === Proj f <*> Pure x === Proj (\p -> f p x) Was this difference intended? Cheers! =) -- Felipe.