David Feuer wrote:
> I'm looking to play around with an array-based structure with
> sub-linear worst-case bounds. Array is pretty awkward in that context
> because creating a new one takes O(n) time to initialize it. Is that
> all true of newByteArray, or can I get one with arbitrary garbage in
David Feuer wrote:
> I know that a frozen array doesn't have to be searched for elements in
> a younger generation, but how does it differ from an unfrozen array
> that hasn't been mutated since the last collection?
Frozen arrays are not put on the mutable list once they're clean
(meaning they
AntC wrote:
> >
> > With syntaxless TDNR enabled, the last line could be:
> >
> > f b c = do { reset b; reset c }
> >
>
> Heck, I didn't think you meant something that radical.
> So bare name in a function application context is to need disambiguating.
>
> I think you'll find rather a lot
Volker Wysk wrote:
> Hello!
>
> I'm using GHC 7.10.3 after an upgrade. I have the following in my Makefile:
>
> depend_mod :: lib/abh
> ghc -M $(CFLAGS_GHC_0) -dep-makefile -optdepbuild/depend.tmp
> -dep-suffix "p_"
You should drop the -optdep here
> \
> $(foreach m,
George Colpitts wrote:
I'm curious why the amount of RAM is relevant as all of our OS have virtual
memory so it is only the size of the heap and the amount of swap that
should be relevant for an Out Of Memory error, right?
The computer may not be your own. VPSs are essentially priced based on
Dear Michael,
Michael Snoyman wrote:
As part of trac ticket 9390[1], Simon PJ recommended that we try to get a
document written that clarifies some of the issues regarding evaluation
order, and get it included in the GHC wiki. After a few iterations with
review from Simon, I've got a first
Simon Peyton Jones wrote:
| On a largely unrelated note, here's another thing I don't
| understand: when is OVERLAPPABLE at one instance declaration
| preferable to using only OVERLAPPING at the instance declarations
| that overlap it?
It's a user decision. GHC allows
- OVERLAPPABLE at
John Lato wrote:
I'd like to compile ghc-7.8.2 with DynamicGhcPrograms disabled (on 64-bit
linux). I downloaded the source tarball, added
DYNAMIC_GHC_PROGRAMS = NO
I've had success with setting both
DYNAMIC_BY_DEFAULT = NO
DYNAMIC_GHC_PROGRAMS = NO
and removing the 'dyn' way altogether
Arie Peterson wrote:
(Sorry for the long email.)
Summary: why does the attached program have non-constant memory use?
Unfortunately, I don't know. I'll intersperse some remarks and
propose an alternative to stream fusion at the end, which allows
your test program to run in constant space.
Roman Cheplyaka wrote:
The documentation for throwTo says:
throwTo does not return until the exception has been raised in the
target thread. The calling thread can thus be certain that the target
thread has received the exception. This is a useful property to know
when dealing with
Roman Cheplyaka wrote:
Can withAsync guarantee that its child will be terminated if the thread
executing withAsync gets an exception?
To remind, here's an implementation of withAsync:
withAsyncUsing :: (IO () - IO ThreadId)
- IO a - (Async a - IO b) - IO b
-- The
Felipe Almeida Lessa wrote:
I have some code that is not behaving the way I thought it should.
The gist of it is
sleeper =
mask_ $
forkIOWithUnmask $ \restore -
forever $
restore sleep `catch` throwBack
throwBack (Ping tid) = myThreadId = throwTo tid . Pong
Dear Dominic,
Dominic Steinitz wrote:
bash-3.2$ ./configure --prefix=/Library/Haskell
...
bash-3.2$ which ghc-pkg
/Library/Haskell/lib/ghc-7.6.2/ghc-pkg
bash-3.2$ which ghc
/Library/Haskell/lib/ghc-7.6.2/ghc
These are the wrong executables; the right ones would be in
Akio Takano wrote:
Thank you for the explanation. My previous attempt obviously suffers
from the race condition you mention.
However it still seems to be possible to implement a compromise, using
both the IO manager and a new thread, i.e. forking only when the
computation is being timed
Dear Herbert,
I've been experimenting with an alternative implementation of
'System.Timeout.timeout'[1] which avoids the overhead of spawning a new
thread for each invocation.
Be warned that timeouts are very intricate. We had a lengthy discussion
on the topic 2 years ago, starting at
Dear Janek,
I am reading Simon Marlow's tutorial on parallelism and I have problems
with correctly using Eval monad and Strategies. I *thought* I understand
them but after writing some code it turns out that obviously I don't
because parallelized code is about 20 times slower. Here's a short
Christopher Done wrote:
The context
===
In a fat-client web app (like GMail) you have the need to send requests
back to the server to notify the server or get information back, this is
normally transported in JSON format. For a Haskell setup, it would be:
JavaScript (Client)
Christopher Done wrote:
On 18 August 2012 20:57, Bertram Felgenhauer
bertram.felgenha...@googlemail.com wrote:
The natural encoding as a GADT would be as follows:
data Command result where
GetFoo :: Double - Command Foo
PutFoo :: String - Command Double
Right
Simon Peyton-Jones wrote:
| Would it be reasonable to change ghc's behavior to treat this
| (ie an 'import' statement that hides something that isn't exported) as a
| warning instead of an error?
Yes, that would be easy if it's what everyone wants. Any other opinions?
+1 for a warning from
Leon Smith wrote:
I am familiar with the source of Control.Concurrent.MVar, and I do see {-#
UNPACK #-}'ed MVars around, for example in GHC's IO manager. What I
should have asked is, what does an MVar# look like? This cannot be
inferred from Haskell source; though I suppose I could
Jonas Almström Duregård wrote:
Thank you for your response Edward,
You write that it is usually only evaluated once, do you know the
circumstances under which it is evaluated more than once? I have some
examples of this but they are all very large.
Only the dictionaries for type class
Hi,
Johannes Waldmann wrote:
s2 :: Int - Int
s2 n = sum $ do
x - [ 0 .. n-1 ]
y - [ 0 .. n-1 ]
return $ gcd x y
This code shows some interesting behaviour: its runtime depends heavily
on the allocation area size.
For comparison, with main = print $ s1 1 I
regards,
Bertram
1 patch for repository http://darcsden.com/jcpetruzza/hint:
Wed Apr 4 14:59:33 CEST 2012 Bertram Felgenhauer in...@gmx.de
* clean temporary files in runInterpreterT(withArgs)
New patches:
[clean temporary files in runInterpreterT(withArgs)
Bertram Felgenhauer in...@gmx.de
Serge D. Mechveliani wrote:
Who can tell, please, how read string :: Integer
is implemented in ghc-7.4.1 ?
Is it linked from the GMP (Gnu Multi-Precision) library?
I believe your numbers simply were not large enough. I changed
strs n to be
strs n = if n == 0 then []
Simon Marlow wrote:
import Control.Concurrent
import Control.Exception
import Control.Monad
import System.IO.Unsafe
main :: IO ()
main = do
-- evaluate lock -- adding this line fixes the problem
fin1- newEmptyMVar
fin2- newEmptyMVar
forkIO $ ping= putMVar fin1
Jean-Marie Gaillourdet wrote:
This is my previous program with your workaround, it is also attached as
TypeRepEqLock.hs
[snip]
Compile and execute:
$ ghc-7.0.3 -threaded -rtsopts TypeRepEqLock.hs
snip
$ while true ; do ./TypeRepEqLock +RTS -N ; done
Ok
Ok
Ok
Ok
Ok
Ok
Ok
Ok
Ok
Dear Ben,
Ben Gamari wrote:
After looking into this issue in a bit more depth, I'm even more
confused. In fact, I would not be surprised if I have stumbled into a
bug in the GC.
[...]
MessagesMessage
|
| msmpp
\/
QueryMessages
Dear list,
Cabal-1.10.1.0 contains a bug that causes it to fail to parse the
test-suite target of bytestring-0.9.2.0. Since cabal-install parses
all package descriptions to before resolving dependencies, users
with that version of Cabal are stuck.
Now it seems somebody realised this problem and
Hi Will,
Will Ness wrote:
Will Ness will_n48 at yahoo.com writes:
CORRECTION: just with gaps (but not the other ones), changing the g
function from composed pieces into a normal code, it did it! (probably
some ghc version-specific stuff at play):
g xs = 3 : gaps 5
(
Hi Will,
in reformulation of a code with no space leak, the leak reappeares.
It takes near constant space to get at the n-th elt in the produced list here
(http://ideone.com/fiifl):
{-# OPTIONS_GHC -O2 -fno-cse #-}
primes = 2 : ([3,5..] `minus`
foldi (\(x:xs) - (x:) .
Carl Howells wrote:
On Tue, Jul 19, 2011 at 11:14 PM, yi huang yi.codepla...@gmail.com wrote:
2011/7/20 Eugene Kirpichov ekirpic...@gmail.com
reallyUnsafePointerEq#, and it really is as unsafe as it sounds :)
Why is it so unsafe? i can't find any documentation on it.
I think always
David Barbour wrote:
On Wed, Jul 20, 2011 at 10:40 AM, Chris Smith cdsm...@gmail.com wrote:
The point, I think, is that if pointer equality testing really does what
it says, then there shouldn't *be* any correct implementation in which
false positives are possible. It seems the claim is
Antoine Latter wrote:
If you give the module a new name in the new package then the old
module can re-export all of the symbols in the new module.
In GHC I don't think there is a way for two packages to export the
same module and have them be recognized as the same thing, as far as I
know.
Hi Mitar,
I have made this function to generate a random graph for
Data.Graph.Inductive library:
generateGraph :: Int - IO (Gr String Double)
generateGraph graphSize = do
when (graphSize 1) $ throwIO $ AssertionFailed $ Graph size out
of bounds ++ show graphSize
let ns = map (\n -
Hi Bas,
The solution is probably to reverse the order of: unsafeUnmask $
forkIO to forkIO $ unsafeUnmask. Or just use forkIOUnmasked. The
reason I didn't used that in the first place was that it was much
slower for some reason.
The reason is probably that in order for the forkIOUnmaske-d
Mitar wrote:
Hi!
On Sat, Dec 25, 2010 at 11:58 AM, Edward Z. Yang ezy...@mit.edu wrote:
I think you're right. A further comment is that you don't really need
stringent timing conditions (which is the only thing I think of when
I hear race) to see another thread grab the mvar underneath
| Then we can define
|
| safeCoerce :: (a ~~ b) = a - b
| safeCoerce = unsafeCoerce
Yes, that's right. When I said we have the technology I meant that we
(will) have something similar to ~~. See our paper Generative Type
Abstraction and Type-level Computation
Hello,
Now that the Glorious New type checker can handle local evidence
seamlessly, is it a big implementation burden to extend it to deal
with local *type class instances* in addition to local *equality
constraints*?
For example, you could write this:
f :: Bool
f = id id
where
Max Bolingbroke wrote:
On 23 October 2010 15:32, Sjoerd Visscher sjo...@w3future.com wrote:
A little prettier (the cata detour wasn't needed after all):
data IdThunk a
type instance Force (IdThunk a) = a
Yes, this IdThunk is key - in my own implementation I called this Forced,
Simon Peyton-Jones wrote:
What you really want is to say is something like this. Suppose my_tree ::
Tree String. Then you'd like to say
my_tree ::: Tree Foo
meaning please find a way to convert m_tree to type (Tree Foo), using
newtype coercions.
The exact syntax is a problem
Hi,
let (first,rest) = break (const False) input
in
print (length (first ++ rest))
When I compile this program using -O2 and use a large text file as
input the code runs in constant space. If I understand correctly,
the program runs in constant space because ghc uses an optimization
Simon Marlow wrote:
Interesting. You're absolutely right, GHC doesn't respect the
report, on something as basic as sections! The translation we use
is
(e op) == (op) e
once upon a time, when the translation in the report was originally
written (before seq was added) this would have
Hi,
Daniel Fischer wrote:
On Tuesday 05 October 2010 23:34:56, Johannes Waldmann wrote:
main = writeFile check.out ü
that's u-umlaut, and the source file is utf-8-encoded
and ghc-6.12.3 compiles it without problems but when running, I get
hClose: invalid argument (Invalid or
Ryan Newton wrote:
Would there be anything wrong with a Data.Set simply chopping off half its
(balanced) tree and returning two approximately balanced partitions
...
cleave :: Set a - (Set a, Set a)
cleave Tip = (Tip, Tip)
cleave (Bin _ x l r)
| size l size r = (l, insertMin x r)
|
Johannes Waldmann wrote:
Ivan Lazar Miljenovic ivan.miljenovic at gmail.com writes:
... the only thing that changed of significance was the
exception handling: Control.Exception now uses extensible exceptions
base-4 also introduced the Control.Category.Category class and
restructured
Serguey Zefirov wrote:
2010/8/23 200901...@daiict.ac.in:
This function takes 1.8 seconds to
convert 2000 integers of length 10^13000. I need it to be smaller that
0.5 sec. Is it possible?
2000 integers of magnitude 10^13000 equals to about 26 MBytes of data
(2000 numbers each 13000
Henning Thielemann wrote:
Attached is a program with a space leak that I do not understand. I
have coded a simple 'map' function, once using unsafePerformIO and
once without. UnsafePerformIO has a space leak in some circumstances.
In the main program I demonstrate cases with and without space
Andrew Bromage wrote:
But honestly, it's just not that hard to do in linear time, assuming
the symbols are sorted by frequency:
Or maybe not so easy.
But not much harder.
data Tree a = Branch (Tree a) (Tree a)
| Leaf a
deriving Show
huffmanTree :: (Ord a, Num a) = [(a,
Tom Hawkins wrote:
I have a bunch of global variables in C I would like to directly read
and write from Haskell. Is this possible with FFI,
Yes it is, as explained in section 4.1.1. in the FFI specification [1].
An import for a global variable int bar would look like this:
foreign
Bulat Ziganshin wrote:
This expands as
always a = a always a
= a a always a
= a a a always a
...
where each application is represented by a newly allocated object
(or several, I have not looked at it in detail) on the heap.
why
Roman Beslik wrote:
This is not strictly a GHC question. I observed that ld when
linking GHC-compiled programs eats 0.5 GB of resident memory. ~3
times more than GHC or Haddock.
Oh I remember investigating this problem 2 years ago. Looking back it
seems I never made my observations public.
Daniel Fischer wrote:
Am Samstag 17 April 2010 14:41:28 schrieb Simon Peyton-Jones:
I have not been following the details of this, I'm afraid, but I notice
this:
forever' m = do _ - m
forever' m
When I define that version of forever, the space leak goes away.
Bulat Ziganshin wrote:
Hello Bertram,
Sunday, April 18, 2010, 12:11:05 AM, you wrote:
always a = -- let act = a act in act
do
_ - a
always a
hinting at the real problem: 'always' actually creates a long chain of
actions instead of tying the
Daniel Fischer wrote:
Except that with optimisations turned on, GHC ties the knot for you (at
least if always isn't exported).
Without -fno-state-hack, the knot is tied so tightly that
always (return ()) is never descheduled (and there's no leak).
Yes, I was concentrating on -O2, without
Limestraël wrote:
Okay, I just understood that 'Prompt' was just a sort of view for 'Program'.
Right.
runMyStackT :: MyStackT (Player m) a - Player m a
According to what Bertram said, each strategy can pile its own custom monad
stack ON the (Player m) monad.
Yes, and I meant what
Yves Parès wrote:
I answered my own question by reading this monad-prompt example:
http://paste.lisp.org/display/53766
But one issue remains: those examples show how to make play EITHER a human
or an AI. I don't see how to make a human player and an AI play SEQUENTIALLY
(to a TicTacToe,
Simon Marlow wrote:
but they are needlessly complicated, in my opinion. This offers the
same functionality:
mask :: ((IO a - IO a) - IO b) - IO b
mask io = do
b - blocked
if b
then io id
else block $ io unblock
How does forkIO fit into the picture? That's one point where
Simon Marlow wrote:
On 09/04/2010 09:40, Bertram Felgenhauer wrote:
Simon Marlow wrote:
mask :: ((IO a - IO a) - IO b) - IO b
How does forkIO fit into the picture? That's one point where reasonable
code may want to unblock all exceptions unconditionally - for example to
allow the thread
Ross Paterson wrote:
On Mon, Mar 22, 2010 at 10:30:32AM +, Johannes Waldmann wrote:
Nice! - Where's the 'nub'?
A bit longer:
bfs :: Eq a = (a - [a]) - a - [a]
bfs f s = concat $ takeWhile (not . null) $ map snd $ iterate step ([], [s])
where step (seen, xs) = let seen' = xs++seen
Bertram Felgenhauer wrote:
or
bfs next start = lefts . takeWhile (not . null)
I copied the wrong version. This should be
bfs next start = rights . concat . takeWhile (not . null)
-- rest unchanged
. unfoldr (Just . span (either (const False) (const True)) . tail
Hello,
I'm wondering whether annotations [1] could be made available to
Template Haskell users as a ghc specific extension.
Would that be feasible? Would it be useful?
An example use would be annotating a type with a representation of a
default value that could be used in generating instances
Johannes Waldmann wrote:
Hello.
How can I multiply matrices (of Doubles)
with dph (-0.4.0)? (ghc-6.12.1) - I was trying
type Vector = [:Double:]
type Matrix = [:Vector:]
times :: Matrix - Matrix - Matrix
times a b =
mapP
( \ row - mapP ( \ col - sumP ( zipWithP (*)
Duncan Coutts wrote:
Another approach that some people have advocated as a general purpose
solution is to use:
data Exceptional e a = Exceptional {
exception :: Maybe e
result:: a
}
However it's pretty clear from the structure of this type that it cannot
cope with lazy error
Martijn van Steenbergen wrote:
Bonus points for the following:
* An infinite number of singleton axes produces [origin] (and
finishes computing), e.g. forall (infinite) xs. diagN (map (:[]) xs)
== map (:[]) xs
This can't be done - you can not produce any output before you have
checked that
Maciej Kotowicz wrote:
I'm trying to implement a binomial heaps from okaski's book [1]
but as most it's possible to be statically checked for correctness of
definition.
How about this encoding in Haskell 98?
data Tree a t = Tree { root :: a, children :: t }
data Nest a t = Nest { head
Paul Moore wrote:
grep global -A7 D:\Documents and Settings\uk03306\Application
Data\cabal\config
install-dirs global
-- prefix: D:\\Apps\\Haskell\\Cabal
^^^
You should remove the '-- '. Lines beginning with '--' are comments.
So this line has no effect.
HTH,
Bertram
Dan Rosén wrote:
What complexity does these functions have?
I argue that the shuffleArr function should be O(n), since it only contains
one loop of n, where each loop does actions that are O(1): generating a random
number and swapping two elements in an array.
However, they both have the
Uwe Hollerbach wrote:
Here's my version... maybe not as elegant as some, but it seems to
work. For base 2 (or 2^k), it's probably possible to make this even
more efficient by just walking along the integer as stored in memory,
but that difference probably won't show up until at least tens of
Daniel Peebles wrote:
I've been playing with multiparameter typeclasses recently and have
written a few uncallable methods in the process. For example, in
class Moo a b where
moo :: a - a
Another solution would be to artificially force moo to take
a dummy b so that the compiler can
Antoine Latter wrote:
I was trying to see what GHC head was like, but I've run into a few
snags compiling packages.
There's a discrepancy between ghc and ghc-pkg that causes this.
See http://hackage.haskell.org/trac/ghc/ticket/3410
My existing binary for cabal-install can install quite a few
Rafael Gustavo da Cunha Pereira Pinto wrote:
Sorry for all this annoyance, but I was starting to study those libraries
(OpenGL, GLUT and GLFW) using Haskell and the update broke some of my code.
Here is a patch that makes it compile, but then it breaks all code developed
for GLFW-0.3, as all
Petr Pudlak wrote:
Would it be possible to create a lazy selection/sorting
algorithm so that getting any element of the sorted list/array by its index
would require just O(n) time, and getting all the elements would still be in
O(n * log n)?
The (merge) sorting algorithm provided by Data.List
Jeremy Yallop wrote:
Why does compiling the following program give an error?
{-# LANGUAGE TypeFamilies, RankNTypes #-}
type family TF a
identity :: (forall a. TF a) - (forall a. TF a)
identity x = x
GHC 6.10.3 gives me:
Couldn't match expected type `TF a1' against inferred type `TF
Jan Schaumlöffel wrote:
I just discovered that programs compiled with GHC 6.10.3 segfault when
accessing a TVar created under certain conditions.
This is a known bug, but it hasn't gotten much attention:
http://hackage.haskell.org/trac/ghc/ticket/3049
Bertram
Miguel Mitrofanov wrote:
Correction: I think that one can find an expression that causes name
clashes anyway, I'm just not certain that there is one that would clash
independent of whichever order you choose.
Yes there is.
Consider
(\f g - f (f (f (f (f (f g)) (\l a b - l (b a)) (\x -
Sebastian Sylvan wrote:
On Mon, Jun 15, 2009 at 4:18 AM, Richard O'Keefe o...@cs.otago.ac.nz wrote:
There's a current thread in the Erlang mailing list about
priority queues. I'm aware of, for example, the Brodal/Okasaki
paper and the David King paper. I'm also aware of James Cook's
Cale Gibbard wrote:
According to the Report:
nubBy:: (a - a - Bool) - [a] - [a]
nubBy eq [] = []
nubBy eq (x:xs) = x : nubBy eq (filter (\y - not (eq x y)) xs)
Hence, we should have that
nubBy () (1:2:[])
= 1 : nubBy () (filter (\y - not (1 y)) (2:[]))
= 1
Hi Vasili,
Vasili I. Galchin wrote:
I picked an exceedingly case to build an Executable:
Executable QNameTest
Hs-source-dirs: Swish/
Main-Is:HaskellUtils/QNameTest.hs
Other-Modules: HaskellUtils.QName
I'm not sure what you did; the original Swish code doesn't
Michael Snoyman wrote:
On Wed, Jun 3, 2009 at 8:42 AM, Daniel Fischer
daniel.is.fisc...@web.dewrote:
Am Mittwoch 03 Juni 2009 06:12:46 schrieb Michael Snoyman:
2. lookup does not return any generalized Monad, just Maybe (I think that
should be changed).
Data.Map.lookup used to
michael rice wrote:
Finally got adventurous enough to get Cabal working, downloaded the
primes package, and got the following error message when trying
isPrime. Am I missing something here?
The Data.Numbers.Primes module of the primes package does not implement
'isPrime'. The Numbers package
Krzysztof Skrzętnicki wrote:
2009/5/27 Bertram Felgenhauer bertram.felgenha...@googlemail.com:
I wrote:
Krzysztof Skrzętnicki wrote:
The code for modifying the counter:
(\ msg - atomicModifyIORef ioref (\ cnt - (cntMsg cnt msg,(
atomicModifyIORef does not force the new value
Krzysztof Skrzętnicki wrote:
The code for modifying the counter:
(\ msg - atomicModifyIORef ioref (\ cnt - (cntMsg cnt msg,(
atomicModifyIORef does not force the new value of the IORef.
If the previous contents of the IORef is x, the new contents
will be a thunk,
(\ cnt - (cntMsg cnt
I wrote:
Krzysztof Skrzętnicki wrote:
The code for modifying the counter:
(\ msg - atomicModifyIORef ioref (\ cnt - (cntMsg cnt msg,(
atomicModifyIORef does not force the new value of the IORef.
If the previous contents of the IORef is x, the new contents
will be a thunk,
(\ cnt -
Jon Harrop wrote:
Does anyone have any comments on the following criticism of some
difficulties with FFI, including IO, in Haskell:
http://groups.google.com/group/comp.lang.functional/msg/6d650c086b2c8a49?hl=en
That post conflates two separate questions.
1) binding to foreign libraries
Bulat Ziganshin wrote:
Hello glasgow-haskell-users,
i've looked for this bug in Trac but don't found anything. so:
startGUI action = runInBoundThread $ do
unsafeInitGUIForThreadedRTS
myThreadId = writeIORef guiThread
action = widgetShowAll
mainGUI
guiThread =
Jeff Heard wrote:
I tried to get yi to run on my Mac earlier and I get the following errors:
dyld: lazy symbol binding failed: Symbol not found:
_cairo_quartz_font_face_create_for_atsu_font_id
Referenced from: /opt/local/lib/libpangocairo-1.0.0.dylib
Expected in:
Vasili I. Galchin wrote:
vigalc...@ubuntu:~/FTP$ darcs get http://code.haskell.org/leksah
Invalid repository: http://code.haskell.org/leksah
darcs failed: Failed to download URL
http://code.haskell.org/leksah/_darcs/inventory : HTTP error (404?)
I did a google on HTTP 404 = not found
Alberto G. Corona wrote:
however, It happens that fails in my windows box with ghc 6.10.1 , single
core
here is the code and the results:
---begin code:
module Main where
import Control.Concurrent.STM
import Control.Concurrent
import System.IO.Unsafe
import GHC.Conc
Ben Franksen wrote:
Mark Spezzano wrote:
Just looking at the definitions for foldr and foldl I see that foldl is
(apparently) tail recursive while foldr is not.
Why?
Is it because foldl defers calling itself until last whereas foldr
evaluates itself as it runs?
What, strictly
hask...@kudling.de wrote:
Do you think it would be feasable to replace the GHC implementation
of System.Random with something like System.Random.Mersenne?
There's a problem with using the Mersenne Twister: System.Random's
interface has a split method:
class RandomGen g where
split:: g -
Neil Mitchell wrote:
Hi,
I want to read a file using Data.Binary, and I want to read the file
strictly - i.e. when I leave the read file I want to guarantee the
handle is closed. The reason is that (possibly immediately after) I
need to write to the file. The following is the magic I need
I wrote:
With binary 0.5,
Or binary 0.4.3 and later.
Bertram
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Don Stewart wrote:
dons:
[...]
Just serialising straight lists of pairs,
[...]
And reading them back in,
main = do
[f] - getArgs
m - decode `fmap` L.readFile f
print (length (m :: [(B.ByteString,Int)]))
print done
Well, you don't actually read the
Felipe Lessa wrote:
On Tue, Feb 24, 2009 at 4:59 AM, Don Stewart d...@galois.com wrote:
Looks like the Map reading/showing via association lists could do with
further work.
Anyone want to dig around in the Map instance? (There's also some patches
for
an alternative lazy Map
Eugene Kirpichov wrote:
Hi,
I've recently tried to use the priority queue from the
ONeillPrimes.hs, which is famous for being a very fast prime
generator: actually, I translated the code to Scheme and dropped the
values, to end up with a key-only heap implementation.
However, the code didn't
Eugene Kirpichov wrote:
module PQ where
import Test.QuickCheck
data PriorityQ k v = Lf
| Br {-# UNPACK #-} !k v !(PriorityQ k v) !(PriorityQ k v)
deriving (Eq, Ord, Read, Show)
For the record, we can exploit the invariant that the sizes of the left
and
Krasimir Angelov wrote:
Well I actually did, almost. I added this function:
quotX :: Int - Int - Int
a `quotX` b
| b == 0 = error divZeroError
| b == (-1) a == minBound = error overflowError
| otherwise = a `quotInt` b
It does the right
Don Stewart wrote:
If we take what I usually see as the best loops GHC can do for this kind
of thing:
import Data.Array.Vector
main = print (sumU (enumFromToU 1 (10^9 :: Int)))
And compile it:
$ ghc-core A.hs -O2 -fvia-C -optc-O3
We get ideal core, all data structures
wren ng thornton wrote:
John Goerzen wrote:
Hi folks,
I have uploaded a new package to Haskell: convertible. At its heart,
it's a very simple typeclass that's designed to enable a reasonable
default conversion between two different types without having to
remember a bunch of functions.
I
Andrew Wagner wrote:
I think perhaps the correct question here is not how many instances of
Monoid are there?, but how many functions are written that can use an
arbitrary Monoid. E.g., the fact that there are a lot of instances of Monad
doesn't make it useful. There are a lot of instances of
1 - 100 of 226 matches
Mail list logo