Hmmmm...

On Fri, Sep 10, 2010 at 6:47 PM, Jan Christiansen
<j...@informatik.uni-kiel.de> wrote:
>  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.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to