Re: [Haskell-cafe] Functors [Comments from OCaml Hacker Brian Hurt]

2009-01-18 Thread Andrew Coppin
Jonathan Cast wrote: On Sat, 2009-01-17 at 12:04 +, Andrew Coppin wrote: instance (Monad m) = Functor m where fmap f ma = do a - ma; return (f a) While that's quite interesting from a mathematical point of view, how is this useful for programming purposes? Good

Re: [Haskell-cafe] Functors [Comments from OCaml Hacker Brian Hurt]

2009-01-18 Thread Ryan Ingram
On Sun, Jan 18, 2009 at 3:23 AM, Andrew Coppin andrewcop...@btinternet.com wrote: Given that liftM exists, why is having an identical implementation for fmap useful? For many structures, it's easier to define (=) in terms of fmap and join. For these objects, often the generic implementation of

Re: [Haskell-cafe] Functors [Comments from OCaml Hacker Brian Hurt]

2009-01-18 Thread David Leimbach
On Sun, Jan 18, 2009 at 3:23 AM, Andrew Coppin andrewcop...@btinternet.comwrote: Jonathan Cast wrote: On Sat, 2009-01-17 at 12:04 +, Andrew Coppin wrote: instance (Monad m) = Functor m where fmap f ma = do a - ma; return (f a) While that's quite interesting from a mathematical

Re: [Haskell-cafe] Functors [Comments from OCaml Hacker Brian Hurt]

2009-01-18 Thread Jonathan Cast
On Sun, 2009-01-18 at 11:23 +, Andrew Coppin wrote: Jonathan Cast wrote: On Sat, 2009-01-17 at 12:04 +, Andrew Coppin wrote: instance (Monad m) = Functor m where fmap f ma = do a - ma; return (f a) While that's quite interesting from a mathematical point of

[Haskell-cafe] Functors [Comments from OCaml Hacker Brian Hurt]

2009-01-17 Thread Andrew Coppin
Eugene Kirpichov wrote: No, a functor is a more wide notion than that, it has nothing to do with collections. An explanation more close to truth would be A structure is a functor if it provides a way to convert a structure over X to a structure over Y, given a function X - Y, while preserving

Re: [Haskell-cafe] Functors [Comments from OCaml Hacker Brian Hurt]

2009-01-17 Thread Eugene Kirpichov
2009/1/17 Andrew Coppin andrewcop...@btinternet.com: Eugene Kirpichov wrote: No, a functor is a more wide notion than that, it has nothing to do with collections. An explanation more close to truth would be A structure is a functor if it provides a way to convert a structure over X to a

Re: [Haskell-cafe] Functors [Comments from OCaml Hacker Brian Hurt]

2009-01-17 Thread Luke Palmer
On Sat, Jan 17, 2009 at 5:04 AM, Andrew Coppin andrewcop...@btinternet.comwrote: Eugene Kirpichov wrote: No, a functor is a more wide notion than that, it has nothing to do with collections. An explanation more close to truth would be A structure is a functor if it provides a way to convert

Re[2]: [Haskell-cafe] Functors [Comments from OCaml Hacker Brian Hurt]

2009-01-17 Thread Bulat Ziganshin
Hello Luke, Saturday, January 17, 2009, 3:16:06 PM, you wrote:   fmap id = id   fmap (f . g) = fmap f . fmap g  The first property is how we write preserving underlying structure, but this has a precise, well-defined meaning that we can say a given functor obeys or it does not (and if it

Re: [Haskell-cafe] Functors [Comments from OCaml Hacker Brian Hurt]

2009-01-17 Thread Dan Doel
On Saturday 17 January 2009 8:28:05 am Bulat Ziganshin wrote: Hello Luke, Saturday, January 17, 2009, 3:16:06 PM, you wrote:   fmap id = id   fmap (f . g) = fmap f . fmap g  The first property is how we write preserving underlying structure, but this has a precise, well-defined

Re: [Haskell-cafe] Functors [Comments from OCaml Hacker Brian Hurt]

2009-01-17 Thread Jonathan Cast
On Sat, 2009-01-17 at 12:04 +, Andrew Coppin wrote: Eugene Kirpichov wrote: No, a functor is a more wide notion than that, it has nothing to do with collections. An explanation more close to truth would be A structure is a functor if it provides a way to convert a structure over X to