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
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
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
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
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
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
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:) .
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
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
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.
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
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
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 =
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
Conal Elliott wrote:
Thanks very much for these ideas. Peter Verswyvelen suggested running the
example repeatedly to see if it always runs correctly. He found, and I
verified, that the example runs fine with Bertram's last version of unamb
below, *unless* it's compiled with -threaded and run
Simon Peyton-Jones wrote:
| I have a good theory on the latter symptom (the thread killed
| message). Sticking in some traces, as in my appended code, helped me
| to see what's going on. It seems to be exactly what you describe --
| the variable v is permanently bound to the exception it
Peter Verswyvelen wrote:
I fail to understand this part of the code:
case fromException e of
Just ThreadKilled - do
myThreadId = killThread
unblock (race a b)
So the current thread gets killed synchronously, then then the race
Sterling Clover wrote:
I have a good theory on the latter symptom (the thread killed message).
Sticking in some traces, as in my appended code, helped me to see what's
going on. It seems to be exactly what you describe -- the variable v is
permanently bound to the exception it evaluates to.
Hi,
Bertram Felgenhauer wrote:
[snip]
race :: IO a - IO a - IO a
Two quick notes on that function:
race a b = block $ do
v - newEmptyMVar
let t x = x = putMVar v
Should be
let t x = unblock (x = putMVar v)
Otherwise the computation 'x' not be interruptible unless
Sterling Clover wrote:
On Dec 27, 2008, at 9:02 AM, Bertram Felgenhauer wrote:
In the above code, there is a small window between catching the
ThreadKilled exception and throwing it again though, where other
exceptions may creep in. The only way I see of fixing that is to use
'block
Hi,
I've successfully built ghc-6.10 with ghc-6.6.1; there was one minor
problem:
Building extensible-exceptions-0.1.0.0...
Control/Exception/Extensible.hs:2:13: cannot parse LANGUAGE pragma
ghc 6.6.1 does not know about DeriveDataTypeable - I just removed that
line.
Software used:
Paul Jarc wrote:
I have a Haskell script called notify, without a .hs extension,
which causes some problems. (I'm using ghc 6.8.3.)
First attempt: runhaskell notify
Without the .hs extension, ghc doesn't know it's a Haskell script, and
so I get Could not find module `notify'. Maybe
Justin Bailey wrote:
I'm trying to get a feel for the assembly output by GHC on my
platform. Below is a module containing one function and the associated
assembly. I've put in comments what I think is going on, but I'd
appreciate it if anyone could give me some pointers. I'd really like
to
Serge D. Mechveliani wrote:
Dear GHC developers,
I'm not one of them, but maybe I can help anyway.
can you exaplain, please, how to use overlapping instances?
For example, the following program uses overlapping instances for
DShow [a] and DShow String, but ghc-6.8.2 reports an error:
Marcus D. Gabriel wrote:
By a rather indirect route, I discovered that I obtain an almost
factor of two improvement in performance in Data.List.sort if I make
one small change in the implementation of the function merge which
supports mergesort and hence sortBy and sort. Admittedly, the
Judah Jacobson wrote:
This means that the library version produces a stack overflow on
lists generated in an iterate like fashion (say, take 100 [0..]).
The modified version produces a stack overflow on the reverse of
that list, but I believe such lists are much rarer in practice.
Philip K.F. H??lzenspies wrote:
[snip]
{- begin -}
{-# OPTIONS -fglasgow-exts #-}
data Z-- Zero
data S x -- Successor of x
class Add a b c | a b - c
instance Add Z q q
instance Add p q r = (S p) q (S r)
{- end -}
[snip]
The coverage condition. For each functional dependency,
[Note: Sorry if this is a duplicate. I originally sent the patches
inline in the mail, but the resulting mail grew rather big and is
awaiting moderators approval now. (moderators: no need to approve it)]
Bas van Dijk wrote:
On 5/2/07, Simon Marlow [EMAIL PROTECTED] wrote:
I believe this one is
Donald Bruce Stewart wrote:
john:
so I have this simple bit of code, which should be fast but seems to be
being compiled to something very slow.
import Data.Word
import Data.Bits
fhb :: Word - Word
fhb w = b1 .|. b2 where
b2 = if 0x .. w /= 0 then 0x2 else 0
Hi,
consider this program:
module Main (f, main) where
f ~(a:as) = 1 + f as
main = print $ f (error Foobar!)
Obviously, the program should result in an error - the irrefutable
pattern of f always succeeds, so f calls itself recursively ad
infinitum and the result is Loop or
Simon Peyton-Jones wrote:
In general, GHC (like every other compiler that does strictness
analysis) feels free to change non-termination into a call to 'error'
and vice versa. One could change that, but a lot of programs would
become less efficient as a result.
Just to clarify, I'm happy
Dinko Tenev wrote:
On 11/27/06, Lennart Augustsson [EMAIL PROTECTED] wrote:
GHC doesn't normally do CSE. CSE can cause space leaks, so you can't
do it willy-nilly.
I'm sure there are some strict contexts where it could be done
safely, but I don't think ghc uses that information (yet).
48 matches
Mail list logo