Send Beginners mailing list submissions to
        beginners@haskell.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Re:  Finding documentation when Hackage is down. (aditya siram)
   2. Re:  Finding documentation when Hackage is down. (Daniel Fischer)
   3. Re:  Finding documentation when Hackage is down. (Brent Yorgey)
   4.  about model checking of haskell program (Liu Jian)
   5. Re:  I have created an ugly Haskell program.. (Michael Mossey)
   6.  order of monad transformers (Michael Mossey)
   7. Re:  order of monad transformers (Stephen Tetley)
   8. Re:  order of monad transformers (Stephen Tetley)
   9. Re:  order of monad transformers (Brent Yorgey)
  10. Re:  order of monad transformers (Michael Mossey)


----------------------------------------------------------------------

Message: 1
Date: Mon, 2 Nov 2009 14:48:08 -0500
From: aditya siram <aditya.si...@gmail.com>
Subject: Re: [Haskell-beginners] Finding documentation when Hackage is
        down.
To: Michael Lesniak <mlesn...@uni-kassel.de>
Cc: beginners <beginners@haskell.org>
Message-ID:
        <594f78210911021148x23a5506bm4577753f19616...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Yes, but it is my understanding that Hayoo connects to Hackage, so when
Hackage is down, so is Hayoo :)
-deech

On Mon, Nov 2, 2009 at 2:46 PM, Michael Lesniak <mlesn...@uni-kassel.de>wrote:

> Hello,
>
> I find http://holumbus.fh-wedel.de/hayoo/hayoo.html very helpful :-)
>
> - Michael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20091102/f77cce54/attachment-0001.html

------------------------------

Message: 2
Date: Mon, 2 Nov 2009 20:57:19 +0100
From: Daniel Fischer <daniel.is.fisc...@web.de>
Subject: Re: [Haskell-beginners] Finding documentation when Hackage is
        down.
To: beginners@haskell.org
Message-ID: <200911022057.20272.daniel.is.fisc...@web.de>
Content-Type: text/plain;  charset="iso-8859-15"

Am Montag 02 November 2009 20:34:05 schrieb aditya siram:
> Hi all,
> I use Hackage (through Hayoo sometimes) primarily for viewing API
> documentation. How can I  store API docs for cabal-installed packages
> locally so I am not slowed down when Hackage goes down?
>
> -deech

In your ~/.cabal/config file, uncomment the line

-- documentation: True

(or was it "-- documentation:" originally? In which case you'd have to write 
the "True" 
yourself.)

Then cabal install will build haddocks for each package it installs and put the 
docs in 
the standard place (~/.cabal/share/doc/ for user installs, I think; 
/usr/local/share/doc 
for global installs, IIRC).


------------------------------

Message: 3
Date: Mon, 2 Nov 2009 16:10:16 -0500
From: Brent Yorgey <byor...@seas.upenn.edu>
Subject: Re: [Haskell-beginners] Finding documentation when Hackage is
        down.
To: beginners@haskell.org
Message-ID: <20091102211016.ga27...@seas.upenn.edu>
Content-Type: text/plain; charset=us-ascii

I'm pretty sure this isn't true: Hayoo has its own index (which is
periodically rebuilt from Hackage, but it doesn't need to connect to
Hackage normally).  Of course, if Hayoo gives you links to
documentation on Hackage in its search results, THOSE won't work...

-Brent

On Mon, Nov 02, 2009 at 02:48:08PM -0500, aditya siram wrote:
> Yes, but it is my understanding that Hayoo connects to Hackage, so when
> Hackage is down, so is Hayoo :)
> -deech
> 
> On Mon, Nov 2, 2009 at 2:46 PM, Michael Lesniak <mlesn...@uni-kassel.de>wrote:
> 
> > Hello,
> >
> > I find http://holumbus.fh-wedel.de/hayoo/hayoo.html very helpful :-)
> >
> > - Michael
> >

> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://www.haskell.org/mailman/listinfo/beginners



------------------------------

Message: 4
Date: Tue, 3 Nov 2009 11:21:03 +0800
From: Liu Jian <gjk....@gmail.com>
Subject: [Haskell-beginners] about model checking of haskell program
To: beginners@haskell.org
Message-ID:
        <8c2dc7030911021921l243c4da2vf7d4044a56aa1...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Dear,

       Is there any work about "model checking haskell program"? in my
opinion,
think the haskell as a specification language, then we can check it or
transform it
to other specification language (such as, promela), so can be analyzed.

        cheers,

        Liu Jian
----
email to: gjk....@gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20091102/86280fb0/attachment-0001.html

------------------------------

Message: 5
Date: Tue, 03 Nov 2009 18:26:17 -0800
From: Michael Mossey <m...@alumni.caltech.edu>
Subject: Re: [Haskell-beginners] I have created an ugly Haskell
        program..
To: beginners <beginners@haskell.org>
Message-ID: <4af0e649.60...@alumni.caltech.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Thanks, Brent, for this way of looking at it. If you want n log n behavior 
you could write asFunc to use a Map for lookup.

-Mike

Brent Yorgey wrote:
> 
> Ask yourself: What Would Conal Do (WWCD)?  Conal Elliott is always
> trying to get people to think about the semantic essence of their
> problems, so let's try it.
> 
> What are we REALLY trying to do here?  What are those lists of tuples,
> REALLY?  Well, it seems to me that the lists of tuples are really just
> representing *functions* on some totally ordered domain.  The
> list-of-pairs representation takes advantage of the fact that these
> functions tend to be constant on whole intervals of the domain; we
> only need a tuple to mark the *beginning* of a constant interval.  The
> fact that we want to take a value from the last old timestamp when we
> don't have a certain timestamp in the list reflects the fact that the
> function takes on that value over the whole *interval* from the
> timestamp when it occurred to whenever the next timestamp is.
> 
> So, let's try converting these lists of pairs to actual functions:
> 
> 
>   asFunc :: (Ord a) => [(a,b)] -> (a -> Maybe b)
>   asFunc is a = fmap snd . listToMaybe . reverse . takeWhile ((<=a) . fst) $ 
> is
> 
> 
> Simple -- we just scan through the list looking for the right
> interval.
> 



------------------------------

Message: 6
Date: Tue, 03 Nov 2009 18:29:46 -0800
From: Michael Mossey <m...@alumni.caltech.edu>
Subject: [Haskell-beginners] order of monad transformers
To: beginners <beginners@haskell.org>
Message-ID: <4af0e71a.5090...@alumni.caltech.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

How does one consider the best ordering of monad transformers? For example, 
if I'm combining ErrorT, StateT (or State), and WriterT (or Writer)? But 
not just this specific example---what principles can one consult to 
determine ordering?

Thanks,
Mike




------------------------------

Message: 7
Date: Wed, 4 Nov 2009 09:49:02 +0000
From: Stephen Tetley <stephen.tet...@gmail.com>
Subject: Re: [Haskell-beginners] order of monad transformers
To: Michael Mossey <m...@alumni.caltech.edu>
Cc: beginners <beginners@haskell.org>
Message-ID:
        <5fdc56d70911040149j6d718b27v835e34acdbdd...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

> {-# LANGUAGE GeneralizedNewtypeDeriving #-}

Hello Mike



If the is a principal as such, I'd suggest that's working
out the return type that you want your run function to have.
Or more plainly - work out what you want the result to be.


Thats a bit gnomic of course, so here are two examples with
ErrorT (for failure) and WriterT (for logging), the ErrMsg type
is contrived slightly to be a distinct type.

This message should be literate Haskell if my mail
service likes me:


> module Transforming where

> import Control.Monad.Error
> import Control.Monad.Identity
> import Control.Monad.Writer

> type Log = String
> newtype ErrMsg = ErrMsg { getMsg :: String } deriving Show

> newtype EWI a = EWI {
>     getEWI :: ErrorT ErrMsg (WriterT Log Identity) a }
>   deriving (Functor, Monad, MonadWriter Log, MonadError ErrMsg)


The run functions are pretty /natural/ just the run functions
of the monad transformer stack in the reverse order.

Note the /outer tupling/ over the Either type in the run
function - runEWI always returns a log regardless of whether
the computation fails with an error...

[ without embellishments: (Either _ _,_) ]


> runEWI :: EWI a -> (Either ErrMsg a, Log)
> runEWI ma = runIdentity (runWriterT (runErrorT (getEWI ma)))



> newtype WEI a = WEI {
>     getWEI :: WriterT Log (ErrorT ErrMsg Identity) a }
>   deriving (Functor, Monad, MonadWriter Log, MonadError ErrMsg)


Note the Either type has an inner tuple in the run function -
runWEI returns a log /only/ when the computation succeeds otherwise
it fails with just an error...

[ without embellishments: Either _ (_,_) ]

> runWEI :: WEI a -> Either ErrMsg (a, Log)
> runWEI ma = runIdentity (runErrorT (runWriterT (getWEI ma)))


Support code

> instance Error ErrMsg where
>   noMsg = ErrMsg ""
>   strMsg = ErrMsg


------------------------------

Message: 8
Date: Wed, 4 Nov 2009 10:13:13 +0000
From: Stephen Tetley <stephen.tet...@gmail.com>
Subject: Re: [Haskell-beginners] order of monad transformers
To: Michael Mossey <m...@alumni.caltech.edu>
Cc: beginners <beginners@haskell.org>
Message-ID:
        <5fdc56d70911040213s6b598a9drff09d5ff7a338...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Apologies - the paragraph of the last message was riddled with typos,
it should read:

If there is a principal as such, I'd suggest that it's working
out the return type you want your run function to have.
Or more plainly - work out what you want the result to be.


>
> If the is a principal as such, I'd suggest that's working
> out the return type that you want your run function to have.
> Or more plainly - work out what you want the result to be.
>

Best wishes

Stephen


------------------------------

Message: 9
Date: Wed, 4 Nov 2009 07:42:02 -0500
From: Brent Yorgey <byor...@seas.upenn.edu>
Subject: Re: [Haskell-beginners] order of monad transformers
To: beginners@haskell.org
Message-ID: <20091104124202.ga29...@seas.upenn.edu>
Content-Type: text/plain; charset=us-ascii

On Tue, Nov 03, 2009 at 06:29:46PM -0800, Michael Mossey wrote:
> How does one consider the best ordering of monad transformers? For example, 
> if I'm combining ErrorT, StateT (or State), and WriterT (or Writer)? But 
> not just this specific example---what principles can one consult to 
> determine ordering?

As Stephen has illustrated, the principle is that the effects of
_inner_ transformers can "override" the effects of _outer_
transformers.  (This has often seemed unintuitive and "backwards" to
me, but that's the way it is.)  For example, consider StateT s (FooT
...): if FooT has a failure mode, when a computation fails you don't
even get a state anymore.  Or if FooT has some sort of backtracking
effect, the state will get rewound along with the rest of the
computation.  On the other hand, FooT (StateT s ....) will still
compute a state even when the FooT fails, and the state will be
preserved even when the computation backtracks.

-Brent


------------------------------

Message: 10
Date: Wed, 04 Nov 2009 04:50:15 -0800
From: Michael Mossey <m...@alumni.caltech.edu>
Subject: Re: [Haskell-beginners] order of monad transformers
To: beginners <beginners@haskell.org>
Message-ID: <4af17887.7030...@alumni.caltech.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Thanks Stephen and Brent! I will try working out the examples you gave.

I don't immediate comprehend Brent's explanation, but I think I will need 
to actually code and run some examples and then I'll probably get it.

Thanks,
Mike


------------------------------

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 17, Issue 4
****************************************

Reply via email to