Ben, > Now, on to Bind: the standard finite structure example for Bind is most probably the substitution thingy ...
Danger of conflating a bunch of things here: (1) the substitution monadic effect is always also applicative and always also unital/pointed because monads are always applicative and pointed. (2) the zippy applicative effect is NOT monadic (see main applicative paper) (3) for finite structures, there's even a pre-applicative-but-still-zippy-ish Apply effect that's apparently NOT unital/pointed. I don't know of any results that crystallize this intuition about finite/infinite cleanly distributing itself into Applicative and Apply bins. (4) all the above has thus far been functors! Gershom has explained a use case where Apply isn't even one. HTH, -- Kim-Ee On Sat, Dec 1, 2012 at 5:00 AM, Ben Franksen <ben.frank...@online.de> wrote: > Gershom Bazerman wrote: > > On 11/30/12 10:44 AM, Dan Doel wrote: > >> > >> Lists! The finite kind. > >> > >> This could mean Seq for instance. > >> > >> On Nov 30, 2012 9:53 AM, "Brent Yorgey" <byor...@seas.upenn.edu > >> <mailto:byor...@seas.upenn.edu>> wrote: > >> > >> > >> Any data type which admits structures of arbitrary but *only finite* > >> size has a natural "zippy" Apply instance but no Applicative (since > >> pure would have to be an infinite structure). The Map instance I > >> mentioned above falls in this category. Though I guess I'm having > >> trouble coming up with other examples, but I'm sure some exist. > Maybe > >> Edward knows of other examples. > >> > > > > Another common case would be an embedded DSL representing code in a > > different language, targeting a different platform (or even an FPGA or > > the like), etc. You can apply `OtherLang (a -> b)` to an `OtherLang a` > > and get an `OtherLang b`, but you clearly can't promote (or "lower," I > > guess) an arbitrary Haskell function into a function in your target > > language. This is the same reason that GArrows remove the `arr` function > > (http://www.cs.berkeley.edu/~megacz/garrows/). > > A fine example! And I am getting the drift... yes, this could be a useful > abstraction. > > Now, on to Bind: the standard finite structure example for Bind is most > probably the substitution thingy, i.e. if m :: m a, f :: a -> m b, then m > >>= f means replace all elements x :: a in m with f x and then flatten the > result so it's an m b again. Like concatMap for lists, right? So, there is > no return for that in the Map case for exactly the same reason as with > Apply: the unit would have have value id for every possible key, so cannot > be finite. > > So what about an example for Bind\\Monad that is not yet another variation > of the finite structure theme? > > Cheers > -- > Ben Franksen > () ascii ribbon campaign - against html e-mail > /\ www.asciiribbon.org - against proprietary attachments > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe >
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe