heap profiling and name truncation

2005-11-14 Thread Abraham Egnor
I'm trying to use the built-in ghc heap profiling and running into a large roadblock: the names of producers are truncated, often into uselessness, and there doesn't seem to be an option to control this. Am I missing something in the docs? Abe ___

Re: [Haskell-cafe] Infix operators naming conflicts (was: class Ref)

2005-06-07 Thread Abraham Egnor
On 6/7/05, Dimitry Golubovsky [EMAIL PROTECTED] wrote: Gracjan Polak wrote: val = readIORef a=:b = writeIORef a b Pretty shame := is already reserver :(. There is something alike Graphics.Rendering.OpenGL.GL.StateVar. The use $= for assignment. Generalizing variables (in respect to

Re: [Haskell] type question revisited

2005-06-06 Thread Abraham Egnor
Your first attempt didn't typecheck simply because in return () means that the return value of the function is monadic, but you did not declare as such. In your second version, the type of shf is *not* a rank-2 type; it's exactly the same type as shw. This can be expressed (with ghc extensions)

Re: explicit signatures and default for integer literals

2005-05-31 Thread Abraham Egnor
Ghc can't assume in this context - the object file produced by compilation could be linked into code that provides other instances. Abe On 5/31/05, Dinko Tenev [EMAIL PROTECTED] wrote: On 5/31/05, robert dockins [EMAIL PROTECTED] wrote: Dinko Tenev wrote: First we observe that, g =

limited-scope retry?

2005-04-21 Thread Abraham Egnor
Suppose that a program using the Control.Concurrent.STM module had a producer/consumer setup - one thread writing to a channel, the other thread reading from the channel. It seems natural to want a function that the producer can call that will block until the consumer has finished consuming

Re: GADTs and pedagogy was Re: GADTs and fundeps

2005-04-08 Thread Abraham Egnor
You mean, if the data type being defined doesn't actually use the generality of GADTs, allow GADT syntax, and deriving() too? Yes, that would be very nice for the HaskellDemo and new users. I'd definitely switch all of my non-GADT datatypes to use that. One worry I have about this is that

Re: [Haskell] Why is getArgs in the IO monad?

2005-01-17 Thread Abraham Egnor
It's not a constant; see, for example, System.Environment.withArgs (http://www.haskell.org/ghc/docs/latest/html/libraries/base/System.Environment.html#v%3AwithArgs). Abe On Mon, 17 Jan 2005 16:23:17 -0500, Jim Apple [EMAIL PROTECTED] wrote: See subject. It seems that it would be constant

Re: Scoped type variables

2004-12-17 Thread Abraham Egnor
Please! I've lost count of the number of times when I've written code as f :: a - b f (x :: a) = ... wishing that I didn't have to locally bind the 'a'. I'm not sure I understand the objection raised by Jon; the 'implicit declaration' of type variables in type signatures has never bothered me,

Re: Bug in touchForeignPtr?

2004-11-22 Thread Abraham Egnor
If finalizers are not the right thing, what else is? I've found that when writing an interface to a C library that requires resource management, it's much better to use the withX (see Control.Exception.bracket) style of function than to use finalizers - programs are much easier to reason about

Re: [Haskell-cafe] no dynamic binding

2004-09-19 Thread Abraham Egnor
You can use exisential types to do what you'd like. From memory, so there are probably errors: newtype ServerCommand = forall a. ServerCommandClass a = ServerCommand a instance ServerCommandClass ServerCommand where toString (ServerCommand c) = toString c commands :: [ServerCommand]

overzealous defaulting?

2004-08-23 Thread Abraham Egnor
I'm not sure if this is an actual bug, as opposed to an odd instance of defaulting: *GUI.Parser let printQ q = runQ q = print *GUI.Parser :t printQ printQ :: forall a. (Show a) = Q a - IO () *GUI.Parser let p = printQ *GUI.Parser :t p p :: Q Integer - IO () ...but I'm not sure when that would

Re: GHCI/FFI/GMP/Me madness

2004-08-09 Thread Abraham Egnor
FWIW, I couldn't reproduce this problem on my system (i.e. str_test always printed 1). GHC 6.2.1, libgmp 4.1.3, debian unstable Abe On Mon, 9 Aug 2004 17:57:14 +0200, Remi Turk [EMAIL PROTECTED] wrote: On Sun, Aug 08, 2004 at 07:34:04AM -0700, Sigbjorn Finne wrote: Hi, please be aware

[Haskell] generalised algebraic data types, existential types, and phantom types

2004-07-19 Thread Abraham Egnor
I briefly skimmed the paper mentioned in a recent mailing on the ghc-users list that describes generalised algebraic data types (http://research.microsoft.com/Users/simonpj/papers/gadt/index.htm); my reaction can be summed up as nifty!. I was curious to see if I could implement anything similar

[Haskell] concurrent haskell, higher-order types and parameterizing by typeclass

2004-04-13 Thread Abraham Egnor
I have a system composed of threads communicating via channels; I'd like the communicated types to be instances of a particular typeclass (say Show for purposes of discussion), but not all the same type. Since Chan is paramterized by the communicated datatype, the best way I've found to do this

imports with --make?

2004-03-23 Thread Abraham Egnor
Is there any way to use --make but provide paths to search for .hi files, *not* .hs files? For example, if a library doesn't use ghc's package system, and is distributed in precompiled form, there doesn't seem to currently be a way to point ghc at the import files when using --make - it always

Re: Generics... no Tuples 2 either...

2004-02-26 Thread Abraham Egnor
I've been frustrated by the same lack of instances; as a stopgap, here's one for a three-tuple. The pattern is pretty clear and can easily be extended to whatever size you'd like. tupCon = mkConstr 1 (,,) Prefix instance (Data a, Data b, Data c) = Data (a, b ,c) where gfoldl k z (a, b, c) =

Re: [Haskell] Per-type function namespaces (was: Data.Set whishes)

2004-02-26 Thread Abraham Egnor
I think that this is a problem that can be solved with a simple convention change, rather than a language extension - instead of appending type names, I think it would be much better if modules simply used the short, convenient, common names and expected the user to import them qualified where

[Haskell] new primitive instances of Data?

2004-01-29 Thread Abraham Egnor
I'm in the process of trying to write generic binary serialization code using the Scrap Your Boilerplate method. One bump I've run into is that there are no instances of Data provided for the extended set of numeric types (the stuff in Data.Word, etc.) and it seems to be impossible to hand-write

ghc 6.2 panic or program segfault, depending on flags

2004-01-27 Thread Abraham Egnor
If I compile my program with -O or -O2, I get the following: [EMAIL PROTECTED]:~/local/tla/genome/src/test] $ ghc -O -package genome -o test test.hs ghc-6.2: panic! (the `impossible' happened, GHC version 6.2): simplCore/Simplify.lhs:1538: Non-exhaustive patterns in function bind_args

pattern-matching extension?

2003-12-05 Thread Abraham Egnor
I've occasionally wanted some sort of equivalent of an instanceOf function in haskell, i.e. one that would let me define a function that could dispatch on the type of its argument as well as the value. One option I've seen for this is http://okmij.org/ftp/Haskell/class-based-dispatch.lhs;, but

lifting functions to tuples?

2003-11-18 Thread Abraham Egnor
The classic way to write a lift function for tuples is, of course: liftTup f (a, b) = (f a, f b) which has a type of (a - b) - (a, a) - (b, b). I've been wondering if it would be possible to write a function that doesn't require the types in the tuple to be the same, just that the types in the

Re: Implementation of while loop

2003-11-17 Thread Abraham Egnor
While while can be implemented in haskell, I would strongly suggest you look at using the many higher-order functions available (foldl/foldr, map, filter, etc.) - they're much more in line with the spirit of the language, and will lend themselves to much clearer expressions once you get the hang

ANNOUNCE: attribute 0.1

2003-11-13 Thread Abraham Egnor
Attribute is a library for storing and retrieving named values from haskell datatypes in arbitrary monads. Many of the haskell GUI libraries have implemented something similar; in one of my current projects, I discovered that such a thing would be useful. However, I didn't want to tie it to my

ANNOLUNCE: attribute 0.2

2003-11-13 Thread Abraham Egnor
I apologize for the frequency, but based on initial feedback I made some interface-breaking changes and thought it wise to release. The major changes are: * use functions instead of a datatype for Property construction. From the user's point of view, this just means the colon goes at the end

hscairo 0.3

2003-10-19 Thread Abraham Egnor
The haskell bindings for cairo have reached 0.3, which is enough of a milestone to warrant this post, I think. Main improvements include: * better (i.e. more Haskellish) wrappers for the Matrix functions * better status handling - status is now checked automatically, and errors reported properly.

valgrind error

2003-10-11 Thread Abraham Egnor
Just for fun, I decided to run valgrind on the empty program, i.e. main = return (), compiled with ghc 6.0.1. Much to my surprise, it found an error: ==21117== Source and destination overlap in strcpy(0xbc02, 0xbc04) ==21117==at 0x40021E99: strcpy (mac_replace_strmem.c:87) ==21117==

force garbage collection?

2003-10-05 Thread Abraham Egnor
Is there any way to force collection of all unreachable data structures? Abe ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Re: Announce: wxHaskell, a portable GUI library.

2003-07-22 Thread Abraham Egnor
Given your impending vacation, this might not be the best time to mention it, but... I can't seem to download any files for wxHaskell from sourceforge; this is probably a misconfiguration on their part, but I thought it best to let you know as well.

varying function by typeclass

2003-07-22 Thread Abraham Egnor
I have a function that takes, among other things, a (wrapped) generic type, i.e. forall a. a. My function can possible produce an error message; is there any way to set up the function so that if the type is an instance of Show include the value along with the error message? I can't think of

C++ class structure mapping

2003-06-16 Thread Abraham Egnor
I'd like to make a haskell binding for a C++ library. Most of the tools out there seem oriented towards c bindings, so it looks like I'll be writing the FFI code generator myself. While I'm at it I figure I might as well just make a general C++ binding tool. I've been thinking about this, and

Re: Conway's Life

2003-03-11 Thread Abraham Egnor
I'll answer my own question; I've got a much better implementation, along with an HOpenGL-based frontend, at http://ofb.net/~abe/hlife/hlife-0.1.tar.gz;. It uses a FiniteMap of 5x5 UArrays that are created and destroyed as needed; this gives it a good balance of size (the grid is only bounded by

Conway's Life

2003-03-05 Thread Abraham Egnor
I'm implementing Conway's Life in Haskell; my basic implementation is attached. Does anyone have suggestions for optimizations (or alternative representations)? It's interesting to note that the difference between this with no ghc optimization, -O, and -O2 is pretty striking; on my computer,

type fine until you try to use it

2003-01-13 Thread Abraham Egnor
In a project I'm working on, one data type I've defined is this: data FilterIS = FilterIS { source :: (InputStream s) = s, filter :: Filter } which, to me, just means it holds any instance of the InputStream class and a Filter value. Sure, says ghci, fine by me. However, if I try to do

Re: layout rule infelicity

2002-05-30 Thread Abraham Egnor
Just to add my voice to the din... I come from a c/c++/java background, and I taught myself haskell. The layout rules were the part I had the least problem with. I'd prefer that if any change is made it's one that adds options, not removes them. I'm confused as to the source of the problem,

Re: Hugs plugin, Haskell Browser

2002-03-13 Thread Abraham Egnor
Vim can produce HTML from any source code it has highlighting rules for, which includes Haskell. Dunno about the browser plugin, though. Abe On Wed, 13 Mar 2002, Robert Giegerich wrote: Teachers in Haskell, I often use Haskell demos in teaching algorithms. The problem is that this does