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: wrapping text in a multiline string (Rico Moorman) 2. Re: wxHaskell path (Heinrich Apfelmus) 3. Re: reactiva-banana : how to implement a certain type of throttling (Heinrich Apfelmus) 4. Re: wxHaskell path (Henry Lockyer) 5. Re: wxHaskell path (Henry Lockyer) 6. Re: wrapping text in a multiline string (Chadda? Fouch?) 7. Re: wxHaskell install errors (Gregory Guthrie) ---------------------------------------------------------------------- Message: 1 Date: Thu, 7 Jun 2012 14:44:11 +0200 From: Rico Moorman <rico.moor...@gmail.com> Subject: Re: [Haskell-beginners] wrapping text in a multiline string To: Chadda? Fouch? <chaddai.fou...@gmail.com> Cc: beginners@haskell.org Message-ID: <CAJrzcX1w0JQ4AO95J=urfkai6ko00hpnegjgu_lkdf_mkmw...@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 > What's non-obvious and trip a lot of people when they try to use > regexes in Haskell is that most regex libraries use the same > interface, which is specified in the regex-base and consists of > several typeclasses that offers a very high degree of flexibility. > =~and =~~ are only the simplified front-ends to this and are pretty > inadequate for advanced usages (for instance compile and use multiple > time the same regex, you should really avoid =~ in this case, or > additional regex compilation options). To see the basic interface, > look at Text.Regex.Base.RegexLike : > http://hackage.haskell.org/packages/archive/regex-base/latest/doc/html/Text-Regex-Base-RegexLike.html > . > In particular, what you want to do should be done with makeRegexOpts > and match (or matchM), note that the available compilation and > execution options can vary depending on the regex library you use and > for regex-pcre, they're documented there : > http://hackage.haskell.org/packages/archive/regex-pcre/latest/doc/html/Text-Regex-PCRE-Wrap.html#g:4 > > -- > Jeda? By the way, do you know other good resources on Regular expressions in Haskell and especially the multiple backends (tdfa, posix and pcre e.g.) in combination with the basic interface and how to use this all together? Some example code would be really useful. Furthermore the following page states that the Text.Regex.Base stuff is being exported again by the newer/other regex modules. http://hackage.haskell.org/packages/archive/regex-base/0.93.2/doc/html/Text-Regex-Base-Context.html Does this mean I should use the specific regex modules directly or should I import the base and then specific functionality from the engine modules? Thank you very much in advance, Best regards, Rico ------------------------------ Message: 2 Date: Thu, 07 Jun 2012 14:44:35 +0200 From: Heinrich Apfelmus <apfel...@quantentunnel.de> Subject: Re: [Haskell-beginners] wxHaskell path To: beginners@haskell.org Message-ID: <jqq7nj$2if$1...@dough.gmane.org> Content-Type: text/plain; charset=UTF-8; format=flowed Henry Lockyer wrote: > Anyone know if/how $wxwin also needs to be set on macosx > for wxHaskell 0.9 /wxWidgets 2.8 ? > and/or wxHAskell 0.13 / wxWidgets 2.9 ? I don't think it's needed. Installation instruction found on the internet are not always accurate. Best regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com ------------------------------ Message: 3 Date: Thu, 07 Jun 2012 15:52:07 +0200 From: Heinrich Apfelmus <apfel...@quantentunnel.de> Subject: Re: [Haskell-beginners] reactiva-banana : how to implement a certain type of throttling To: beginners@haskell.org Message-ID: <jqqbm7$5tv$1...@dough.gmane.org> Content-Type: text/plain; charset=UTF-8; format=flowed Miguel Negrao wrote: > A 04/06/2012, ?s 16:11, Heinrich Apfelmus escreveu: > >> Miguel, could you repost this question on Stackoverflow, so I can answer it >> there? > > I?ve reposted the question here: [..] Thanks! > Ok, looking at Wave.hs I can see what I need to do to be able to > delay an event by a certain amount of seconds. The scheduleQueue > function there doesn?t exactly do what I need it to do, because it > schedules relative to the last scheduled event. Essentially I would > need to alter it such that the scheduling is done in absolute terms, > so If I ask something to happen 5 seconds from now it should really > happen 5 seconds from now instead of 5 seconds from the last event in > queue. One way to do it would be to keep the scheduled times in UTC > or some other time format and every time an event comes into the > queue stop the timer, sort the event queue by the absolute times, > check how long is it till the next event and set the timer delay to > be that amount of time, then keep repeating the procedure. The wxTimers use relative time, so you would have to convert between the two, indeed. It's probably not straightforward, but likely an interesting exercise. > It would > indeed be nice to have something like this already available in > reactive-banana-wx, or in some timer type independent way in the > library itself. Henning Thielemann has written some time-related combinators in his reactive-balsa library http://hackage.haskell.org/package/reactive-balsa You can probably get some inspiration from there. > Two practical question: > > 1) How do I filter the slider events (from event0 mySlider command) to > get only one event instead of 3 every time I move the slider ? If they are simultaneous, then you can use collect . Otherwise, you will have to read the wxHaskell and wxWidgets documentation to figure out how to get rid of the superfluous events. > 2) What is the best way to set some wx property based on the current > value of some behavior but only when some event happens ? I?m doing > like this now: > > reactimate $ apply ((\x->(\y->set slider2 [selection := x])) > <$> slider1SelectionBehavior) slider1Event Looks good to me. You can use the <@ combinator to make it a little shorter. reactimate $ (\x -> set slider2 [ selection := x ]) <$> slider1SelectionBehavior <@ slider1Event Best regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com ------------------------------ Message: 4 Date: Thu, 7 Jun 2012 15:05:23 +0100 From: Henry Lockyer <henry.lock...@ntlworld.com> Subject: Re: [Haskell-beginners] wxHaskell path To: Heinrich Apfelmus <apfel...@quantentunnel.de> Cc: beginners@haskell.org Message-ID: <a95f99be-552d-4a40-97d9-5b4dea0c8...@ntlworld.com> Content-Type: text/plain; charset=us-ascii Thanks Heinrich. I conclude that, at the very least, normally I should not need to do anything with it 'manually'. On 7 Jun 2012, at 13:44, Heinrich Apfelmus wrote: > Henry Lockyer wrote: >> Anyone know if/how $wxwin also needs to be set on macosx for wxHaskell 0.9 >> /wxWidgets 2.8 ? and/or wxHAskell 0.13 / wxWidgets 2.9 ? > > I don't think it's needed. Installation instruction found on the internet are > not always accurate. > > > Best regards, > Heinrich Apfelmus > > -- > http://apfelmus.nfshost.com > > > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://www.haskell.org/mailman/listinfo/beginners ------------------------------ Message: 5 Date: Thu, 7 Jun 2012 15:32:14 +0100 From: Henry Lockyer <henry.lock...@ntlworld.com> Subject: Re: [Haskell-beginners] wxHaskell path To: beginners@haskell.org Message-ID: <33530838-1404-426d-be0c-8e07ef76f...@ntlworld.com> Content-Type: text/plain; charset="us-ascii" Just in case anyone else was puzzling about the $WXWIN instructions on the wxHAskell installation page for wxWidgets 2.8, I think the following information I just now found in my latest trip through the Hall of Mirrors indicates that it is a windows-specific item, not a general one as may be suggested by the structure of the wxHaskell page at http://www.haskell.org/haskellwiki/WxHaskell/2.8 and it *seems* to be a general instruction, not just for 2.8. The following is listed specifically under windows install at http://wiki.wxwidgets.org/Downloading_and_installing_wxWidgets Set the WXWIN environment variable If you used the installer, in addition to installing the wxWidgets source files, it also automatically adds a WXWIN environment variable on your system pointing to the location where you installed wxWidgets. If you didn't use the installer, it is highly recommended that you do so by hand. You will need to setup WXWIN to the full location where you installed wxWidgets to (e.g. C:\wx\wx288). To do so see Adding an Environment Variable under Windows. / Henry On 7 Jun 2012, at 15:05, Henry Lockyer wrote: > Thanks Heinrich. I conclude that, at the very least, normally I should not > need to do anything with it 'manually'. > > > On 7 Jun 2012, at 13:44, Heinrich Apfelmus wrote: > >> Henry Lockyer wrote: >>> Anyone know if/how $wxwin also needs to be set on macosx for wxHaskell 0.9 >>> /wxWidgets 2.8 ? and/or wxHAskell 0.13 / wxWidgets 2.9 ? >> >> I don't think it's needed. Installation instruction found on the internet >> are not always accurate. >> >> >> Best regards, >> Heinrich Apfelmus >> >> -- >> http://apfelmus.nfshost.com >> >> >> _______________________________________________ >> Beginners mailing list >> Beginners@haskell.org >> http://www.haskell.org/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20120607/5a3224df/attachment-0001.htm> ------------------------------ Message: 6 Date: Thu, 7 Jun 2012 17:34:23 +0200 From: Chadda? Fouch? <chaddai.fou...@gmail.com> Subject: Re: [Haskell-beginners] wrapping text in a multiline string To: Rico Moorman <rico.moor...@gmail.com> Cc: beginners@haskell.org Message-ID: <CANfjZRZDq5UrnobJRcouWu8rYfEK5Y_kyLYM4=zzbmdyvsf...@mail.gmail.com> Content-Type: text/plain; charset=UTF-8 On Wed, Jun 6, 2012 at 10:08 PM, Rico Moorman <rico.moor...@gmail.com> wrote: > If this is correct ... I am still a little lost though. I cannot come > up with a way of matching the actual String out of the MatchText > returned by matchOnceText ... > http://hackage.haskell.org/packages/archive/regex-base/latest/doc/html/Text-Regex-Base-RegexLike.html#v:matchOnceText > MatchText is an array, which allows for captures in the regex, for instance, if matching "hello Abel ! And goodbye." with "hello (\w+) ([.!?])", MatchText would be : array (0,2) [(0,("hello Abel !",(0,12))), (1,("Abel",(6,4))), (2,("!",(11,1)))] So if you want the whole matched text, you would use : > fst (match ! 0) Or you could just use matchM : > go text = case RE.matchM regex' text of > Just (before, match, after) -> > before ++ replace' match ++ go after > _ -> text and have match be a string, just like before (since you don't use all the power of MatchText anyway). -- Jeda? ------------------------------ Message: 7 Date: Thu, 7 Jun 2012 11:12:34 -0500 From: Gregory Guthrie <guth...@mum.edu> Subject: Re: [Haskell-beginners] wxHaskell install errors To: carlos gomez <carliro...@gmail.com> Cc: "beginners@haskell.org" <beginners@haskell.org> Message-ID: <08ef9da445c4b5439c4733e1f35705ba01a2767cb...@mail.cs.mum.edu> Content-Type: text/plain; charset="us-ascii" I did a re-make of the entire wxWidgets download source tree, and it (again) seemed to be successful, ending in: Creating library file: ..\..\lib\gcc_dll\libwxmsw29ud_gl.a Now trying to do a make in samples/minimal seems to work. ------------------------------------------- > -----Original Message----- > From: Gregory Guthrie > Sent: Wednesday, June 06, 2012 3:15 PM > To: 'carlos gomez' > Cc: beginners@haskell.org > Subject: RE: [Haskell-beginners] wxHaskell install errors > > >> First, you should make sure for yourself that wxWidgets 2.9 is well > >> installed, for that you can try to build the wxwidgets' examples > > >> cd c:\wx\samples\minimal > >> mingw32-make -f makefile.gcc BUILD=debug > > Thanks, good test, it fails. > > /e/plang/libraries/wxWidgets2.9/samples/minimal > > $ mingw32-make -f makefile.gcc BUILD=debug > if not exist gcc_mswuddll mkdir gcc_mswuddll > windres --use-temp-file -i../../samples/sample.rc > -ogcc_mswuddll\minimal_sample_rc.o > --define __WXMSW__ --define _UNICODE -- include-dir .\..\..\lib\gc > c_dll\mswud --include-dir ./../../include --include-dir . --define > WXUSINGDLL --include- > dir ./../../samples --define NOPCH > g++ -c -o gcc_mswuddll\minimal_minimal.o -g -O0 -mthreads > -DHAVE_W32API_H - > D__WXMSW__ -D_UNICODE -I.\..\..\lib\gcc_dll\mswud -I.\..\..\include > -W -Wall > -I. -DWXUSINGDLL -I.\..\..\samples -DNOPCH -Wno-ctor-dtor-privacy - > MTgcc_mswuddll\minimal_minimal.o -MFgcc_mswuddll\minimal_minimal.o.d -MD > -MP > minimal.cpp > > In file included from .\..\..\include/wx/defs.h:28:0, > from .\..\..\include/wx/wxprec.h:13, > from minimal.cpp:21: > .\..\..\include/wx/platform.h:181:22: fatal error: wx/setup.h: No such > file or directory > compilation terminated. > mingw32-make: *** [gcc_mswuddll\minimal_minimal.o] Error 1 > > (I did have to start a mingw shell to do this, it won't run from a cmd line.) > Not sure what to > make of it... > > I still wish I could just get a binary to install like was available from > wxPack for 2.8! :-) > > ---- > > Then, I can think that it is just a problem of configuring and installing > > wxhaskell. > > > > For the paths you have to set, probably the wxc is not installed on your pc > > yet, and probably > that's why you couldn't find. > > But you should follow the way setting those paths and put the right > > versions of the libraries > you are installing. > > Yes, probably wxc is not installed, but that is the problem I am stuck at I > think. ------------------------------ _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners End of Beginners Digest, Vol 48, Issue 15 *****************************************