On 7/16/07, Claus Reinke <[EMAIL PROTECTED]> wrote:
enjoy (i hope:-),

Very much. Work hasn't been so much fun since.... Well, for a long time. :-)

One small question, which might reveal if I've understood things aright.

        (do (v,e) <- dmin' l
            (do guard e
                me <- empty m
                re <- nullT r
                write m p (v,me && re))
             `mplus` return ((v,e)))
         `mplus` (do v <- readTVar' m
                     re <- nullT r
                     write m p (v,re))
         `mplus` (do (v,e) <- dmin' r
                     when e $ writeTVar' p Empty
                     return ((v,e)))
         `mplus` error "emit nasal daemons"

If I refactor this a little into dminLeft dminMiddle and dminRight, I
believe I should be able to replace this with:

   ...
   msum [dminLeft l m r, dminMiddle m r, dminRight r, error "emit
nasal daemons"]
   where
   dminLeft l m r = do
      (v,e) <- dmin' l
      (do guard e
          me <- empty m
          re <- nullT r
          write m p (v,me && re)) `mplus` return (v,e)
   dminMiddle m r = do
       v <- readTVar' m
       re <- nullT r
       write m p (v,re)
   dminRight r = do
       (v,e) <- dmin' r
       when e $ writeTVar' p Empty
       return (v,e)
   ....

Is this correct? And if so, is GHC likely to do constant folding on
msum over the list skeleton?

T.
--
Dr Thomas Conway
[EMAIL PROTECTED]

Silence is the perfectest herald of joy:
I were but little happy, if I could say how much.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to