Hoogle is also helpful
http://haskell.org/hoogle/?q=%5Bm+a%5D+-%3E+m+%5Ba%5D
2007/5/4, Phlex <[EMAIL PROTECTED]>:
Hello all,
I'm trying to learn haskell, so here's is my first newbie question.
I hope this list is appropriate for such help requests.
I'm trying to write a function with the sign
Thanks Dons.
There's also a short and sweet explanation here.
http://hackage.haskell.org/trac/haskell-prime/wiki/NewtypeDeriving
I am going to try and wrap my head around this, as I am very
interested in solutions for haskell / shell interaction.
Are there are any good examples of code written
I was trying to follow the reasoning in Don's article on using haskell
for shell scripting
http://cgi.cse.unsw.edu.au/~dons/blog/2007/03/10
In the source listing at the end we is
newtype Shell a = Shell { runShell :: ErrorT String IO a }
deriving (Functor, Monad, MonadIO)
and I do
If you opt for ubuntu, have a look at
http://groups.google.de/group/fa.haskell/browse_thread/thread/e63e73e7fc9e96c2/be76e381f8c33f39?lnk=st&q=%22haskell+cafe%22+%22Trouble+trying+to+find+packages+for+ubuntu+linux%22&rnum=1&hl=en#be76e381f8c33f39
This little hack enabled me to do a sort of "one
= id
60
61 instance MyString String
62 where mystr = Right
63
64 x <++> y = do xv <- mystr x
65yv <- mystr y
66return $ xv ++ yv
67
2007/4/18, Thomas Hartman <[EMAIL PROTECTED]>:
Looks like this needs to be run with
#
Looks like this needs to be run with
#!/usr/lib/ghc-6.6/bin/runghc
{-# OPTIONS_GHC -fglasgow-exts #-}
to get
instance MyString (Either String String)
where mystr = id
instance MyString String
where mystr = Right
to work.
I'm curious if there is a community feeling on whether glasgow-exts
Created wiki page
http://haskell.org/haskellwiki/String_Interpolation
and referenced various topics mentioned in this thread, there.
2007/4/16, Donald Bruce Stewart <[EMAIL PROTECTED]>:
johan.tibell:
> Hi Haskell Caf?!
>
> I'm writing a perl/python like string templating system which I plan
>
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 b
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=st&q=%22haskell+cafe%22+%22template+system%22&rnum=1&hl=en#286dbd62748ef1c1
which mentions some perl/pyt
ks,
using threads, using map reduce.
Compare 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 simplifi
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
http://groups.goo
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 m
rgname arg maybeTransformedArg =
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/
"plot [\"" ++ startDate ++ "\":\"" ++
endDate ++ "\"]"
++ " '" ++ companyfile ++ "'"
++ modestring
++ " title \&q
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 &l
merge (x:xs) ys
2007/4/13, Thomas Hartman <[EMAIL PROTECTED]>:
And for reference, here is again stefan's "stable" quicksort from his
earlier post.
"
sort [] = []
sort l@(x:_) = filter (x) l
(A stable quicksort, btw)
"
This is the code whose legitimacy I am reques
And for reference, here is again stefan's "stable" quicksort from his
earlier post.
"
sort [] = []
sort l@(x:_) = filter (x) l
(A stable quicksort, btw)
"
This is the code whose legitimacy I am requesting confirmation of.
2007/4/13, Thomas Hartman <[EMAIL PROTECTE
> 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
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 har
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_p
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 from
. map column1
. lines
' \
| xargs apt-get -y install -o APT::Cache-Limit=25165824
# xargs --max-lines=1 can be helpful for debugging if anything goes
wrong in the above.
[EMAIL PROTECTED]:~/shellenv/installs/haskell-installs>
2007/4/6, Thomas Hartman <[EMAIL PROTECTED]>:
.
leave with a lot 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,
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/u
This approach is fleshed out at
http://groups.google.de/group/fa.haskell/browse_thread/thread/ceabae2c3fdc8abc/814a86d89c3f7d28?lnk=st&q=tphyahoo+haskell+ubuntu&rnum=1&hl=en#814a86d89c3f7d28
2007/3/16, Chad Scherrer <[EMAIL PROTECTED]>:
Brian,
I had this exact problem, and I found this approac
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 from
resolved issue at
http://groups.google.de/group/fa.haskell/browse_thread/thread/ceabae2c3fdc8abc/5ab21d4ae2a9b1fc?lnk=st&q=hsh++tphyahoo&rnum=5&hl=en#5ab21d4ae2a9b1fc
2007/4/2, Thomas Hartman <[EMAIL PROTECTED]>:
Well, I guess I spoke to soon. After building ghc6 from feisty
ally looking forward to playing with my new toy :)
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;
rungh
ult a' arising from use of `run' at :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 -- proba
dule: HSH with any suffix: ["hi"]
So, I seem to be stuck at this point.
2007/4/2, Thomas Hartman <[EMAIL PROTECTED]>:
> Well, I guess I spoke to soon. After building ghc6 from feisty as
> described above, I tried building missingh and have basically what I
> started w
sudo runghc Setup.lhs install
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
6.4.2) but 6.6-3 is to be installed
E: Unmet 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
r 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 h
/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
nds: libghc6-base-prof
E: Unmet 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 Glasgo
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 g
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
Se
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 t
-- sorts too, 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.
Othe
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
de
10 . reverse
. ( \s -> drop (length s - 10 ) 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
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 http:
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
7/3/7, 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 (
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 this
ell/UnixTools$ cat ImportsRegexPosix.hs
import Text.Regex.Posix
[EMAIL 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 th
AIL PROTECTED]>:
On Mar 7, 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 Ha
( \x -> x =~ "^q" :: Bool ) . 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/Simp
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 PROTECTED]:~/hask
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
Mar 4, 2007, at 6:31 , 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 PROTECT
words.($*).words)" ; }
> >>
> >> function filesizes () {
> >> find -maxdepth 1 -type f | xargs du
> >> }
> >>
> >> echo haskell, ghc -e pipe
> >> time filesizes | ghc -e 'interact $ (++"\n") . show . sum
head . words ) . lines '
> echo "**"
>
> echo haskell, hmap pipe
> time filesizes | hmap '(++"\n") . show . sum . map ( ( read :: String
> -> Integer ) . head . words ) . lines'
> echo "**"
>
> echo haskell, tw
) . show
. sum . map ( read :: String -> 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 PRO
Great tip! One question though.
What condition is
if which ghc >/dev/null
checking?
What bad thing will happen if you don't do this check?
Sorry this is more a bash question than a haskell question.
2007/3/2, Bas van Dijk <[EMAIL PROTECTED]>:
On Friday 02 March 2007 14:48,
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
N?).
Anyway, I think if you're only testing a single function and you're trying
to
come to grips with recursion and other fundamentals of functional
programming,
then sidetracking to become familiar with a testing suite such as Quickcheck
or
HUnit might be overkill. I prefer the method used
hc-6.6-src-extralibs.tar.bz2
fi
tar -tvjf ghc-6.6-src.tar.bz2
tar -tvjf ghc-6.6-src-extralibs.tar.bz2
pushd ghc-6.6
(cd compat && make clean && make UseStage1=YES)
(cd utils && make clean && make UseStage1=YES)
./configure
make
make install
popd
[EMAIL PROTECTED
I installed ghc 6.6 from source ok. But then when I tried installing
it with the "extralibs" to get all the functionality that had been
unbundled in 6.6, I hit a glitch.
Anyone ever seen anything like this?
In case it matters, this is ssh-ed in to a virtualized user mode linux session.
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
http://h
o, is there a better 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
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 = ( slo
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 for
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,
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
301 - 370 of 370 matches
Mail list logo