Give them a program that selects a bunch of files based on some
filtering criteria, and then does something to each file.
Kind of like find + xargs, but using haskell instead. Good recipe for sysadmins.
There was a recent example involving parsing raw emails into a thread here
and contrast this with doing the same transformation in perl.
Perl should be messier.
Hope this helps...
2007/4/16, Dougal Stanton [EMAIL PROTECTED]:
On 16/04/07, Thomas Hartman [EMAIL PROTECTED] wrote:
Maybe that could be simplified and something could be based on that.
A one-liner using
With regards to the variable interpolation in strings problem, it's
probably worth watching
http://groups.google.de/group/fa.haskell/browse_thread/thread/34741c2a5c311a17/286dbd62748ef1c1?lnk=stq=%22haskell+cafe%22+%22template+system%22rnum=1hl=en#286dbd62748ef1c1
which mentions some
I put this on the haskell wiki at
http://haskell.org/haskellwiki/Poor_Man%27s_Heredoc_in_Haskell
So far I have only linked this from
http://haskell.org/haskellwiki/Simple_unix_tools
I feel like the wiki deserves a section on Haskell Template
Solutions distinct from this. However, there is a
Claus and Evan ++; that was very helpful.
FWIW, my gut feeling is that Claus's first version was easier to
understand than the revision with printf, which seems to me to involve
a lot more monadic wizardry (Functor, MonadError, fmap, mapm). The
first version, which just used maybe, was clear to
You may be missing a few recursive calls there :-)
Indeed.
I'm confused.
Is this a legitimate stable quicksort, or not? (My guess is, it is
indeed legit as written.)
This was also the first I have heard of stability as a sort property.
http://perldoc.perl.org/sort.html may shed some light
And for reference, here is again stefan's stable quicksort from his
earlier post.
sort [] = []
sort l@(x:_) = filter (x) l ++ filter (==x) l ++ filter (x) l
(A stable quicksort, btw)
This is the code whose legitimacy I am requesting confirmation of.
2007/4/13, Thomas Hartman [EMAIL
foldtree1 f xs = foldtree1 f $ pairs xs
where
pairs []= []
pairs [x] = [x]
pairs (x:x':xs) = f x x' : pairs xs
merge [] ys = ys
merge xs [] = xs
merge (x:xs) (y:ys) =
if x = y then x:merge xs (y:ys) else y:merge (x:xs) ys
2007/4/13, Thomas Hartman
Rereading this, I see in fact apfelmus explains this is
O(n + k*log n) for the first k elements, which this discussion also
maintains is the best case. So, there's no discrepancy.
I think this is a very valuable post to read for the explanation.
2007/4/13, Thomas Hartman [EMAIL PROTECTED
++
plot [\ ++ startDate ++ \:\ ++
endDate ++ \]
++ ' ++ companyfile ++ '
++ modestring
++ title \ ++ company ++ ++
titleEnd ++ \
2007/4/12, Thomas Hartman [EMAIL PROTECTED
=
case maybeTransformedArg of
Nothing - error $ no transformed ++ argname ++ arg for ++ arg
_ - return ()
Summary: I like being able to check the validity of user input on an
arg-by-arg basis, and now I guess I can.
2007/4/13, Thomas Hartman [EMAIL PROTECTED]:
Answering my own
I was translating some perl code to haskell as a learning exercise and
wound up with the following. (below) Simple code that accepts some
string arguments, and prints a string -- so, of type String - String
- String - String - IO ().
I like to be concise, but I get the feeling something went
I am also coming at haskell from a perl background.
While there is some truth to what you say, I do think haskell can be
used for keeping simple things simple in a way similar to perl.
Though you have to search harder since the documentation / tutorials
seem to be more optimized for making hard
New wiki page: Checking for correct invocation of a command line haskell program
at
http://haskell.org/haskellwiki/Checking_for_correct_invocation_of_a_command_line_haskell_program
This is a simple cookbook / boilerplate example I thought should go in
a haskell wiki somewhere.
I linked it
there was a minor mistake in the above, fixed on the wiki page.
2007/4/10, Thomas Hartman [EMAIL PROTECTED]:
New wiki page: Checking for correct invocation of a command line haskell program
at
http://haskell.org/haskellwiki/Checking_for_correct_invocation_of_a_command_line_haskell_program
if anything goes
wrong in the above.
[EMAIL PROTECTED]:~/shellenv/installs/haskell-installs
2007/4/6, Thomas Hartman [EMAIL PROTECTED]:
... I will
refine it so it completes without errors, time allowing.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
of
haskell stuff installed from packages, which is convenient, but I will
refine it so it completes without errors, time allowing.
2007/4/5, Thomas Hartman [EMAIL PROTECTED]:
and in more detail in
my other post linked above.
I meant, linked below.
2007/4/5, Thomas Hartman [EMAIL PROTECTED
In the spirit of...
I hate package chasing, cabal doesn't do this automatically (yet),
and hard disk space is cheap...
Here is a script to just hit the deb/ubuntu repos and install as
much haskell-loooking stuff as possible.
If you're going to do this, I would recommend pulling at least
This approach is fleshed out at
http://groups.google.de/group/fa.haskell/browse_thread/thread/ceabae2c3fdc8abc/814a86d89c3f7d28?lnk=stq=tphyahoo+haskell+ubunturnum=1hl=en#814a86d89c3f7d28
2007/3/16, Chad Scherrer [EMAIL PROTECTED]:
Brian,
I had this exact problem, and I found this approach to
and in more detail in
my other post linked above.
I meant, linked below.
2007/4/5, Thomas Hartman [EMAIL PROTECTED]:
In the spirit of...
I hate package chasing, cabal doesn't do this automatically (yet),
and hard disk space is cheap...
Here is a script to just hit the deb/ubuntu repos
Setup.lhs: Warning: The field hs-source-dir is deprecated, please
use hs-source-dirs.
Installing: /usr/local/lib/HSH-1.2.1/ghc-6.6 /usr/local/bin HSH-1.2.1...
Setup.lhs: Error: Could not find module: HSH with any suffix: [hi]
So, I seem to be stuck at this point.
2007/4/2, Thomas Hartman [EMAIL
/browse_thread/thread/ca37248eae7a065f/d039de2f9bf6e848?lnk=stq=hsh+tphyahoornum=1hl=en#d039de2f9bf6e848
Sorry about the bad title.
Still hoping to get hsh working, though for me this has more morphed
into learning about package and dependency chasing in a haskell/deb
context.
2007/4/3, Thomas Hartman
' at interactive:1:0-2
Probable fix: add a type signature that fixes these type variable(s)
Prelude HSH
So, that's where I'm at now.
2007/4/3, Thomas Hartman [EMAIL PROTECTED]:
That was a pretty badly titled top thead, which I regret -- probably
should have been something like figuring out how to track
:)
2007/4/3, Thomas Hartman [EMAIL PROTECTED]:
actually, maybe I'm more okay than I thought.
I originally did this without reading the INSTALL file, and built
using the process I have gotten used to: runghc Setup.hs configure;
runghc Setup.hs build; runghc Setup.hs install.
But when I followed
resolved issue at
http://groups.google.de/group/fa.haskell/browse_thread/thread/ceabae2c3fdc8abc/5ab21d4ae2a9b1fc?lnk=stq=hsh++tphyahoornum=5hl=en#5ab21d4ae2a9b1fc
2007/4/2, Thomas Hartman [EMAIL PROTECTED]:
Well, I guess I spoke to soon. After building ghc6 from feisty as
described above, I
the case...
fakeroot apt-get source --build ghc6
works :)
2007/3/21, Max Vasin [EMAIL PROTECTED]:
Thomas == Thomas Hartman [EMAIL PROTECTED] writes:
Thomas Furthermore (as the above messages suggest and locate confirms), I
Thomas seem to have mtl already
Thomas I took a wild guess and tried
dependencies. Try 'apt-get -f install' with no packages (or
specify a solution).
2007/4/2, Thomas Hartman [EMAIL PROTECTED]:
As you have built ghc6.6 from sources I think that you also need to build
all haskell libs from sources. So, do
I did this, and got the feeling this would probably work
When attempting to build hsh, I get complaint that it can't satisfy
dependency for mtl-any.
How can I get this?
Thanks!
**
wget
http://software.complete.org/hsh/static/download_area/1.2.0/hsh_1.2.0.tar.gz
[EMAIL PROTECTED]:~/haskellInstalls/hsh$ sudo runghc Setup.lhs configure
and I'm on...
[EMAIL PROTECTED]:~/haskellInstalls$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.6
2007/3/21, Thomas Hartman [EMAIL PROTECTED]:
When attempting to build hsh, I get complaint that it can't satisfy
dependency for mtl-any.
How can I get this?
Thanks
dependencies. Try 'apt-get -f install' with no packages (or
specify a solution).
[EMAIL PROTECTED]:~/haskellInstalls$
2007/3/21, Thomas Hartman [EMAIL PROTECTED]:
and I'm on...
[EMAIL PROTECTED]:~/haskellInstalls$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.6
2007/3/21
/doc/libghc6-mtl-dev/copyright
/var/lib/dpkg/info/libghc6-mtl-dev.list
/var/lib/dpkg/info/libghc6-mtl-dev.md5sums
/var/lib/dpkg/info/libghc6-mtl-dev.postinst
/var/lib/dpkg/info/libghc6-mtl-dev.prerm
2007/3/21, Thomas Hartman [EMAIL PROTECTED]:
Some progress, but still not solved.
I built ghc6.6
) s )
. Data.List.sort -- maybe not necessary?
. map ( read :: String - Integer )
. Data.Set.toAscList . Data.Set.fromList -- more efficient than prelude nub
. filter ( all Data.Char.isDigit ) . lines'
2007/3/7, Chris Kuklewicz [EMAIL PROTECTED]:
Thomas Hartman wrote:
Just noticed a comment
To answer my own post, the Data.List.sort *is* necessary.
Otherwise, you get alphabetic sort.
2007/3/20, Thomas Hartman [EMAIL PROTECTED]:
Just thought I'd add another potentially helpful bit to this oneliner
/ shell scripting thread. Though to be fair, this perhaps strains the
definition
, but alphanumerically, whereas we want numerically
. Data.Set.toAscList . Data.Set.fromList
. filter ( all Data.Char.isDigit )
. lines
'
2007/3/20, Thomas Hartman [EMAIL PROTECTED]:
To answer my own post, the Data.List.sort *is* necessary.
Otherwise, you get alphabetic sort
You contributed
#12:14 Thunder @pl \s - drop (length s - n) s
#12:14 lambdabot drop = subtract n . length
But, on second thought, 1) I can't use this as a drop-in replacement
for the non points free (right term?) version, and 2) I don't really
understand it.
Still, I would be curious to see
recommend them :)
2007/2/28, Paul Brown [EMAIL PROTECTED]:
On 2/27/07, Seth Gordon [EMAIL PROTECTED] wrote:
Thomas Hartman wrote:
Thanks. I incorporated these changes, and it cranks longer now before
failing. But still fails, now with a seg fault.
According to conventional wisdom, when gcc segfaults
I have a bash script that opens a browser for a few seconds, and then closes it.
Could someone point me up the equivelant(s) in haskell, h4sh, hsh,
etc,0 and friends?
I reckon this amounts to, what's the process for translating forking
from bash to haskell.
#!/bin/bash
konqueror
I'm having trouble building regex-pcre from
http://darcs.haskell.org/packages/regex-unstable/regex-pcre/
[EMAIL PROTECTED]:~/haskellInstalls/regex-pcre$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.6
First (after darcs pulling) it complained
[EMAIL
) . lines' Imports.hs
[EMAIL PROTECTED]:~/learning/haskell/UnixTools$ cat Imports.hs
import Text.Regex.Posix
2007/3/2, Thomas Hartman [EMAIL PROTECTED]:
Okay, I am aware of
http://haskell.org/haskellwiki/Simple_unix_tools
which gives some implementation of simple unix
, 2007, at 7:02 , Thomas Hartman wrote:
I'm having trouble building regex-pcre from
http://darcs.haskell.org/packages/regex-unstable/regex-pcre/
[EMAIL PROTECTED]:~/haskellInstalls/regex-pcre$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.6
First (after darcs
PROTECTED]:~/learning/haskell/UnixTools$ cat ImportsRegexPCRE.hs
import Text.Regex.PCRE
[EMAIL PROTECTED]:~/learning/haskell/UnixTools$
2007/3/7, Thomas Hartman [EMAIL PROTECTED]:
In the spirit of making easy things easy, here is a haskell from
shell one-line grepper, that uses regexen.
Now, if only
Okay, so much for PCRE match.
Can someone show me give me pointers on PCRE replace?
Ideal would be something with all the =~ s/// semantics from perl.
(Not sure if this is included in Text.Regex.PCRE. is it?)
In other words, how to do this with (preferrably) Text.Regex.PCRE ?
Of course in
, Thomas Hartman [EMAIL PROTECTED]:
Okay, so much for PCRE match.
Can someone show me give me pointers on PCRE replace?
Ideal would be something with all the =~ s/// semantics from perl.
(Not sure if this is included in Text.Regex.PCRE. is it?)
In other words, how to do this with (preferrably
, Thomas Hartman wrote:
Setup.lhs: cannot satisfy dependency haskell-src-any
Used to be bundled, now unbundled. On debian/ubuntu check your
libghc6-*-dev packages. (libghc6-haskell-src-dev?)
--
brandon s. allbery[linux,solaris,freebsd,perl] [EMAIL PROTECTED]
system administrator [openafs
quoth brandon allberry in a private message (answering my unintended
private message)
On Mar 7, 2007, at 1:51 , Thomas Hartman wrote:
Can't seem to find these packages. Do I need to add another repo? Or
build from source?
You may have to backport; I found it in feisty (universe) in a quick
-e '$sum += $_
while ; print $sum\n'
2007/3/2, Thomas Hartman [EMAIL PROTECTED]:
Okay, I am aware of
http://haskell.org/haskellwiki/Simple_unix_tools
which gives some implementation of simple unix utilities in haskell.
But I couldn't figure out how to use them directly from the shell
- Integer ) . lines'
echo **
echo perl, two pipes
time filesizes | perl -ane 'print $F[0]\n' | perl -e '$sum += $_
while ; print $sum\n'
2007/3/2, Thomas Hartman [EMAIL PROTECTED]:
Okay, I am aware of
http://haskell.org/haskellwiki/Simple_unix_tools
which gives some implementation
$F[0]\n' | perl -e '$sum += $_
while ; print $sum\n'
2007/3/2, Thomas Hartman [EMAIL PROTECTED]:
Okay, I am aware of
http://haskell.org/haskellwiki/Simple_unix_tools
which gives some implementation of simple unix utilities in haskell.
But I couldn't figure out how to use
Okay, I am aware of
http://haskell.org/haskellwiki/Simple_unix_tools
which gives some implementation of simple unix utilities in haskell.
But I couldn't figure out how to use them directly from the shell, and
of course that's what most readers will probably wnat.
Or let me put it another way.
I think you want
Text.Regex. splitRegex
or something very much like it.
http://haskell.org/hoogle/?q=String-%3E%5BString%5D
2007/3/1, h. [EMAIL PROTECTED]:
Hello,
I wrote the following split function for Strings:
splitS :: String - String - [String]
splitS a b = splitA a b
where
]:~/haskellInstalls$
2007/2/27, Thomas Hartman [EMAIL PROTECTED]:
I incorporated these changes to my install script, and now it cranks
longer before failing, but still fails. Now with a seg fault.
For some odd reason the final crash snipped below didn't get written
to out.txt, otherwise I would have
strategy? Or is using quickcheck here overkill?
2007/2/26, Antonio Cangiano [EMAIL PROTECTED]:
On 2/26/07, Thomas Hartman [EMAIL PROTECTED] wrote:
Here's my, probably very obvious, contribution.
What I'd like feedback on is
1) code seem ok? (hope so!)
Hi Thomas,
tail [] raises an error, therefore
According to
http://www.cs.chalmers.se/~rjmh/QuickCheck/
Quickcheck is distributed with ghc.
I seem to recall this came with ghc 6.4. After upgrading to ghc 6.6,
however, I don't seem to have it anymore.
Do I need to install it from cabal? If so, I assume this would start
by wgetting
Here's my, probably very obvious, contribution.
What I'd like feedback on is
1) code seem ok? (hope so!)
2) What do you think of the tests I did to verify that this
behaves the way I want? Is there a better / more idiomatic way to do
this?
**
[EMAIL
This seemed like a handy thing to have an example of, so I added it to
my growing repo of sample haskell programs and tried running it. But I
was unsuccessful.
Can anyone see what I'm doing wrong?
In case it matters, I'm on a virtualized user-mode-linux shell.
I finally got around to trying this, but still no luck. now getting
missing cmm.h error.
[EMAIL PROTECTED]:~/haskellInstalls/ghc-6.6$ cat mk/build.mk
SplitObjs=NO
after doing sudo make make.out
[EMAIL PROTECTED]:~/haskellInstalls/ghc-6.6$ tail make.out
I just thought this was interesting, so I would share it.
Thanks to whoever it was on #haskell who helped me, sorry I can't remember who.
-- horribly slow. try slow_fibs 30, not too much higher than that and it hangs
slow_fibs = map slow_fib [1..]
slow_fib 1 = 1
slow_fib 2 = 1
slow_fib n = (
haskellers, I'm contemplating returning to school after a decade as a
worker bee, and almost that long as a worker bee doing computer
consulting / miscelaneous tech stuff.
Ideally I'd like to get a masters, but I don't know if that's feasible
this late in the game. If it's not, I might settle
works like a charm :)
2007/1/11, Claus Reinke [EMAIL PROTECTED]:
Looks very nice!
thanks!-)
it is far from a full-blown solution to the question in the subject, but it has
its uses.
However, I'm doing my learning on ghci and got an error when I tried to load
it.
Is this hugs only, or
Looks very nice!
However, I'm doing my learning on ghci and got an error when I tried to load it.
Is this hugs only, or should I try harder?
2007/1/11, Malcolm Wallace [EMAIL PROTECTED]:
Bulat Ziganshin [EMAIL PROTECTED] wrote:
tphyahoo wrote:
*UnixTools explodeLambda( map (*) [1,2] )
301 - 360 of 360 matches
Mail list logo