On Sat, Sep 13, 2008 at 11:19 AM, Stephan Friedrichs <[EMAIL PROTECTED]> wrote: > data View > = Empty > | Cons a (SomeDataStructure a) > > A good example for this is Data.Sequence. My question is: Why is this > not expressed in terms of Maybe? > > view :: SomeDataStructure a -> Maybe (a, SomeDataStructure a)
I think the usual reason this is done is because it is clearer to read. Since Maybe is so generally useful, when you read code that uses it, you have to figure out what use it is being put towards. "What does Nothing mean? What does Just (a,b) mean?" are the kinds of questions that go through your head, and they distract you from the problem at hand. On the other hand, reading code that uses the View type, it is immediately clear what Empty and Cons mean. But you're right, Maybe has a lot of useful helper functions and instances. -- ryan _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe