hi,

i personally think that one should use fmap instead.  it tells
you exactly how much structure you need.  having said that it is
sometimes annoying to get the extra Functor constraint (alas
Functor is not a super class of Moand)...  so my preference is:
1. fmap
2. liftM
3. bind with return

bye
iavor

On Mon, Sep 23, 2002 at 02:57:45PM -0700, Hal Daume III wrote:
> I know this has been written about way too much, but I was wondering what
> people thought about using 'liftM f' as opposed to '>>= return . f'.  I
> would probably have written Andrew's code using liftM, but I don't know if
> one is necessarily better than the other.  Does anyone have strong
> thoughts on this?
> 
> --
> Hal Daume III
> 
>  "Computer science is no more about computers    | [EMAIL PROTECTED]
>   than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume
> 
> On Sun, 22 Sep 2002, Andrew J Bromage wrote:
> 
> > G'day all.
> > 
> > On Sat, Sep 21, 2002 at 12:56:13PM -0700, Russell O'Connor wrote:
> > 
> > > case (number g) of
> > >  Just n -> Just (show n)
> > >  Nothing ->
> > >   case (fraction g) of
> > >    Just n -> Just (show n)
> > >    Nothing ->
> > >     case (nimber g) of
> > >      Just n -> Just ("*"++(show n))
> > >      Nothing -> Nothing
> > 
> > This isn't exactly the most beautiful way of doing it, but...
> > 
> >     (number g   >>= return . show) `mplus`
> >     (fraction g >>= return . show) `mplus`
> >     (nimber g   >>= return . ('*':) . show)
> > 
> > Cheers,
> > Andrew Bromage
> > _______________________________________________
> > Haskell-Cafe mailing list
> > [EMAIL PROTECTED]
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
> > 
> 
> _______________________________________________
> Haskell-Cafe mailing list
> [EMAIL PROTECTED]
> http://www.haskell.org/mailman/listinfo/haskell-cafe

-- 
---------------------------------------+----------------------------------------
Iavor S. Diatchki                      | email: [EMAIL PROTECTED]           
Dept. of Computer Science              | web: http://www.cse.ogi.edu/~diatchki
OGI School of Science and Engineering  | work phone: 5037481631                
OHSU                                   | home phone: 5036434085                
---------------------------------------+----------------------------------------
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to