Oops, I seem not to have proofread my message.
On 1/4/07, J. Garrett Morris <[EMAIL PROTECTED]> wrote:
On 1/4/07, brad clawsie <[EMAIL PROTECTED]> wrote:
> s = "abcdefg"
> patterns = ["a","b"]
> replacements = ["Z","Y"]
I changed the name here so as not to conflict with the replace function.
So the core question (speaking as a perler) is how do you write
my $s= 'abcdefg';
$s =~ s/a/z/g;
$s =~ s/b/y/g;
print "$s\n";
in haskell? There are various haskell regex libraries out there,
including ones that advertise they are PCRE (Perl Compatible Reg Ex).
But which one to use? H
nr:
> > Sure, you can replace the openFile/hGetContents pair by readFile, but the
> > real problem is the presence of the hClose. Removing that will solve your
> > problem (but note that you now have no control over when the file is
> > actually closed).
>
> Can I just leave it hanging and re
Roberto Zunino wrote:
Brian Hulley wrote:
because Haskell doesn't allow a superclass (or ancestor class)
method default to be redefined in a subclass.
How one would write instances? Using your Monad class, does
instance Monad F where
return = ...
(>>=) = ...
automatically define
Do you need to maintain invariants that span the two? Put
operationally, do you want different threads to be able to access a
and b concurrently?
-m
"Chad Scherrer" <[EMAIL PROTECTED]> writes:
> When using MVars, is there a reason to prefer using MVar (a,b) over
> (MVar a, MVar b), or vice ver
Brian Hulley wrote:
Hi,
Looking at some of the ideas in
http://www.haskell.org/haskellwiki/The_Other_Prelude , it struck me that
the class system at the moment suffers from the problem that as
hierarchies get deeper, the programmer is burdened more and more by the
need to cut-and-paste method
On 1/4/07, brad clawsie <[EMAIL PROTECTED]> wrote:
lets say i have a string
s = "abcdefg"
now i have two lists of strings, one a list of patterns to match, and
a list of replacement strings:
patterns = ["a","b"]
replace = ["Z","Y"]
from which my intent is that "a" be replaced by "Z", "b" by "
Hi Brad,
i have a small problem that will be certainly trivial for almost
everyone reading this, i would appreciate a little help
If you have trivial problems, its often useful to ask on Haskell IRC
(http://www.haskell.org/haskellwiki/IRC_channel)
from which my intent is that "a" be replaced
greetings to this helpful and informative list
i have a small problem that will be certainly trivial for almost
everyone reading this, i would appreciate a little help
lets say i have a string
s = "abcdefg"
now i have two lists of strings, one a list of patterns to match, and
a list of replacem
Chad Scherrer wrote:
When using MVars, is there a reason to prefer using MVar (a,b) over
(MVar a, MVar b), or vice versa?
No one is strictly better than the other. But there are practical
implications of choosing between them.
For instance, MVar (A,B) is less prone to deadlock issues than (M
[Apologies for the long delay in replying; I've been traveling, etc.]
On Sun, 31 Dec 2006 20:11:47 +0100, you wrote:
>The other extreme is the one I favor: the whole pipeline is expressible
>as a chain of function compositions via (.). One should be able to write
>
> process = rectangles2pages .
Hi,
Looking at some of the ideas in
http://www.haskell.org/haskellwiki/The_Other_Prelude , it struck me that the
class system at the moment suffers from the problem that as hierarchies get
deeper, the programmer is burdened more and more by the need to
cut-and-paste method definitions between
When using MVars, is there a reason to prefer using MVar (a,b) over
(MVar a, MVar b), or vice versa? I'm not sure if this is really a
question of style, or if there are practial implications I'm missing
one way or another. Thanks!
--
Chad Scherrer
"Time flies like an arrow; fruit flies like a b
Andy Georges schrieb:
> Hi,
>
>> version 1.0 of package rdtsc has just been released.
>>
>> This small package contains one module called 'Rdtsc.Rdtsc'.
>
> I am wondering what it would take to get rdpmc in there as well. Of
> course, you'd need some way to set the pmcs before running, but that c
On Tue, 2 Jan 2007, Donald Bruce Stewart wrote:
>Dimensional: Statically checked physical dimensions. Björn Buckwalter
>[4]announced version 0.1 of [5]Dimensional, a module for statically
>checked physical dimensions. The module facilitates calculations with
>physical quantities w
Paolo Veronelli wrote:
> Quoting Paolo Veronelli <[EMAIL PROTECTED]>:
>> I paste new version in case you care give me some moe suggestion.
>
>
>
> import Data.Maybe
> import Data.List
> import Data.Array.Diff
>
> import System.Environment
> import Control.Arrow
> import Control.Monad
>
> impo
Hi,
version 1.0 of package rdtsc has just been released.
This small package contains one module called 'Rdtsc.Rdtsc'.
I am wondering what it would take to get rdpmc in there as well. Of
course, you'd need some way to set the pmcs before running, but that
can be done using e.g. perfctr. I'
Quoting Paolo Veronelli <[EMAIL PROTECTED]>:
> I paste new version in case you care give me some moe suggestion.
import Data.Maybe
import Data.List
import Data.Array.Diff
import System.Environment
import Control.Arrow
import Control.Monad
import Random
inc l i = l // [(i,l!i + 1)]
switch l
Hi Bulat,
I wrote:
One is the confusion caused by the strange semantics
to those not familiar with the theory...
Like me, of course.
The other is awkwardness in extending the capabilites
of ST. For that, I would propose that the function "unsafeRunST"
be added to the library.
Bulat Zigansh
I wrote:
Am I missing something?
Yes! In reality, I do not need unsafeSTRef for this
at all, using a type suggested earlier by Udo:
stToState :: MonadState st m => (forall s. STRef s st -> ST s a) -> m a
stToState f = do
s <- get
let (y, s') = runST (stm f s)
put s'
return y
where
Hello Yitzchak,
Thursday, January 4, 2007, 12:25:41 PM, you wrote:
> The other is awkwardness in extending the capabilites
> of ST. For that, I would propose that the function "unsafeRunST"
> be added to the library.
this function exists, but named unsafeIOtoST. IO and ST is exactly the same
thi
Yitzchak Gale wrote:
> Well, it turns out that using Data.Sequence or Data.IntMap
> to shuffle a list becomes prohibitive if you might have
> more than about 10^5 elements in your list. So in that
> case you will need to use a mutable array, and you now
> need ST.
> [..]
>
>>> Wouldn't it be nice i
I wrote:
Combining ST and MTL can be messy, even in this simple
case. You will probably write something with a type like
RandomGen g => [a] -> g -> ST s ([a], g)
Udo Stenzel wrote:
But why would you even want to do this? It's ugly and cumbersome.
Yes indeed.
You'd plug a runST in there an
Neil Mitchell wrote:
> As for beginner issues with rank-2 types, I've been learning Haskell
> for years now, and have never felt the need for a rank-2 type. If the
> interface for some feature requires rank-2 types I'd call that an
> abstraction leak in most cases. It certainly means that you can't
Paul Moore wrote:
...your nice helpful intuitions about monads can break down into
real confusion when you hit complex monads, monad transformers and the
like - *and you hit them quite early in the APIs of some libraries*!
I don't think that is a problem with the design of the
libraries. It is
Seth Gordon wrote:
From a friendliness-to-newbies point of view,
these error messages are a tremendous wart...
Eeeww.
Neil Mitchell wrote:
If the interface for some feature requires rank-2
types I'd call that an abstraction leak in most cases.
As the original poster of this thread, the one w
On 1/3/07, Neil Mitchell <[EMAIL PROTECTED]> wrote:
As for beginner issues with rank-2 types, I've been learning Haskell
for years now, and have never felt the need for a rank-2 type. If the
interface for some feature requires rank-2 types I'd call that an
abstraction leak in most cases. It certa
On 1/3/07, Seth Gordon <[EMAIL PROTECTED]> wrote:
David House wrote:
>
>> So I can't just tell someone who's just starting to learn Haskell that
>> "f $ g y" is equivalent to "f (g y)"; I have to say "those two are
>> *almost always* equivalent, but if you use $ and the compiler complains
>> abou
28 matches
Mail list logo