[Haskell-cafe] Views

Stephan Friedrichs deduktionstheorem at web.de
Sun Sep 14 07:42:44 EDT 2008

Johannes Waldmann wrote:
>> a) ... to use Maybe
>> b) ... to provide my own Data.Heap.View type
> leave the choice up to the programmer,
> and provide a generic interface,
> accepting any MonadZero (*) instance.
> cf. Data.Set.maxView

AFAIK there has been a vivid discussion about that. I think the crux of
the matter was that a monad is too general. Either there is a result or
there is not. That's precisely the intended use of a Maybe.

Besides, I just learned that Data.Map.{lookup,minView,maxView} and the
like have been modified to return a Maybe in the current GHC head
branch, see [1]. This suggests using Maybe in my case as well.

> [...]



Früher hieß es ja: Ich denke, also bin ich.
Heute weiß man: Es geht auch so.

 - Dieter Nuhr

More information about the Haskell-Cafe mailing list