Re: [Haskell-cafe] ANN: generic-deepseq 1.0.0.0

2012-02-25 Thread Maxime Henrion
On Sat, 2012-02-25 at 11:38 +0100, José Pedro Magalhães wrote: 2012/2/25 Andres Löh andres.l...@googlemail.com Would you have an example of a type for which it would be useful to have a DeepSeq instance, and that would require a V1 instance? I cannot think

Re: [Haskell-cafe] ANN: generic-deepseq 1.0.0.0

2012-02-24 Thread Maxime Henrion
On Fri, 2012-02-24 at 07:49 +0100, Jos Pedro Magalhes wrote: Hi, 2012/2/23 Maxime Henrion mhenr...@gmail.com * Why do you have the instance: instance GDeepSeq V1 where grnf _ = () The only way to construct values of a void type

Re: [Haskell-cafe] ANN: generic-deepseq 1.0.0.0

2012-02-24 Thread Maxime Henrion
On Fri, 2012-02-24 at 09:32 +0100, Jos Pedro Magalhes wrote: 2012/2/24 Maxime Henrion mhenr...@gmail.com On Fri, 2012-02-24 at 07:49 +0100, Jos Pedro Magalhes wrote: Hi, 2012/2/23 Maxime Henrion mhenr...@gmail.com * Why do

Re: [Haskell-cafe] ANN: generic-deepseq 1.0.0.0

2012-02-24 Thread Maxime Henrion
On Fri, 2012-02-24 at 15:28 +0100, Andres Löh wrote: Hi. I don't understand what's going on here. Instances for V1 should of course be defined if they can be! And in this case, a V1 instance makes sense and should be defined. The definition itself doesn't matter, as it'll never be

Re: [Haskell-cafe] ANN: generic-deepseq 1.0.0.0

2012-02-24 Thread Maxime Henrion
On Thu, 2012-02-23 at 23:24 +0100, Bas van Dijk wrote: Some nitpicking: * In the instance: instance GDeepSeq U1 where grnf _ = () I think it makes sense to pattern match on the U1 constructor, as in: grnf U1 = (). I haven't checked if that's necessary but my fear is that assuming:

Re: [Haskell-cafe] ANN: generic-deepseq 1.0.0.0

2012-02-23 Thread Maxime Henrion
On Thu, 2012-02-23 at 23:24 +0100, Bas van Dijk wrote: On 23 February 2012 22:09, Maxime Henrion mhenr...@gmail.com wrote: On Sun, 2012-02-19 at 21:06 +0100, Bas van Dijk wrote: On 19 February 2012 18:11, Maxime Henrion mhenr...@gmail.com wrote: I'm guilty of not having preserved the rnf

Re: [Haskell-cafe] ANN: generic-deepseq 1.0.0.0

2012-02-23 Thread Maxime Henrion
On Thu, 2012-02-23 at 23:45 +0100, Maxime Henrion wrote: On Thu, 2012-02-23 at 23:24 +0100, Bas van Dijk wrote: * Why do you have the instance: instance GDeepSeq V1 where grnf _ = () The only way to construct values of a void type is using ⊥. And I would expect that rnf

[Haskell-cafe] ANN: generic-deepseq 1.0.0.0

2012-02-19 Thread Maxime Henrion
is an URL from a mirror where the package description documentation can be found: http://hackage.factisresearch.com/package/generic-deepseq-1.0.0.0 Any suggestions are welcome. Cheers, Maxime Henrion signature.asc Description: This is a digitally signed message part

Re: [Haskell-cafe] ANN: generic-deepseq 1.0.0.0

2012-02-19 Thread Maxime Henrion
On Sun, 2012-02-19 at 16:17 +0100, Bas van Dijk wrote: On 19 February 2012 13:12, Maxime Henrion mhenr...@gmail.com wrote: Any suggestions are welcome. Nice work but it would be nice to have this functionality directly in the deepseq package as in: #ifdef GENERICS {-# LANGUAGE

Re: [Haskell-cafe] ANN: generic-deepseq 1.0.0.0

2012-02-19 Thread Maxime Henrion
On Sun, 2012-02-19 at 21:06 +0100, Bas van Dijk wrote: On 19 February 2012 18:11, Maxime Henrion mhenr...@gmail.com wrote: If you're not dealing with an abstract datatype, you _shouldn't_ have an explicit instance, because it would be possible to write an incorrect one, while

[Haskell-cafe] DFAs and self-referential data

2010-12-26 Thread Maxime Henrion
Hello all, I've been playing with some code to work with DFAs, but I'm now faced with an implementation problem. In order to have states that can transition to themselves, it seems I would need self-referential data; otherwise I would need to separate those transitions from the rest and

Re: [Haskell-cafe] DFAs and self-referential data

2010-12-26 Thread Maxime Henrion
On Sun, 2010-12-26 at 13:58 +0200, Roman Cheplyaka wrote: * Maxime Henrion mhenr...@gmail.com [2010-12-26 12:01:31+0100] Anyone knows what I'm doing wrong here? I suspect my attempt at having self-referential data is somehow buggy; do I need to treat transitions to the same state

Re: [Haskell-cafe] DFAs and self-referential data

2010-12-26 Thread Maxime Henrion
On Sun, 2010-12-26 at 13:38 +0100, Maxime Henrion wrote: On Sun, 2010-12-26 at 13:58 +0200, Roman Cheplyaka wrote: * Maxime Henrion mhenr...@gmail.com [2010-12-26 12:01:31+0100] Anyone knows what I'm doing wrong here? I suspect my attempt at having self-referential data is somehow buggy

[Haskell-cafe] Defining a CPP macro when building documentation

2009-05-24 Thread Maxime Henrion
Hello all, I have been exposed to a problem that have happened to others too, and since I have found a (scary) solution with the help of Duncan Coutts, I'm now sharing it with you. The reason I wanted to pass specific CPP flags to haddock was to allow the documentation of the full

[Haskell-cafe] ANN: bsd-sysctl 1.0.3

2009-05-24 Thread Maxime Henrion
I'm pleased to announce the release of bsd-sysctl 1.0.3, a package that provides a System.BSD.Sysctl module allowing access to the C sysctl(3) API. It should fully work on FreeBSD, NetBSD and Mac OS X platforms; it should also work on OpenBSD and Linux, although looking up sysctl's by name isn't

[Haskell-cafe] Fast mutable arrays of ByteString?

2009-04-15 Thread Maxime Henrion
expectations. Thanks in advance, Maxime Henrion {-# LANGUAGE BangPatterns #-} module Main where import Control.Monad import Control.Monad.ST import Data.Array.ST import Data.ByteString.Char8 (ByteString) import qualified Data.ByteString.Char8 as S import Data.Maybe import System.Console.GetOpt

[Haskell-cafe] Space leak with Data.Binary and decodeFile

2009-01-11 Thread Maxime Henrion
. If there's anything else that I can do to understand what's going on, I would gladfully hear about it. Please also tell me if I should provide more information. Thanks, -- Maxime Henrion ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http

Re: [Haskell-cafe] Why functional programming matters

2008-01-23 Thread Maxime Henrion
Simon Peyton-Jones wrote: Friends Over the next few months I'm giving two or three talks to groups of *non* functional programmers about why functional programming is interesting and important. If you like, it's the same general goal as John Hughes's famous paper Why functional

Re: [Haskell-cafe] freebsd-7.0BETA1 and ghc

2007-10-25 Thread Maxime Henrion
brad clawsie wrote: On Wed, Oct 24, 2007 at 06:14:49PM -0400, Xiao-Yong Jin wrote: Is there any hope for it to be fixed before the freeze of ports tree? i believe that is the purpose of the extended beta/rc period, to allow ports maintainers a chance to get things fixed before the main

[Haskell-cafe] wordsBy in the base libraries?

2007-10-22 Thread Maxime Henrion
Hello all, What do you think about having a wordsBy function in the standard libraries? It often comes in handy. wordsBy :: (a - Bool) - [a] - [[a]] wordsBy p s = case dropWhile p s of [] - [] ':rest - (s':w) : wordsBy p s'' where (w, s'') = break p rest This version

Re: [Haskell-cafe] wordsBy in the base libraries?

2007-10-22 Thread Maxime Henrion
This got a bit mangled, here's the fixed version: wordsBy :: (a - Bool) - [a] - [[a]] wordsBy p s = case dropWhile p s of [] - [] s':rest - (s':w) : wordsBy p s'' where (w, s'') = break p rest ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] wordsBy in the base libraries?

2007-10-22 Thread Maxime Henrion
Jules Bean wrote: Maxime Henrion wrote: Hello all, What do you think about having a wordsBy function in the standard libraries? It often comes in handy. I speculate (but don't know) that the reason we don't have one is that there are quite a few choices to make: * delimiter

Re: [Haskell-cafe] more functions to evaluate

2007-10-12 Thread Maxime Henrion
Isaac Dupree wrote: Dan Weston wrote: applyNtimes :: (a - a) - Int - a - a This sounds like it should be in the library somewhere agree, I've used it a few times (mostly for testing things) - modulo argument order and Int vs. Integer vs. (Num a = a) What do you think about calling it

Re: [Haskell-cafe] more functions to evaluate

2007-10-12 Thread Maxime Henrion
Dan Weston wrote: I like that name, and will henceforth use it myself until someone sees fit to add it to the Prelude! Oh, and I guess we'd also need: genericIterateN :: (a - a) - Integer - a - a Which also got me thinking, wouldn't it make more sense to have the count as the first

Re: [Haskell-cafe] more functions to evaluate

2007-10-12 Thread Maxime Henrion
Maxime Henrion wrote: Dan Weston wrote: I like that name, and will henceforth use it myself until someone sees fit to add it to the Prelude! Oh, and I guess we'd also need: genericIterateN :: (a - a) - Integer - a - a Which also got me thinking, wouldn't it make more sense to have

[Haskell-cafe] Re: Haskell FFI and finalizers

2007-10-09 Thread Maxime Henrion
Simon Marlow wrote: Maxime Henrion wrote: Stefan O'Rear wrote: On Thu, Oct 04, 2007 at 12:55:41AM +0200, Maxime Henrion wrote: When writing the binding for foo_new(), I need to open a file with fopen() to pass it the FILE *. Then I get a struct foo * that I can easily associate

Re: [Haskell-cafe] Haskell FFI and finalizers

2007-10-04 Thread Maxime Henrion
Stefan O'Rear wrote: On Thu, Oct 04, 2007 at 12:55:41AM +0200, Maxime Henrion wrote: When writing the binding for foo_new(), I need to open a file with fopen() to pass it the FILE *. Then I get a struct foo * that I can easily associate the the foo_destroy() finalizer. However, when

[Haskell-cafe] Haskell FFI and finalizers

2007-10-03 Thread Maxime Henrion
Hello all, I have recently developed a small set of bindings for a C library, and encountered a problem that I think could be interesting to others. My problem was that the C function I was writing bindings to expects to be passed a FILE *. So, I had basically two possibles routes to

Re: [Haskell-cafe] Haskell FFI and finalizers

2007-10-03 Thread Maxime Henrion
Stefan O'Rear wrote: On Wed, Oct 03, 2007 at 05:57:58PM +0200, Maxime Henrion wrote: I have recently developed a small set of bindings for a C library, and encountered a problem that I think could be interesting to others. My problem was that the C function I was writing bindings

Re: [Haskell-cafe] standard function

2007-06-06 Thread Maxime Henrion
Steffen Mazanek wrote: Hello, is there a function f::[a-b]-a-[b] in the libraries? Couldn't find one using hoogle although this seems to be quite a common thing... As far as I know, there is no standard function doing that, though it is easily implemented: mapApply xs x = map ($ x) xs or

Re: How to create a GHC binary bundle?

2007-05-30 Thread Maxime Henrion
Ian Lynagh wrote: Hi Maxime, On Sun, May 27, 2007 at 03:58:47AM +0200, Maxime Henrion wrote: To be more precise, I want to know how to create the ghc-$version-$arch-boot.tar.bz2 file to redistribute to users so that they can build GHC easily, and that on a platform that already

How to create a GHC binary bundle?

2007-05-26 Thread Maxime Henrion
Hello all, I've been trying to find documentation on how to create GHC binary bundles myself without success so far. I've been browsing the GHC website and found documents on how to handle various situations such as porting GHC to an unsupported platform, or how to build GHC from a

[Haskell-cafe] GHC 6.7 and Associated Types

2007-04-17 Thread Maxime Henrion
Hello guys, I've been documenting myself on associated types, which look like a very nice way to deal with the problems that arise with multi-parameter type classes. As an exercise, I am trying to rewrite the MonadState type class from the mtl package without functional dependencies.

Re: [Haskell-cafe] Re: GHC 6.7 and Associated Types

2007-04-17 Thread Maxime Henrion
apfelmus wrote: Maxime Henrion wrote: class MonadState m where type StateType m :: * get :: m StateType put :: m StateType - m () As for instances: instance MonadState (State s) where type StateType = s -- this is line 22

Re: [Haskell-cafe] Re: GHC 6.7 and Associated Types

2007-04-17 Thread Maxime Henrion
Simon Peyton-Jones wrote: Associated *data* types should work in the HEAD (=6.7). But associated *type synonyms* do not, I'm afraid. We are actively working on it, but it'll be a couple of months at least I guess. You can see the state of play, and description of where we are up to here

Re: [Haskell-cafe] Re: GHC 6.7 and Associated Types

2007-04-17 Thread Maxime Henrion
apfelmus wrote: Maxime Henrion wrote: apfelmus wrote: Maxime Henrion wrote: class MonadState m where type StateType m :: * get :: m StateType put :: m StateType - m () As for instances: instance MonadState (State s) where type StateType = s

Re: [Haskell-cafe] A convenient way to deal with conditional function composition?

2007-04-11 Thread Maxime Henrion
Chris Kuklewicz wrote: Nicolas Frisby wrote: Not portably. [EMAIL PROTECTED]:~$ ghc-6.4.2 -e '( (foo++) `Data.Monoid.mappend` (bar++) ) END' foobarEND [EMAIL PROTECTED]:~$ ghc-6.6 -e '( (foo++) `Data.Monoid.mappend` (bar++) ) END' fooENDbarEND -- 6.6 sources instance

[Haskell-cafe] A convenient way to deal with conditional function composition?

2007-04-10 Thread Maxime Henrion
Hello all, I have found myself writing instances of Show for some types of mine, and I did so by defining the showsPrec function, for performance reasons. I ended up with code that I find quite inelegant. Here's an example: data Move = Move { movePiece ::

Re: [Haskell-cafe] Re: [Haskell] Haskell Chess

2007-03-19 Thread Maxime Henrion
Steffen Mazanek wrote: Hello again, first of all, thank you Don for your help in making hsChess accessible. I have to have a look at darcs and cabal first :-) I have added some more content and a discussion page to the wiki, please contribute your thoughts. Furthermore I added a link

Re: [Haskell-cafe] Re: [Haskell] Haskell Chess

2007-03-19 Thread Maxime Henrion
this will be an interesting project. I look forward to it! Andrew On 3/19/07, Duncan Coutts [EMAIL PROTECTED] wrote: On Mon, 2007-03-19 at 12:14 +0100, Maxime Henrion wrote: I stepped onto your mail and found it particularly interesting since I'm currently writing a chess client in Haskell, using

[Haskell-cafe] A valuable new combinator for Parsec?

2007-03-12 Thread Maxime Henrion
Hello all, While using the very nice option combinator of Parsec recently, it seemed to me that it would be useful to have a more specific kind of combinator for optional tokens that wraps the token into a Maybe type. So, that gives: pmaybe :: GenParser tok st a - GenParser tok st

Re: [Haskell-cafe] how to calculate the sum of list of lists?

2007-02-05 Thread Maxime Henrion
Miranda Kajtazi wrote: Help, How to calculate the sum of list of lists in Haskell? Do you mean something of the form Num a = [[a]] - a ? If so, this should do it: Prelude let foo = sum . concat Prelude foo [[1,2,3],[4,5]] 15 Cheers, Maxime ___