Ok, sorry for the spam, accidentaly hit the send button =/.

On Wed, Dec 14, 2011 at 11:03 PM, Felipe Almeida Lessa
<felipe.le...@gmail.com> wrote:
> On Wed, Dec 14, 2011 at 4:09 PM, James Cook <mo...@deepbondi.net> wrote:
>> So a case could be made that, just as "forever (Just 1)" being nonsensical
>> doesn't invalidate "instance Monad Maybe", "some (Just 1)" being nonsensical
>> doesn't invalidate "instance Alternative Maybe".  And on the other hand, a
>> case could be made that the importance of "some" and "many" justifies the
>> creation of a subclass of Alternative where they actually are mandated to be
>> meaningful rather than just definable.

Being in the same typeclass means that you can define

  instance Alternative Maybe where
    ...
    some Nothing = Nothing
    some (Just _) = error "Alternative.some: used with Just (loops forever)"
    many Nothing = Nothing
    many (Just _) = error "Alternative.many: used with Just (loops forever)"

Cheers,

-- 
Felipe.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to