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: type class question (Daniel Fischer) 2. Check out my photos on Facebook (Renick Bell) 3. Re: type class question (Ben) 4. Re: Re: Maybe, Either (Yusaku Hashimoto) 5. interface files (Luca Padovani) 6. Re: interface files (Daniel Fischer) 7. Re: interface files (Tim Sears) 8. Vaccum Cairo Errors (aditya siram) ---------------------------------------------------------------------- Message: 1 Date: Fri, 18 Sep 2009 17:28:06 +0200 From: Daniel Fischer <daniel.is.fisc...@web.de> Subject: Re: [Haskell-beginners] type class question To: beginners@haskell.org Cc: Ben <midfi...@gmail.com> Message-ID: <200909181728.07074.daniel.is.fisc...@web.de> Content-Type: text/plain; charset="iso-8859-1" Am Freitag 18 September 2009 16:38:19 schrieb Ben: > > instance Summarizer RunningAverageState (State RunningAverageState) where > > initialState = S 0 0 > > runOne = runningAverage > > but how would i use this, e.g. > > > --summarizeMany vs = last $ evalState (mapM runOne vs) initialState > > does not compile. No, summarizeMany would have the type (Summarizer m s) => [Double] -> Double which is ambiguous. You would have to make m somehow accessible (dummy argument?). > > 1) what am i doing wrong? what are the right type class and instance > declarations? > > 2) is there a better way of expressing this kind of "on-line" > calculation, perhaps in pure (non-monadic) functions? Perhaps scanl ? ------------------------------ Message: 2 Date: Fri, 18 Sep 2009 08:49:59 -0700 From: Renick Bell <invite+ium~5...@facebookmail.com> Subject: [Haskell-beginners] Check out my photos on Facebook To: "Beginners@haskell.org" <beginners@haskell.org> Message-ID: <2034a6f7f276b9d5acbb7f50b7f76...@localhost.localdomain> Content-Type: text/plain; charset="utf-8" Hi beginners@haskell.org, I set up a Facebook profile where I can post my pictures, videos and events and I want to add you as a friend so you can see it. First, you need to join Facebook! Once you join, you can also create your own profile. Thanks, Renick To sign up for Facebook, follow the link below: http://www.facebook.com/p.php?i=100000244637353&k=Z6E3Y5U6QX413GGJPJ53RTSVZP&r beginners@haskell.org was invited to join Facebook by Renick Bell. If you do not wish to receive this type of email from Facebook in the future, please click on the link below to unsubscribe. http://www.facebook.com/o.php?k=7d4325&u=1810302595&mid=11da955G6be70683G0G8 Facebook's offices are located at 1601 S. California Ave., Palo Alto, CA 94304. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.haskell.org/pipermail/beginners/attachments/20090918/a6b42d74/attachment-0001.html ------------------------------ Message: 3 Date: Fri, 18 Sep 2009 09:04:22 -0700 From: Ben <midfi...@gmail.com> Subject: Re: [Haskell-beginners] type class question To: Daniel Fischer <daniel.is.fisc...@web.de> Cc: beginners@haskell.org Message-ID: <9157df230909180904g7109c82v28e8eab6ad1f6...@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 On Fri, Sep 18, 2009 at 8:28 AM, Daniel Fischer <daniel.is.fisc...@web.de> wrote: > No, summarizeMany would have the type > > (Summarizer m s) => [Double] -> Double > > which is ambiguous. You would have to make m somehow accessible (dummy > argument?). yes, i realize the type is ambiguous, ghc even says so in the error message. but a dummy argument doesn't seem very elegant. >> 2) is there a better way of expressing this kind of "on-line" >> calculation, perhaps in pure (non-monadic) functions? > > Perhaps scanl ? i originally was using mapAccumL (i need the final result of the state) but it seemed like i was missing the point of the State monad. i guess that is a matter of opinion? b ------------------------------ Message: 4 Date: Sat, 19 Sep 2009 10:04:35 +0900 From: Yusaku Hashimoto <nonow...@gmail.com> Subject: Re: [Haskell-beginners] Re: Maybe, Either To: Heinrich Apfelmus <apfel...@quantentunnel.de> Cc: beginners@haskell.org Message-ID: <d17c24b90909181804s70a18ca3lf4ac07b8f48ad...@mail.gmail.com> Content-Type: text/plain; charset=UTF-8 On Fri, Sep 18, 2009 at 6:05 PM, Heinrich Apfelmus <apfel...@quantentunnel.de> wrote: > Yusaku Hashimoto wrote: >> - use Maybe as usual, we should use adapters as we need >> >> Conor, You have said this many times elsewhere, but unfortunately, I >> heard it for the first time =) so please correct me if I'm wrong. >> >> I thought generalizing lookup is good example for usage of the >> MonadPlus as I read in RWH[1], but you said it's not necessary. >> >> Now, I understood there are two positions for such classes. One is >> using generalizing for it, another is not. >> >> So, I want to know that when such classes should be used from later position. >> >> Heinrich suggested that is for overloading. > > To elaborate on generality versus overloading: the function > >   lookupM :: MonadPlus m => k -> Map k a -> m a > > is not more general than > >   lookup :: k -> Map k a -> Maybe a > > because you can implement the former with the latter > >   lookupM k = mop . lookup k > >   mop = maybe mzero return > > In other words,  lookupM  doesn't introduce new functionality. > > Rather, it gives you the syntactic convenience of not having to mention >  mop  by overloading the result type. In other words, you can write > >   lookup  = lookupM > > or > >   lookupE :: k -> Map k a -> Either e a >   lookupE = lookupM I got it. Thank you for explanation. >> But do any other usages are exist? > > I'm not quite sure I understand what you mean here? I had misread the Conor's post like the raison d'etre of type classes was denied, so I asked how type class should be used. Thanks again. Cheers -nwn ------------------------------ Message: 5 Date: Mon, 21 Sep 2009 15:12:45 +0200 From: Luca Padovani <luca.padov...@uniurb.it> Subject: [Haskell-beginners] interface files To: beginners@haskell.org Message-ID: <cd5d3a640909210612p1796e934g6549d0e08e446...@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 I'd like to be able to extract the "interface" of a Haskell module, where the interface should basically contain the list of values defined within the module along with their type, as well as the types defined in the module. It seems to me like the only way of doing this is with GHC and the option --show-iface, which dumps the .hi file into some readable format. However, the dumped interface seems to contain far more information than the one I'm looking for (like annotations to the data types explaining whether they are recursive, etc.), and am not sure whether the grammar of this format is documented anywhere (other than the actual source of GHC, I mean). Is there any other convenient utility to automatically extract this kind of "interfaces"? [*] Thanks in advance. Luca ------------------------------ Message: 6 Date: Mon, 21 Sep 2009 15:25:53 +0200 From: Daniel Fischer <daniel.is.fisc...@web.de> Subject: Re: [Haskell-beginners] interface files To: beginners@haskell.org Cc: Luca Padovani <luca.padov...@uniurb.it> Message-ID: <200909211525.54006.daniel.is.fisc...@web.de> Content-Type: text/plain; charset="iso-8859-1" Am Montag 21 September 2009 15:12:45 schrieb Luca Padovani: > I'd like to be able to extract the "interface" of a Haskell module, > where the interface should basically contain the list of values > defined within the module along with their type, as well as the types > defined in the module. > > It seems to me like the only way of doing this is with GHC and the > option --show-iface, which dumps the .hi file into some readable > format. However, the dumped interface seems to contain far more > information than the one I'm looking for (like annotations to the data > types explaining whether they are recursive, etc.), and am not sure > whether the grammar of this format is documented anywhere (other than > the actual source of GHC, I mean). > > Is there any other convenient utility to automatically extract this > kind of "interfaces"? [*] haddock ? > > Thanks in advance. > > Luca ------------------------------ Message: 7 Date: Mon, 21 Sep 2009 09:47:23 -0400 From: Tim Sears <t...@timsears.com> Subject: Re: [Haskell-beginners] interface files To: Luca Padovani <luca.padov...@uniurb.it> Cc: beginners@haskell.org Message-ID: <44c98e6c-a7b2-4c90-8f4a-9d951fc82...@timsears.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes I have been trying out leksah over the past few days and it displays the interface information for all the packages on my system. I have found if *very* helpful for reading code. Thanks leksah devs! The leksah IDE extracts this information from cabal files in order to display it to the developer. Depending on what you are doing, you could either use leksah, or examine the code to see how it extracts the information. -Tim On Sep 21, 2009, at 9:12 AM, Luca Padovani wrote: > I'd like to be able to extract the "interface" of a Haskell module, > where the interface should basically contain the list of values > defined within the module along with their type, as well as the types > defined in the module. > > It seems to me like the only way of doing this is with GHC and the > option --show-iface, which dumps the .hi file into some readable > format. However, the dumped interface seems to contain far more > information than the one I'm looking for (like annotations to the data > types explaining whether they are recursive, etc.), and am not sure > whether the grammar of this format is documented anywhere (other than > the actual source of GHC, I mean). > > Is there any other convenient utility to automatically extract this > kind of "interfaces"? [*] > > Thanks in advance. > > Luca > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://www.haskell.org/mailman/listinfo/beginners ------------------------------ Message: 8 Date: Mon, 21 Sep 2009 09:21:10 -0500 From: aditya siram <aditya.si...@gmail.com> Subject: [Haskell-beginners] Vaccum Cairo Errors To: beginners <beginners@haskell.org> Message-ID: <594f78210909210721u4ae0148k41deff7855a6...@mail.gmail.com> Content-Type: text/plain; charset="iso-8859-1" Hi all, I am trying out the awesome Vacuum Cairo package on GHC 6.10.3 but I am getting some interesting errors. The following works in GHCI: > view [1 .. 3] But the following does not work in GHCI: > let x = [1 .. 3] > view x or, > x <- return [1 .. 3] > view x For the last two I get: context: "(:)|0" -> >>> {"1|1", <<< "(:)|2"} ghc: ../../src/xcb_lock.c:77: _XGetXCBBuffer: Assertion `((int) ((xcb_req) - (dpy->request)) >= 0)' failed. Aborted and GHCI quits. Any ideas? thanks ... deech -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.haskell.org/pipermail/beginners/attachments/20090921/3437fbbc/attachment.html ------------------------------ _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners End of Beginners Digest, Vol 15, Issue 14 *****************************************