Foreign.StablePtr: nullPtr double-free questions

2013-03-08 Thread Remi Turk
by different authors, this makes correct use rather complicated. Is this behaviour (and the consequential undefinedness) intentional? With kind regards, Remi Turk [1] http://www.haskell.org/ghc/docs/latest/html/libraries/base-4.6.0.1/Foreign-StablePtr.html

Re: [Haskell-cafe] ANNOUNCE: cinvoke 0.1 released

2011-03-10 Thread Remi Turk
On Wed, Mar 09, 2011 at 05:50:12PM +0100, Gábor Lehel wrote: On Wed, Mar 9, 2011 at 5:26 PM, Remi Turk rt...@science.uva.nl wrote: Count on it having at least an order of magnitude more overhead. I did some simple test of calling the following three trivial functions (with constant

Re: [Haskell] [Haskell-cafe] ANNOUNCE: cinvoke 0.1 released

2011-03-09 Thread Remi Turk
On Tue, Mar 08, 2011 at 01:01:58PM +0100, Gábor Lehel wrote: On Sun, Mar 6, 2011 at 2:38 PM, Remi Turk rt...@science.uva.nl wrote: Where? Hackage: http://hackage.haskell.org/package/cinvoke Cheers, Remi [1] http://www.nongnu.org/cinvoke/ Is there any information on how

Re: [Haskell-cafe] ANNOUNCE: cinvoke 0.1 released

2011-03-09 Thread Remi Turk
On Tue, Mar 08, 2011 at 01:01:58PM +0100, Gábor Lehel wrote: On Sun, Mar 6, 2011 at 2:38 PM, Remi Turk rt...@science.uva.nl wrote: Where? Hackage: http://hackage.haskell.org/package/cinvoke Cheers, Remi [1] http://www.nongnu.org/cinvoke/ Is there any information on how

Re: [Haskell-cafe] ANNOUNCE: cinvoke 0.1 released

2011-03-08 Thread Remi Turk
On Tue, Mar 08, 2011 at 01:15:26AM +, Felipe Almeida Lessa wrote: On Mon, Mar 7, 2011 at 6:32 PM, Remi Turk rt...@science.uva.nl wrote: - If you need to pass C structs (by value), you'll have to use  libffi: cinvoke doesn't support them at all. What about CInvStructure[1]? I was just

Re: [Haskell-cafe] ANNOUNCE: cinvoke 0.1 released

2011-03-07 Thread Remi Turk
On Mon, Mar 07, 2011 at 09:41:27AM +, Max Bolingbroke wrote: Hi Remi, On 6 March 2011 13:38, Remi Turk rt...@science.uva.nl wrote: I am happy to finally announce cinvoke 0.1, a binding to the C library cinvoke[1], allowing functions to be loaded and called whose names and types

Re: [Haskell-cafe] ANNOUNCE: cinvoke 0.1 released

2011-03-07 Thread Remi Turk
On Mon, Mar 07, 2011 at 10:00:47PM +0100, Daniel Fischer wrote: On Monday 07 March 2011 21:42:16, Gábor Lehel wrote: It's reporting a build failure. Missing C library. cinvoke (the C library) is obviously not installed on the testing machine. Does that really mean no library with

Re: [Haskell-cafe] ANNOUNCE: cinvoke 0.1 released

2011-03-07 Thread Remi Turk
On Mon, Mar 07, 2011 at 10:31:25PM +0100, Daniel Fischer wrote: On Monday 07 March 2011 22:14:38, Remi Turk wrote: cinvoke (the C library) is obviously not installed on the testing machine. Does that really mean no library with uncommon C dependencies gets documentation on hackage

[Haskell] ANNOUNCE: cinvoke 0.1 released

2011-03-06 Thread Remi Turk
I am happy to finally announce cinvoke 0.1, a binding to the C library cinvoke[1], allowing functions to be loaded and called whose names and types are not known before run-time. Why? Sometimes you can't use the Haskell foreign function interface because you parse the type of the function from

[Haskell-cafe] ANNOUNCE: cinvoke 0.1 released

2011-03-06 Thread Remi Turk
I am happy to finally announce cinvoke 0.1, a binding to the C library cinvoke[1], allowing functions to be loaded and called whose names and types are not known before run-time. Why? Sometimes you can't use the Haskell foreign function interface because you parse the type of the function from

[Haskell] ANNOUNCE: libffi 0.1 released

2009-03-17 Thread Remi Turk
I am happy to announce libffi 0.1, binding to the C library libffi, allowing C functions to be called whose types are not known before run-time. Why? Sometimes you can't use the haskell foreign function interface because you parse the type of the function from somewhere else, i.e. you're writing

[Haskell-cafe] ANNOUNCE: libffi 0.1 released

2009-03-17 Thread Remi Turk
I am happy to announce libffi 0.1, binding to the C library libffi, allowing C functions to be called whose types are not known before run-time. Why? Sometimes you can't use the haskell foreign function interface because you parse the type of the function from somewhere else, i.e. you're writing

Re: :info features

2009-02-14 Thread Remi Turk
On Thu, Feb 12, 2009 at 08:47:36AM +, Simon Marlow wrote: Remi Turk wrote: On Tue, Feb 10, 2009 at 01:31:24PM +, Simon Marlow wrote: My vote would be: :info class Show :info type Show :info instance Show where :info Show displays information about everything called Show I

Re: :info features

2009-02-11 Thread Remi Turk
On Tue, Feb 10, 2009 at 01:31:24PM +, Simon Marlow wrote: Remi Turk wrote: On Sat, Feb 07, 2009 at 12:39:03AM -0500, Brandon S. Allbery KF8NH wrote: On 2009 Feb 5, at 5:49, Remi Turk wrote: SPJ agreed with the idea itself, but suggested an alternative set of commands: :info Show

Re: :info features

2009-02-09 Thread Remi Turk
On Sat, Feb 07, 2009 at 12:39:03AM -0500, Brandon S. Allbery KF8NH wrote: On 2009 Feb 5, at 5:49, Remi Turk wrote: SPJ agreed with the idea itself, but suggested an alternative set of commands: :info Show-- See class definition only :instances Show -- See instances of Show

Re: :info features

2009-02-06 Thread Remi Turk
On Thu, Feb 05, 2009 at 12:35:43PM +0100, Peter Hercek wrote: Remi Turk wrote: SPJ agreed with the idea itself, but suggested an alternative set of commands: :info Show-- See class definition only :instances Show -- See instances of Show Hi Remi, If you do not want

:info features

2009-02-05 Thread Remi Turk
One of my most used GHCi commands is :info, but quite often the type or class definitions that I'm interested in get drowned in lots of instances. So a week ago I wrote a feature request and a little patch that allowed the following: :info Show -- See class definition and instances

Re: [Haskell-cafe] Re: (flawed?) benchmark : sort

2008-03-12 Thread Remi Turk
On Tue, Mar 11, 2008 at 01:43:36AM -0400, Brandon S. Allbery KF8NH wrote: On Mar 11, 2008, at 0:20 , Chaddaï Fouché wrote: 2008/3/11, David Menendez [EMAIL PROTECTED]: I think Adrian is just arguing that a == b should imply f a == f b, for all definable f, in which case it doesn't *matter*

[Haskell-cafe] ANNOUNCE / POST MORTEM: hswm, version ()

2007-10-28 Thread Remi Turk
Hi everyone, HSWM was my attempt at a Haskell Window Manager, mostly written during the first half of 2006 as a personal research project, and out of frustration with some not to be named other window managers. Although I have been running it myself for almost two years, I never got around to

Re: type families not advertised for 6.8

2007-10-20 Thread Remi Turk
On Fri, Oct 19, 2007 at 08:25:22AM +0100, Simon Peyton-Jones wrote: | What does this imply for 6.8 support for FD's, as they now use | the same type-coercions? Actually FDs do not use type coercions, in GHC at least. As Mark Excuse me, it turns out I didn't look carefully enough: It's not

Re: type families not advertised for 6.8

2007-10-18 Thread Remi Turk
On Thu, Oct 18, 2007 at 02:58:21AM +0100, Simon Peyton-Jones wrote: | Absolutely not; quite the reverse. It means that some of the *code* for | type functions happens to be in the 6.8 release --- but that code has bugs. | It's only in 6.8 for our convenience (to avoid too great a divergence

Re: [Haskell-cafe] forall and a parse error

2006-11-15 Thread Remi Turk
Probably unrelated, but this thread is what triggered it for me. There is a minor bug in showing impredicative types without -fglasgow-exts: *hope I got that right* Prelude let x = [] :: [forall a. a] interactive:1:23: Warning: Accepting non-standard infix type constructor `.'

Re: [Haskell-cafe] RE: module names

2005-12-29 Thread Remi Turk
On Fri, Dec 16, 2005 at 07:55:50AM -0800, Scherrer, Chad wrote: From: S Koray Can [mailto:[EMAIL PROTECTED] Why not do this: name none of those modules Main.hs, and have an empty module Main.hs with only import MainDeJour and main = MainDeJour.main so you can just edit just that file.

Re: [Haskell] PROPOSAL: class aliases (revised)

2005-10-14 Thread Remi Turk
On Thu, Oct 13, 2005 at 05:53:15PM -0700, John Meacham wrote: I have revised the proposal and put it on the web here: http://repetae.net/john/recent/out/classalias.html changes include a new, clearer syntax, some typo fixes, and a new section describing how class aliases interact with

Re: [Haskell-cafe] wxHaskell: getting a checkbox state

2005-09-16 Thread Remi Turk
On Fri, Sep 16, 2005 at 12:12:50AM +0200, Sebastian Sylvan wrote: On 9/14/05, Mark Carter [EMAIL PROTECTED] wrote: The problem I was having before was that I was trying to create a separate function onCbEdit, thus: cbEdit - checkBox p1 [text := Edit Mode, on command := onCbEdit

Re: [Haskell] FunDeps and MArray

2005-09-05 Thread Remi Turk
On Mon, Sep 05, 2005 at 11:31:00AM -0700, Scherrer, Chad wrote: I keep getting this error in GHCi: Illegal instance declaration for `PlusEq (a i e) (a i e) (m ())' (the instance types do not agree with the functional dependencies of the class) In the instance declaration for

Re: [Haskell-cafe] How to use STArray?

2005-08-27 Thread Remi Turk
On Fri, Aug 26, 2005 at 08:27:43PM -0400, ChrisK wrote: to figure out since there was no Data.Array.ST.Lazy. Does anyone know why it was left out? I'll put a note on the HaskellTwo page about that... Some time ago when I wanted a lazy hashtable I came up with this, which, after minimal

Re: [Haskell] Re: ST/STRef vs. IO/IORef

2005-08-05 Thread Remi Turk
unsafePerformIO #-} unsafePerformIO :: IO a - a unsafePerformIO (IO m) = case m realWorld# of (# _, r #) - r (fptools/libraries/base/GHC/IOBase.lhs) On Fri, Aug 05, 2005 at 08:12:36AM +0200, Till Mossakowski wrote: Remi Turk wrote: In a final attempt to convince someone of I'm

Re: [Haskell] Re: ST/STRef vs. IO/IORef

2005-08-05 Thread Remi Turk
On Fri, Aug 05, 2005 at 01:13:06PM +0400, Bulat Ziganshin wrote: Hello Till, Friday, August 05, 2005, 10:04:53 AM, you wrote: TMMonadState IOArray IOArray ST TMwithwith with TMFiniteMap

Re: [Haskell] Re: ST/STRef vs. IO/IORef

2005-08-04 Thread Remi Turk
On Thu, Aug 04, 2005 at 10:09:06AM +0100, Axel Simon wrote: On Thu, 2005-08-04 at 10:58 +0200, Wolfgang Jeltsch wrote: Am Donnerstag, 4. August 2005 10:21 schrieb Axel Simon: [...] Nowadays, you can use one of the MonadState monad State transformer monads like State and StateT can

Re: [Haskell] Re: ST/STRef vs. IO/IORef

2005-08-04 Thread Remi Turk
On Thu, Aug 04, 2005 at 10:40:01PM +0200, Till Mossakowski wrote: Remi Turk wrote: MonadState needs multi-parameter type classes, State and StateT don't. And ST needs rank-2 types (or at least one rank-2 constant) and, to be implemented _efficiently_, also needs something like unsafePerformIO

Re: STM and unsafePerformIO

2005-08-03 Thread Remi Turk
On Wed, Aug 03, 2005 at 12:50:54PM +0200, Robert van Herk wrote: Hello All, I think I've read somewhere that STM doesn't like unsafePerformIO. However, I would like to use a global STM variable. Something like this: module Main where import GHC.Conc import System.IO.Unsafe tSid =

Re: [Haskell-cafe] Proposal: deriving ShallowEq?

2005-07-19 Thread Remi Turk
On Tue, Jul 19, 2005 at 08:16:35PM +1000, Ben Lippmeier wrote: Bulat Ziganshin wrote: reading GHC sources is always very interesting :) that is from GHC/Base.hs : getTag :: a - Int# getTag x = x `seq` dataToTag# x ! This is just what I was looking for, thankyou. My shallowEq

unsafeInterleaveIO + Ctrl-C/killThread related segfault.

2005-06-28 Thread Remi Turk
Good evening, I just stumbled across a segfault caused when running the following small program. (During an attempt to implement single-assignment variables.) module Main where import Control.Concurrent import System.IO.Unsafe (unsafeInterleaveIO) main = do v - newEmptyMVar a -

Re: unsafeness of unsafeInterleaveIO

2005-06-10 Thread Remi Turk
On Fri, Jun 10, 2005 at 07:32:42PM +0200, Lennart Augustsson wrote: Andre Pang wrote: G'day all, Just looking at the documentation for System.IO.unsafeInterleaveIO, what exactly is unsafe about it? You pick. :) It can break referential transparency. It can break type safety.

Re: unsafeness of unsafeInterleaveIO

2005-06-10 Thread Remi Turk
On Sat, Jun 11, 2005 at 01:55:57AM +0200, Thomas Jäger wrote: Just looking at the documentation for System.IO.unsafeInterleaveIO, what exactly is unsafe about it? It can create pure values that trigger side effects during their evaluation. This can be abused to do IO outside of an IO monad

Re: foldr f (head xs) xs is not the same as foldr1 f xs

2005-05-08 Thread Remi Turk
On Sun, May 08, 2005 at 08:14:30PM +0200, David Sabel wrote: Hi! A small example for the claim mentioned in the subject: Prelude let x = 1:undefined in foldr (curry fst) (head x) x 1 Prelude let x = 1:undefined in foldr1 (curry fst) x *** Exception: Prelude.undefined Perhaps it would

-O causing a 7x slowdown (Map of IORef's)

2005-04-23 Thread Remi Turk
Good afternoon, the attached program is about 7 times slower when compiled _with_ -O using ghc 6.4. Using ghc 6.2.1 with ddata's Map gives the same behaviour. Happy hacking, Remi % make ghc --make -no-recompMain.hs -o nor Chasing modules from: Main.hs Compiling Main ( Main.hs,

Re: ANNOUNCE: GHC version 6.4

2005-03-11 Thread Remi Turk
On Fri, Mar 11, 2005 at 12:25:04PM -, Simon Marlow wrote: = The (Interactive) Glasgow Haskell Compiler -- version 6.4 = The GHC Team is delighted to

[Haskell] Re: ANNOUNCE: GHC version 6.4

2005-03-11 Thread Remi Turk
On Fri, Mar 11, 2005 at 12:25:04PM -, Simon Marlow wrote: = The (Interactive) Glasgow Haskell Compiler -- version 6.4 = The GHC Team is delighted to

{-# SPECIALIZE, IO vs ST s

2005-03-10 Thread Remi Turk
Hello again, first of all, I'm not sure whether this is actually a bug-report or a feature-request. The three line summary is that in the following program, no specialized version for ST s is created by at least 6.2.1, 6.4.20050304, and 6.4.20050308. {-# OPTIONS -fno-implicit-prelude #-}

Re: infix type operators

2005-03-09 Thread Remi Turk
[warning: Very Vague message possible bug-report follow] Though I cannot claim any real-world experience with arrows, I'm not sure I like this, and I hope they'll at least remain experimental (may be removed next release kind of thing) for a while. - I doubt whether the difference between Arrow

Re: 6.4.20050304 RULES panic from CgMonad.lhs other nastiness

2005-03-07 Thread Remi Turk
: [EMAIL PROTECTED] [mailto:glasgow-haskell-bugs- | [EMAIL PROTECTED] On Behalf Of Remi Turk | Sent: 07 March 2005 00:41 | To: glasgow-haskell-bugs@haskell.org | Subject: 6.4.20050304 RULES panic from CgMonad.lhs other nastiness | | Hi, | | while still trying to get Data.HashTable to work both

Re: [Haskell-cafe] tuples and Show in GHC

2005-03-07 Thread Remi Turk
On Mon, Mar 07, 2005 at 12:05:41AM +, Keean Schupke wrote: Daniel Fischer wrote: The Show instances for tuples aren't automatically derived, they are defined in GHC.Show. So somewhere there must be an end, probably the author(s) thought that larger tuples than quintuples aren't used

6.4.20050304 RULES panic from CgMonad.lhs other nastiness

2005-03-06 Thread Remi Turk
Hi, while still trying to get Data.HashTable to work both in ST and IO (I'll probably start complaining about optimizations not performed once this is fixed ;), I bumped into the following nastiness. Comments interleaved with shell copy-paste-work. % make clean rm -f *.o *.hi a.out

Re: 6.4.20050215: panic: lookupVers1 MHashTable HT{d}

2005-02-28 Thread Remi Turk
On Mon, Feb 28, 2005 at 03:01:53AM -, Simon Peyton-Jones wrote: Ah, this one we fixed a few days ago. Works for me with the head. Thanks for your well-boiled-down bug reports; they are a lot faster to fix. Simon Thanks, it's nice to hear that. Though I consider it a fair deal: I'm

Re: segfault/massive memory use when using Data.Bits.shiftL

2005-02-28 Thread Remi Turk
On Mon, Feb 28, 2005 at 02:55:56PM +, Ganesh Sittampalam wrote: Hi, The following either eats memory until killed or segfaults (I can't pin down a reason for the difference). Tested with GHC 6.2.2 and 6.4.20050212, with various different libgmp3s under various Redhat and Debian

Re: segfault/massive memory use when using Data.Bits.shiftL

2005-02-28 Thread Remi Turk
On Mon, Feb 28, 2005 at 10:59:32PM +, Ganesh Sittampalam wrote: On Mon, 28 Feb 2005, Remi Turk wrote: On Mon, Feb 28, 2005 at 02:55:56PM +, Ganesh Sittampalam wrote: Prelude :m +Data.Bits Prelude Data.Bits 18446658724119492593 `shiftL` (-3586885994363551744) :: Integer

6.4.20050215 inferred types incorrect

2005-02-27 Thread Remi Turk
Hi, 6.4 appears to incorrectly infer some types in the attached code when asking with :info in GHCi. Both 6.2.1 and 6.4.20050215 inferrings (is there a nice english word for that?) are added and commented out. Greetings, Remi -- Nobody can be exactly like me. Even I have trouble doing it. {-#

:i EmptyClass shows a superfluous where

2005-02-26 Thread Remi Turk
Hi, it's not going to cause World War III, but it does seem to be a tiny regression since 6.2: with an empty class, 6.4.20050215 gives: *Main :i EmptyClass class EmptyClass a where-- Defined at foo.hs:1:6 ^ where 6.2.1 gave: *Main :i EmptyClass -- EmptyClass is

labeled field update kind-error in ghc 6.4.20050215

2005-02-26 Thread Remi Turk
Hello again, while trying to get HashTable to work both in IO and in ST I hit the following probable bug in 6.4.20050215. 6.2.1 does accept it, and the #ifdeffed-out version works in both. When the typesignature is removed 6.4 does accept it. Cheers, Remi {-# OPTIONS -cpp -fglasgow-exts #-}

6.4.20050215: panic: lookupVers1 MHashTable HT{d}

2005-02-26 Thread Remi Turk
Hi, while trying to modify Data.HashTable to support both IO and ST without simply copying it, 6.4.20050215 again decided it doesn't like me: /tmp/test% touch *.hs /tmp/test% /var/tmp/ghc/bin/ghc -O -c MHashTable.hs /tmp/test% /var/tmp/ghc/bin/ghc -O --make CompatHashTable.hs Chasing modules

ghci `Probable fix' non-exhaustive pattern exception

2005-02-20 Thread Remi Turk
Good evening, the following says it all: ~% /var/tmp/ghc/bin/ghci /tmp/foo.hs ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.4.20050215, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \/\/ /_/\/|_| Type :?

Infix typeconstructors shown as prefix

2005-02-20 Thread Remi Turk
Hi, with the following definitions {-# OPTIONS -fglasgow-exts #-} data a :++: b class a :--: b ghci prints the infix type(classe)s as prefix: *Main :i :++: data :++: a b -- Defined at foo.hs:2:7 *Main :i :--: class :--: a b where-- Defined at foo.hs:3:8 or (a real-world example):

make install dies due to empty INSTALL_LIBS

2005-02-17 Thread Remi Turk
Hi, the subject almost already says it. In line 767 of mk/target.mk from ghc-6.4.20050215, make install dies because INSTALL_LIBS is instead of , causing a shell syntax error: make[1]: Entering directory `/var/tmp/ghc-6.4.20050215/ghc' for i in ; do \ ^ [snip] /bin/sh: -c:

compiling GHC with a custom path to GCC

2005-02-17 Thread Remi Turk
Hi, when compiling the new ghc pre-releases made my gcc 2.95.3 die with internal compiler error, I tried to compile it with gcc 3.4.3 (or rather, I thought it compiled with 3.4.1, and when that died, compiled+installed gcc 3.4.3, tried again, say it die again and only then noticed it was actually

Re: compiling GHC with a custom path to GCC

2005-02-17 Thread Remi Turk
On Thu, Feb 17, 2005 at 04:48:54AM -0700, Seth Kurtzberg wrote: Simon Marlow wrote: On 17 February 2005 11:12, Remi Turk wrote: when compiling the new ghc pre-releases made my gcc 2.95.3 die with internal compiler error, I tried to compile it with gcc 3.4.3 (or rather, I thought

Re: compiling GHC with a custom path to GCC

2005-02-17 Thread Remi Turk
On Thu, Feb 17, 2005 at 05:05:18AM -0700, Seth Kurtzberg wrote: Remi Turk wrote: I'm afraid finding a workaround for compilers dying on compiler-generated code isn't going to be much fun... Anyway, I just replaced a ifneq $(INSTALL_LIBS) by ifneq $(strip $(INSTALL_LIBS

Re: compiling GHC with a custom path to GCC

2005-02-17 Thread Remi Turk
On Thu, Feb 17, 2005 at 11:29:41AM -, Simon Marlow wrote: On 17 February 2005 11:12, Remi Turk wrote: when compiling the new ghc pre-releases made my gcc 2.95.3 die with internal compiler error, I tried to compile it with gcc 3.4.3 (or rather, I thought it compiled with 3.4.1

Re: compiling GHC with a custom path to GCC

2005-02-17 Thread Remi Turk
[Resent, with a few #ifdef FOO's removed from the body (still in the attachement, and using gzip instead of bzip2 to prevent awaiting moderation ;)] On Thu, Feb 17, 2005 at 11:29:41AM -, Simon Marlow wrote: On 17 February 2005 11:12, Remi Turk wrote: when compiling the new ghc pre

Re: GHC 6.4 release candidates available

2005-02-16 Thread Remi Turk
On Thu, Feb 10, 2005 at 01:11:48PM -, Simon Marlow wrote: We are finally at the release candidate stage for GHC 6.4. Snapshots with versions 6.4.20050209 and later should be considered release candidates for 6.4. Source and Linux binary distributions are avaiable here:

Re: [Haskell] sugar for extensible types (was: class associated types, via GADTs.)

2005-02-16 Thread Remi Turk
On Wed, Feb 16, 2005 at 12:38:45PM -, Simon Marlow wrote: test = do x `catch` (\(IOException e)- print e) `catch` (\(ArithException e) - print e) Although slightly off-topic, and though you probably already realized it, beware that this is comparable to try { try {

[Haskell-cafe] Showable mutually recursive (fixed-point) datatypes

2005-02-16 Thread Remi Turk
[WARNING: braindamag(ed|ing) experience following] Hi all, a few days ago I decided I desperately needed a set which could contain (among others) itself. My first idea was module Main where import List import Monad data Elem s a = V a | R (s (Elem s a)) Now, a self-containing list can be

Re: [Haskell] Re: help with some basic code that doesn't work

2005-02-14 Thread Remi Turk
On Mon, Feb 14, 2005 at 02:31:54PM +0900, Shin-Cheng Mu wrote: Malcolm Wallace [EMAIL PROTECTED] wrote: Just a comment, since a couple of people have made similar statements. Haskell will derive Eq for arbitrarily complex types - there is no restriction to simple types, whatever they might be.

Re: [Haskell-cafe] Point-free style

2005-02-14 Thread Remi Turk
On Mon, Feb 14, 2005 at 03:55:01PM +0100, Lennart Augustsson wrote: Any definition can be made point free if you have a complete combinator base at your disposal, e.g., S and K. Haskell has K (called const), but lacks S. S could be defined as spread f g x = f x (g x) Given that large

Re: [Haskell-cafe] What is MonadPlus good for?

2005-02-13 Thread Remi Turk
On Sun, Feb 13, 2005 at 08:58:29AM -0500, David Roundy wrote: I've been working on a typeclass that derives from MonadPlus which will encapsulate certain kinds of IO. With MonadPlus, you can write monadic code with exceptions and everything that may not be executed in the IO monad. You just

Re: [Haskell-cafe] What is MonadPlus good for?

2005-02-13 Thread Remi Turk
On Sun, Feb 13, 2005 at 01:31:56PM -0500, David Roundy wrote: On Sun, Feb 13, 2005 at 04:57:46PM +0100, Remi Turk wrote: According to http://www.haskell.org/hawiki/MonadPlus (see also the recent thread about MonadPlus) a MonadPlus instance should obey m mzero === mzero, which IO doesn't

Re: [Haskell-cafe] What is MonadPlus good for?

2005-02-13 Thread Remi Turk
On Sun, Feb 13, 2005 at 09:28:18PM +0100, Tomasz Zielonka wrote: On Sun, Feb 13, 2005 at 08:06:36PM +0100, Remi Turk wrote: You might be interested in the recent STM monad then (Control.Concurrent.STM in GHC-6.4): `T' for Transactional. However, though it supports both MonadPlus

Re: [Haskell-cafe] What is MonadPlus good for?

2005-02-13 Thread Remi Turk
On Sun, Feb 13, 2005 at 10:33:06PM +0100, Tomasz Zielonka wrote: On Sun, Feb 13, 2005 at 10:25:49PM +0100, Remi Turk wrote: BTW, I have an implementation of STM based entirely on old concurrency primitives, which means that it will work in older GHC and probably in other Haskell

Re: [Haskell-cafe] What is MonadPlus good for?

2005-02-12 Thread Remi Turk
On Sat, Feb 12, 2005 at 01:08:59PM -0500, Benjamin Pierce wrote: I have seen lots of examples that show how it's useful to make some type constructor into an instance of Monad. Where can I find examples showing why it's good to take the trouble to show that something is also a MonadPlus? (I

Re: [Haskell-cafe] What is MonadPlus good for?

2005-02-12 Thread Remi Turk
On Sat, Feb 12, 2005 at 01:47:06PM -0500, Benjamin Pierce wrote: As a start, free access to countless general functions as soon as you define a MonadPlus instance for your datatype. (Errr, `guard' and `msum', as long as one stays within the Haskell98 standard libraries ;) Yes, those are

Re: [Haskell-cafe] Things to avoid (Was: Top 20 ``things'' to know in Haskell)

2005-02-12 Thread Remi Turk
On Fri, Feb 11, 2005 at 11:14:40AM +0100, Henning Thielemann wrote: On Fri, 11 Feb 2005, Remi Turk wrote: 1) It's talking about the compiler having difficulty with some warnings when using guards. http://www.haskell.org//pipermail/haskell-cafe/2005-January/008290.html Simon Peyton

Re: [Haskell-cafe] Things to avoid (Was: Top 20 ``things'' to know in Haskell)

2005-02-10 Thread Remi Turk
On Wed, Feb 09, 2005 at 02:54:12PM +0100, Henning Thielemann wrote: On Wed, 9 Feb 2005, Henning Thielemann wrote: Is there also a Wiki page about things you should avoid? Since I couldn't find one, I started one on my own: http://www.haskell.org/hawiki/ThingsToAvoid I consider

Re: [Haskell-cafe] Things to avoid (Was: Top 20 ``things'' to know in Haskell)

2005-02-10 Thread Remi Turk
On Wed, Feb 09, 2005 at 02:54:12PM +0100, Henning Thielemann wrote: On Wed, 9 Feb 2005, Henning Thielemann wrote: Is there also a Wiki page about things you should avoid? Since I couldn't find one, I started one on my own: http://www.haskell.org/hawiki/ThingsToAvoid I consider

Re: STM check/MonadPlus

2005-02-07 Thread Remi Turk
On Mon, Feb 07, 2005 at 10:53:36AM -, Simon Peyton-Jones wrote: Thanks for the typo. Yes, for Haskell guys 'guard' is fine; but the main audience for the paper is non-haskell folk, so we have to spell out the defn. S Hm, what about calling it `guard' and adding a footnote saying that

Re: [Haskell-cafe] FiniteMap-like module for unordered keys?

2004-11-10 Thread Remi Turk
Ugh, replying to myself... Obviously, the following contains a few mistakes...: On Wed, Nov 10, 2004 at 11:34:32AM +0100, R. Turk wrote: {-# OPTIONS -fglasgow-exts #-} {- I want a Hashable instance for String ;) -} import Data.FiniteMap import Data.HashTable (hashInt, hashString) import

Re: [Haskell-cafe] Re: Arrows and Haskell

2004-11-07 Thread Remi Turk
On Sat, Nov 06, 2004 at 11:49:45PM +0100, Peter Simons wrote: Plus, powerful abstractions that make the code look simple and elegant _always_ come at a price. An Arrow-based stream processor that performs the same task as my monadic BlockIO library does, for instance, results in a module that

Re: [Haskell-cafe] Making MVar and Chan Instances of Typeable

2004-11-05 Thread Remi Turk
On Fri, Nov 05, 2004 at 01:57:53PM +0100, Benjamin Franksen wrote: Hello Experts, I need MVar and Chan to be instances of Typeable. Any hint on how this is most easily done would be greatly appreciated. I could change the libraries and add 'deriving Typeable' but I hesitate to do so.

Re: Data.List.partition on infinite lists

2004-10-31 Thread Remi Turk
On Sun, Oct 31, 2004 at 06:37:20PM +0100, Lemming wrote: I encountered that the implementation of 'partition' in GHC 6.2.1 fails on infinite lists: partition :: (a - Bool) - [a] - ([a],[a]) partition p xs = foldr (select p) ([],[]) xs select p x (ts,fs) | p x = (x:ts,fs)

Re: getUserEntryForName weirdness

2004-10-29 Thread Remi Turk
On Fri, Oct 29, 2004 at 06:29:52PM +0200, Peter Simons wrote: Is anyone else seeing this on his system? getUserEntryForName [] = print . userName wasabi wasabi happens to be the last entry in the /etc/passwd file, and that is what I get every time I query for an user that doesn't

Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-25 Thread Remi Turk
On Mon, Oct 25, 2004 at 08:46:41AM +0200, Ketil Malde wrote: Remi Turk [EMAIL PROTECTED] writes: IMO, [bracket] does indeed have those same drawbacks. (Although the traditional explicit memory management model is alloc/free, which is much worse than bracket/withFile) Isn't bracket more

Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-25 Thread Remi Turk
On Mon, Oct 25, 2004 at 02:14:28PM +0100, Simon Marlow wrote: On 24 October 2004 20:51, Sven Panne wrote: IMHO it would be best to use explicit bracketing where possible, and hope for the RTS/GC to try its best when one runs out of a given resource. Admittedly the current Haskell

Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-25 Thread Remi Turk
On Mon, Oct 25, 2004 at 09:28:23PM +0200, Tomasz Zielonka wrote: On Mon, Oct 25, 2004 at 08:55:46PM +0200, Remi Turk wrote: P.S. Why do so many people (including me) seem to come to Haskell from Python? It can't be just the indentation, can it? ;) How many? I don't. Best regards

Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-24 Thread Remi Turk
On Sun, Oct 24, 2004 at 12:19:59PM -0700, Conal Elliott wrote: I'm puzzled why explicit bracketing is seen as an acceptable solution. It seems to me that bracketing has the same drawbacks as explicit memory management, namely that it sometimes retains the resource (e.g., memory or file

Re: Module Initialisation? (was Re: [Haskell] (no subject))

2004-10-17 Thread Remi Turk
On Sun, Oct 17, 2004 at 01:53:22PM +0100, Ben Rudiak-Gould wrote: [snip] Since a lot of the concerns expressed about this seem to centre around possible abuse of arbitrary IO operations in these top level constructions, maybe the problem could be addressed by insisting that a restricted

Re: Module Initialisation? (was Re: [Haskell] (no subject))

2004-10-17 Thread Remi Turk
On Sun, Oct 17, 2004 at 05:11:02PM +0100, Ben Rudiak-Gould wrote: Remi Turk wrote: It definitely sounds nice, but is it actually possible to generalize e.g. MVar from RealWorld to forall s or are we always going to have to say: v - unsafeIOToST (newMVar / newChan ... ) I hadn't

Re: Module Initialisation? (was Re: [Haskell] (no subject))

2004-10-17 Thread Remi Turk
On Sun, Oct 17, 2004 at 07:20:28PM +0100, Ben Rudiak-Gould wrote: Remi Turk wrote: On Sun, Oct 17, 2004 at 05:11:02PM +0100, Ben Rudiak-Gould wrote: I don't think there's any problem with type MVar = STMVar RealWorld newMVar :: a - ST s (STMVar s a) withMVar :: STMVar s

Re: [Haskell-cafe] Subsequence near solved hopefully

2004-10-17 Thread Remi Turk
On Sun, Oct 17, 2004 at 07:16:51AM -0700, Peter Stranney wrote: equalString :: String - String - Bool equalString [] [] = True equalString [] (c':s') = False equalString(c:s) [] = False equalString(c:s)(c':s') = equalChar c c'^ equalString s s' ^^

Re: [Haskell-cafe] Subsequence near solved hopefully

2004-10-17 Thread Remi Turk
On Sun, Oct 17, 2004 at 08:05:09PM +0200, Ketil Malde wrote: Remi Turk [EMAIL PROTECTED] writes: You might also want to look at the earlier `any prefix of tails' suggestion, as it makes the solution a rather simple one-liner. Wouldn't that be looking for a sub*string*, and not a (general

Re: [Haskell-cafe] Subsequence near solved hopefully

2004-10-17 Thread Remi Turk
On Sun, Oct 17, 2004 at 11:41:59AM -0700, Peter Stranney wrote: Thanks guys for all your help, finally through code, sweat and tears i have found the solution; isSubStrand:: String - String - Bool isSubStrand [] [] = True isSubStrand [] (y:ys) = False isSubStrand (x:xs) [] = False

Re: [Haskell-cafe] Subsequence near solved hopefully

2004-10-17 Thread Remi Turk
On Sun, Oct 17, 2004 at 10:10:44PM +0200, Ketil Malde wrote: Remi Turk [EMAIL PROTECTED] writes: Do you mean subset with subsequence? No, since a set isn't ordered. I would say a subset needs to contain some of the elements of the superset, a subsequence needs to contain some elements

Re: [Haskell-cafe] Re: Subsequence near solved hopefully

2004-10-17 Thread Remi Turk
On Sun, Oct 17, 2004 at 10:53:37PM +0100, Sam Mason wrote: Peter Simons wrote: This version should do it: isSubSeq :: (Eq a) = [a] - [a] - Bool isSubSeq [] _= True isSubSeq _ []= False isSubSeq (x:xs) (y:ys) | x == y= isSubSeq xs ys

Re: [Haskell] is $ a no-op?

2004-10-13 Thread Remi Turk
On Wed, Oct 13, 2004 at 01:00:05PM -0400, Jacques Carette wrote: -- |Apply list of functions to some value, returning list of results. -- It's kind of like an converse map. flist :: [a-b] - a - [b] flist fs a = map ($ a) fs I have attempted, unsuccessfully, to write flist above in a

Re: [Haskell-cafe] puzzle: prove this floorSqrt correct

2004-08-12 Thread Remi Turk
On Thu, Aug 12, 2004 at 06:59:26PM +0200, Christian Sievers wrote: [EMAIL PROTECTED] wrote: -- Here's the discrete version of Newton's method for finding -- the square root. Does it always work? Any literature? I recently used, without range check, sqrtInt n = help n where

Re: [Haskell-cafe] puzzle: prove this floorSqrt correct

2004-08-12 Thread Remi Turk
On Thu, Aug 12, 2004 at 09:01:03PM +0200, Henning Thielemann wrote: On Thu, 12 Aug 2004, Remi Turk wrote: I usually (each time I urgently need to calculate primes ;)) use a simple intSqrt = floor . sqrt . fromIntegral (which will indeed give wrong answers for big numbers) If I urgently

Re: GHCI/FFI/GMP/Me madness

2004-08-11 Thread Remi Turk
On Wed, Aug 11, 2004 at 02:27:19PM +0100, Simon Marlow wrote: On 10 August 2004 16:04, Remi Turk wrote: http://www.haskell.org/pipermail/glasgow-haskell-users/2004-June/006767.html Hmm yes, I now realise that it's not quite as easy as I implied in that message. The problem is the memory

Re: GHCI/FFI/GMP/Me madness

2004-08-10 Thread Remi Turk
On Tue, Aug 10, 2004 at 12:59:46PM +0100, Simon Marlow wrote: GHC's use of GMP does cause problems if you want to use GMP for your own purposes, or if you link with external code that wants to use GMP. The real problem is that GMP has internal state, which means it can't be used in a modular

Re: GHCI/FFI/GMP/Me madness

2004-08-10 Thread Remi Turk
On Tue, Aug 10, 2004 at 01:09:03PM +0100, Simon Marlow wrote: On 10 August 2004 13:03, MR K P SCHUPKE wrote: Re GMP, Why not provide more GMP functions as primitives on the Integer type, and avoid the need to call out to GMP via the FFI? Show us the code! :-p Or implement Integers via

GHCI/FFI/GMP/Me madness

2004-08-09 Thread Remi Turk
Hi all, I recently tried to create a ffi-binding to gmp in ghc, and failed miserably. After a few days of debugging, simplifying the code and tearing my hear out, I'm slightly completely stumped, and crying for help ;) In short: calling gmp-functions from GHCI *with a prompt between* them seems

Re: GHCI/FFI/GMP/Me madness

2004-08-09 Thread Remi Turk
On Sun, Aug 08, 2004 at 07:34:04AM -0700, Sigbjorn Finne wrote: Hi, please be aware that the RTS uses GMP as well, and upon initialisation it sets GMP's 'memory functions' to allocate memory from the RTS' heap. So, in the code below, the global variable 'p' will end up having components

  1   2   >