[Haskell-cafe] Re: Converting IO [XmlTree] to [XmlTree]

Steffen Schuldenzucker Steve.Schuldenzucker at web.de
Tue Apr 28 05:44:22 EDT 2009


On 04:33 Tue 28 Apr     , Matthew Gruen wrote:
>    On the other hand, here's an un-pure-able and un-point-able functor:
> 
>    instance Functor ((,) m) where
>      --fmap :: (n -> n') -> (m, n) -> (m, n')
>        fmap f (m, n) = (m, f n)
>    n -> (m, n) is not a function you can write in general without bottom
>    values (unless you specify that m is a monoid, using mempty). Nor is
>    Pointed in the f () sense, since forall a. (a, ()) isn't something for
>    which a value can be pulled out of thin non-bottom air. But... getting a
>    bit off-topic >_>

Yeah, a good example! Especially, this [1] can't be implemented without
pointed:

point x = fmap (const x) shape

Where does shape come from? It's a "singleton element" of the functor,
right? So we'll need Pointed.

Especially: How (const x) is applied greatly depends on the functor and
on shape. Consider the list functor and

shape = repeat ()

against

shape = [()]

against

shape = []

Steffen

[1] http://thread.gmane.org/gmane.comp.lang.haskell.cafe/54685




More information about the Haskell-Cafe mailing list