Re: [Haskell-cafe] lazy boxed array and builder?

2012-07-12 Thread Yves Parès
I remember this discussion, lazy vectors would also enable an implementation of bytestring and (maybe) text only with unboxed vectors, unifying it all: type ByteString = Vector Word8 2012/7/12 Evan Laforge qdun...@gmail.com he recent discussion of whether storablevector should be deprecated in

[Haskell-cafe] Cabal problem re. haskelldb-hdbc-mysql

2012-07-05 Thread Yves Parès
Hi, the package http://hackage.haskell.org/package/haskelldb-hdbc-mysql/ the use of HDBC 2.3.0 I'm using cabal-install 0.14, and with a fresh install (no packages already installed), cabal-install tries to install HDBC-2.1.1 instead of, say, HDBC-2.2.7.0. The problem is that HDBC-2.1.1 is old

Re: [Haskell-cafe] Martin Odersky on What's wrong with Monads

2012-06-27 Thread Yves Parès
I'm not happy with any of these options. Why are you unhappy with the ImplicitParams option? It's pretty much like resorting to a newtype, as it's been suggested before. 2012/6/27 Tillmann Rendel ren...@informatik.uni-marburg.de Hi Rico, Rico Moorman wrote: data Tree = Leaf Integer |

Re: [Haskell-cafe] Martin Odersky on What's wrong with Monads

2012-06-24 Thread Yves Parès
To move between functional and monadic code you have to completely rewrite the code procedurally I don't like the way people segregate pure from monadic. Monadic code *is* pure: it's written with completely pure Haskell and completely pure combinators. As Alexander said, it's really important to

Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?

2012-06-13 Thread Yves Parès
Mmmmh... no, to do that you need ImpredicativeTypes (which is I believe about to be deprecated). You have to declare Job a data, not a type, and use ExistentialQuantification. 2012/6/13 Ismael Figueroa Palet ifiguer...@gmail.com Do you want to hide the specific types of the job? Presumably to

Re: [Haskell-cafe] I don't understand how ST works

2012-06-09 Thread Yves Parès
Oh my god, that was it? I looked at your code for half an hour, and I've never thought about that... That is really misleading. So vector forces you to use strict ST? (That's right: http://hackage.haskell.org/packages/archive/primitive/0.4.1/doc/html/Control-Monad-Primitive.html#t:PrimMonadshows

Re: [Haskell-cafe] Using promoted lists

2012-06-08 Thread Yves Parès
not either ) So I guess we don't have type-level integers for now. How are promoted Ints usable then? [1] http://hackage.haskell.org/trac/ghc/wiki/NewAxiomshttp://hackage.haskell.org/trac/ghc/wiki/NewAxioms 2012/6/8 AntC anthony_clay...@clear.net.nz Yves Parès yves.pares at gmail.com writes

[Haskell-cafe] Using promoted lists

2012-06-07 Thread Yves Parès
The doc page http://www.haskell.org/ghc/docs/7.4.1/html/users_guide/kind-polymorphism-and-promotion.html#promotionshow that lists are now usable as types. So I'm trying to make a type level function to test if a type list contains a type. Unless I'm wrong, that calls to the use of a type family.

[Haskell-cafe] Tests by properties: origin?

2012-06-01 Thread Yves Parès
Out of curiosity, does someone know if QuickCheck was the first test framework working through test by properties associated with random generation or if it drew the idea from something else? Because the idea has be retaken by a lot of frameworks in several languages (see

Re: [Haskell-cafe] Tests by properties: origin?

2012-06-01 Thread Yves Parès
Yes ^^ but I can't find this paper, Koen Claessen website doesn't mention it and the link on the page http://www.haskell.org/haskellwiki/Introduction_to_QuickCheck is dead. 2012/6/1 Janis Voigtländer j...@informatik.uni-bonn.de Am 01.06.2012 12:00, schrieb Yves: Out of curiosity, does someone

Re: [Haskell-cafe] Tests by properties: origin?

2012-06-01 Thread Yves Parès
, Yves Parès yves.pa...@gmail.com wrote: Yes ^^ but I can't find this paper, Koen Claessen website doesn't mention it and the link on the page http://www.haskell.org/haskellwiki/Introduction_to_QuickCheck is dead. 2012/6/1 Janis Voigtländer j...@informatik.uni-bonn.de Am 01.06.2012 12

Re: [Haskell-cafe] Requesting Feedback: I Love Haskell, but can't find a place to use it

2012-06-01 Thread Yves Parès
Then I wrote about a dozen lines of Haskell to do the job--and running time turned out to be O(n^2). Do you still have the code? 2012/6/1 Doug McIlroy d...@cs.dartmouth.edu I love Haskell. It is my absolute favorite language. But I have a very hard time finding places where I can

Re: [Haskell-cafe] Building pattern and trying monads

2012-05-28 Thread Yves Parès
observe $ flip runStateT 10 $ (put 0 mzero) | modify (+3) ((),13) If the only thing you need is backtracking, using LogicT might be a little overkill, using Maybe in the bottom of you monad stack suits just fine: case flip runStateT 10 $ (put 0 mzero) | modify (+3) of Just x -

Re: [Haskell-cafe] Building pattern and trying monads

2012-05-28 Thread Yves Parès
Actually, I think the backtracking property here stems more from the MonadPlus StateT instance than from the properties of Maybe. (mplus a b runs a and b by passing explicitely the same state to them). 2012/5/28 Roman Cheplyaka r...@ro-che.info * Yves Parès yves.pa...@gmail.com [2012-05-28 11

Re: [Haskell-cafe] Record syntax, reopening a can of worms.

2012-05-27 Thread Yves Parès
case myData of myA@A{} - fooForA's myA myB@B{} - fooForB's myB I think this would typecheck if you used GADTs. Actually what you'd want is to use the record syntax with GADTs (there are to add the extra type safety you want), however both are not compatible. data ALike data BLike data

Re: [Haskell-cafe] Record syntax, reopening a can of worms.

2012-05-27 Thread Yves Parès
I enclosed a source file that shows the use of a GADT in that case. 2012/5/27 timothyho...@seznam.cz Somehow I don't understand you. Could you please fill out your example into a working bit of code? Thank you, Timothy -- Původní zpráva -- Od: Yves Parès limestr

Re: [Haskell-cafe] Formalisation for types of monads

2012-05-24 Thread Yves Parès
On Wed, May 23, 2012 at 09:24:06AM +0200, Ertugrul Söylemez wrote: Yves Parès yves.pa...@gmail.com wrote: Note about []: Don't even mention foldl. The folding combinator for lists is foldr, period. Yes, I do agree. I came to this when I realized foldr gave the church

Re: [Haskell-cafe] Formalisation for types of monads

2012-05-23 Thread Yves Parès
Note about []: Don't even mention foldl. The folding combinator for lists is foldr, period. Yes, I do agree. I came to this when I realized foldr gave the church encoding of a list. (Well, actually, due to parameters ordering: *churchList list* z0 f = foldr f z0 list does)

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-23 Thread Yves Parès
of numbers do developers work with more often? Regular Ints and Doubles or Peano lazy numbers?) 2012/5/23 wren ng thornton w...@freegeek.org On 5/21/12 10:51 AM, Yves Parès wrote: I do think we have the opposite problem, however, in much Haskell code -- people are using the clean, obviously

[Haskell-cafe] Formalisation for types of monads

2012-05-21 Thread Yves Parès
When explaining monads to beginners (having an imperative background), I found myself to say that there is *roughly* three groups of monads (because they're always worried about their cost, i.e. their incidental complexity): - Function-oriented monads (e.g. State, Reader, Cont) - Reductible

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-21 Thread Yves Parès
I do think we have the opposite problem, however, in much Haskell code -- people are using the clean, obviously correct, but inefficient code even in standard library functions that really should be optimized like crazy! And even before optimizing like crazy, I think the functions that are more

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-21 Thread Yves Parès
Not necessarily. For example the 'nub' function from Data.List could be much faster. Unfortunately this would also change its type. O(n²) complexity is really the best you can get with the Eq constraint. Why not in that kind of cases provide a second function (named differently), together

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-21 Thread Yves Parès
If you are writing a program or system that has significant performance requirements, you might just be better off doing the whole thing in C/C++ and living with the annoyance of doing GUIs I fail to see how the GUI part would suffer from lack of performance if the rest of the system is fine. I

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-16 Thread Yves Parès
On the one hand, characterizing those who desire the best performance possible as simple-minded is, at best, a gross over-generalization. Like you, I work in a field where optimization is king (e.g., in machine translation, program runtimes are measured in days). You misread the logical

[Haskell-cafe] Can't prevent memoizing in simple code

2012-05-16 Thread Yves Parès
The buffer http://hpaste.org/68595 presents a simple code I tried to profile. I spotted what I strongly think to be an abusive memoization. The problem is that I don't see how to (simply) get rid of it. Compiled with -O2, it consumes 130MB of memory, however lines A and B executed separately

Re: [Haskell-cafe] Can't prevent memoizing in simple code

2012-05-16 Thread Yves Parès
and list2 (I expected list1 to get 100% and list2 0%, due to sharing). Strange... 2012/5/16 Anthony Cowley acow...@gmail.com On May 16, 2012, at 12:08 PM, Yves Parès wrote: The buffer http://hpaste.org/68595 presents a simple code I tried to profile. I spotted what I strongly think

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-16 Thread Yves Parès
The profiler is certainly useful (and much better with GHC 7.4) What are the improvements in that matter? (I just noticed that some GHC flags wrt profiling have been renamed) 2012/5/16 Ben Gamari bgamari.f...@gmail.com Kevin Charter kchar...@gmail.com writes: snip For example, imagine

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-15 Thread Yves Parès
Yet this resource seems a little outdated: http://www.haskell.org/haskellwiki/Performance/Strings does not speak about Text http://www.haskell.org/haskellwiki/Performance/Arrays about Vector And what's the status of the Streams IO approach detailed in

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-08 Thread Yves Parès
One thing that baffles me is the comparison Haskell V. Java: http://shootout.alioth.debian.org/u32/benchmark.php?test=alllang=ghclang2=java Would've expected always shorter code and better performances on average. 2012/5/8 Silvio Frischknecht silvio.fris...@gmail.com -BEGIN PGP SIGNED

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-06 Thread Yves Parès
I do not agree: the fib function is tail-recursive, any good C compiler is able to optimize away the calls and reduce it to a mere loop. At least that's what I learnt about tail recursion in C with GCC. 2012/5/6 Artur apeka1...@gmail.com On 06.05.2012 10:44, Ivan Lazar Miljenovic wrote: On 6

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-06 Thread Yves Parès
. * Yves Parès yves.pa...@gmail.com [2012-05-06 10:58:45+0200] I do not agree: the fib function is tail-recursive, any good C compiler is able to optimize away the calls and reduce it to a mere loop. At least that's what I learnt about tail recursion in C with GCC. 2012/5/6 Artur apeka1

Re: [Haskell-cafe] Haskell and arrays

2012-05-05 Thread Yves Parès
Well actually, unless you _really_ need paramterizable indexes (i.e. not only Ints) I don't see reasons to prefer array to vector now. 2012/5/4 Johan Tibell johan.tib...@gmail.com Hi Morten, If speed is really important I would go with the vector package. It has a more modern API and better

Re: [Haskell-cafe] Problem with forall type in type declaration

2012-05-04 Thread Yves Parès
run :: Monad IO a - IO a Actually this type is wrong. Monad has to appear as a class constraint, for instance : run :: Monad m = m a - IO a Are you trying to make: run :: IO a - IO a ?? 2012/5/4 Magicloud Magiclouds magicloud.magiclo...@gmail.com Hi, Assuming this: run :: Monad IO a - IO

Re: [Haskell-cafe] ANN: HandsomeSoup-0.3: CSS selectors for HXT

2012-04-27 Thread Yves Parès
Why do you make your own overlay to download files via HTTP? HXT has backends (hxt-http or hxt-curl) to do that. Le 27 avril 2012 04:16, aditya bhargava bluemangrou...@gmail.com a écrit : *Homepage:* http://egonschiele.github.com/HandsomeSoup *On Hackage:*

Re: [Haskell-cafe] building ghc on arch linux ARM?

2012-04-11 Thread Yves Parès
So is this possible now to have a desktop PC compile your program using template haskell into llvm bytecode and then run it on ARM? If not, is it definitely impossible (as I said, I don't know much about llvm) or is it yet to be done? Le 10 avril 2012 19:03, Joey Hess j...@kitenet.net a écrit :

Re: [Haskell-cafe] building ghc on arch linux ARM?

2012-04-10 Thread Yves Parès
Other than speed, it's fine. Do we know what speed issues are due to? Plus, I believed some had used GHC for smartphones? Le 9 avril 2012 01:45, Joey Hess j...@kitenet.net a écrit : Thomas DuBuisson wrote: On Sun, Apr 8, 2012 at 4:03 PM, Francesco Mazzoli f...@mazzo.li wrote: No, it is

Re: [Haskell-cafe] building ghc on arch linux ARM?

2012-04-10 Thread Yves Parès
, which means GHC can be compiled for ARM. Le 10 avril 2012 12:27, Joachim Breitner m...@joachim-breitner.de a écrit : Hi, Am Dienstag, den 10.04.2012, 11:00 +0200 schrieb Yves Parès: Plus, I believed some had used GHC for smartphones? do you refer to http://www.joachim-breitner.de/blog

Re: [Haskell-cafe] building ghc on arch linux ARM?

2012-04-10 Thread Yves Parès
+0200 schrieb Yves Parès: For instance, yes. I think I had seen some times on this mailing list or on blog posts (http://ghcarm.wordpress.com/) people having used GHC on ARM platform. I distinctly remember having seen on the mailing list that cross-compiling wasn't working but that we now

Re: [Haskell-cafe] building ghc on arch linux ARM?

2012-04-10 Thread Yves Parès
Breitner m...@joachim-breitner.de a écrit : Hi, Am Dienstag, den 10.04.2012, 13:04 +0200 schrieb Yves Parès: All these are not cross-compiled, but natively compiled on the repective architecture, and I don’t think it is easily possible to cross-compile GHC itself even today. So how

Re: [Haskell-cafe] Generalizing (++) for monoids instead of using ()

2012-04-02 Thread Yves Parès
Plus one might argue that using to mean different is a bad choice, as it graphically means strictly inferior or strictly superior which implies comparability, whereas equality and comparison are two different things. (e.g. Eq and Ord are two distinct classes in Haskell). Le 1 avril 2012 23:06,

Re: [Haskell-cafe] Towards a single, unified API for incremental data processing

2012-04-02 Thread Yves Parès
That would be a great idea... too bad it's an April hoax ;) Le 1 avril 2012 21:50, John Millikin jmilli...@gmail.com a écrit : There are currently several APIs for processing strict monoidal values as if they were pieces of a larger, lazy value. Some of the most popular are based on Oleg's

Re: [Haskell-cafe] for = flip map

2012-03-28 Thread Yves Parès
Think of traverse as a mapA, as it's just like Data.Traversable.mapM, but with the Applicative class constraint instead of the Monad one. I've always wondered why it isn't called this way, sequenceM equivalent for Applicatives is sequenceA for instance. Le 28 mars 2012 22:19, Christopher Done

Re: [Haskell-cafe] Can't install snap (problem with syb)

2012-03-28 Thread Yves Parès
It may come from the version of GHC you're using (Cabal version is fixed for one specific GHC version). Which one is it? Le 28 mars 2012 23:05, Michael Iles michael.i...@ca.ibm.com a écrit : I uninstalled ghc, removed my ~/.cabal directory, reinstalled ghc, then tried to install snap. I get:

[Haskell-cafe] Arguments against an hypothetical Data.ByteString.Generic?

2012-03-27 Thread Yves Parès
Hello, As vector provides a class generalizing all flavours (Data.Vector.Generic.Vector), it occurs to me that the same could be done for ByteString. Then, packages based on it would have the choice between hardcoded and generic, they wouldn't have to duplicate a module to handle both strict and

Re: [Haskell-cafe] Arguments against an hypothetical Data.ByteString.Generic?

2012-03-27 Thread Yves Parès
27 mars 2012 20:38, Bas van Dijk v.dijk@gmail.com a écrit : On 27 March 2012 11:00, Yves Parès yves.pa...@gmail.com wrote: Hello, As vector provides a class generalizing all flavours (Data.Vector.Generic.Vector), it occurs to me that the same could be done for ByteString

Re: [Haskell-cafe] Arguments against an hypothetical Data.ByteString.Generic?

2012-03-27 Thread Yves Parès
Oh, okay ^^ sorry, my bad. I should have compiled with -Wall. So I started a repo at https://github.com/YwenP/bytestring-generic Le 27 mars 2012 22:01, Bas van Dijk v.dijk@gmail.com a écrit : On 27 March 2012 21:46, Yves Parès yves.pa...@gmail.com wrote: Yes, thank you to remind me

Re: [Haskell-cafe] Using HaXml

2012-03-26 Thread Yves Parès
, Yves Parès yves.pa...@gmail.com wrote: Hello café, Provided what I read, HaXml seems to be the recommended library for parsing XML files (I'm trying to browse and alter spreadsheets (ODS) and possibly release a package when I'm done), is there somewhere tutorials on how to use it? I used 'xml

[Haskell-cafe] Using HaXml

2012-03-25 Thread Yves Parès
Hello café, Provided what I read, HaXml seems to be the recommended library for parsing XML files (I'm trying to browse and alter spreadsheets (ODS) and possibly release a package when I'm done), is there somewhere tutorials on how to use it? I used 'xml' package by the past, but HaXml is more

Re: [Haskell-cafe] Open-source projects for beginning Haskell students?

2012-03-23 Thread Yves Parès
Plus yampa hasn't been maintained for more than 3 years, and I lacks documentation, which makes it a bad choice for beginners. I don't even know what is the future of that project... Le 23 mars 2012 09:22, Heinrich Apfelmus apfel...@quantentunnel.de a écrit : erik flister wrote: giving a

Re: [Haskell-cafe] Regarding Haskell FFI for C/C++ (Passing of String)

2012-03-22 Thread Yves Parès
This joins the question I asked two days ago here. (See http://haskell.1045720.n5.nabble.com/Quickest-way-to-pass-Text-to-C-code-td5582223.html ) Hope that helps. Le 22 mars 2012 15:10, rajendra prasad rajendradpra...@gmail.com a écrit : Hi, I have just started learning Haskell FFI. I am

Re: [Haskell-cafe] Regarding Haskell FFI for C/C++ (Passing of String)

2012-03-22 Thread Yves Parès
and pack function from Data.ByteString(.Lazy). And if you want to convert your String directly to a CString (a Ptr CChar) you better use Foreign.C.String.withCString. Le 22 mars 2012 15:17, Yves Parès yves.pa...@gmail.com a écrit : This joins the question I asked two days ago here. (See http

[Haskell-cafe] Quickest way to pass Text to C code

2012-03-21 Thread Yves Parès
Hello, I have to interact with a C++ library that accepts as string types (putting c++ strings aside) pointers of wchar_t (CWString in Haskell) or unsigned 32-bit int (Ptr Word32 for UTF-32 codepoints). I have read what text, bytestring and base provide, but Text can only be directly converted

Re: [Haskell-cafe] Quickest way to pass Text to C code

2012-03-21 Thread Yves Parès
Text into Vector? Le 21 mars 2012 12:35, James Cook mo...@deepbondi.net a écrit : On Mar 21, 2012, at 4:35 AM, Yves Parès wrote: Hello, I have to interact with a C++ library that accepts as string types (putting c++ strings aside) pointers of wchar_t (CWString in Haskell) or unsigned 32

Re: [Haskell-cafe] Quickest way to pass Text to C code

2012-03-21 Thread Yves Parès
) As the function passed copies or at least does not store the pointer, I can use unsafeUseAsCString, but then I have to manually append the null-termination. Le 21 mars 2012 13:09, Antoine Latter aslat...@gmail.com a écrit : On Wed, Mar 21, 2012 at 3:35 AM, Yves Parès yves.pa...@gmail.com wrote: Hello

Re: [Haskell-cafe] Is there a better way to subtyping?

2012-03-14 Thread Yves Parès
I might have a simpler way: make you base type polymorphic and add capabilities to it thanks to that type: data Base a = Base Foo Bar a data Capa1 a = Capa1 Stuff Baz a -- We leave the 'a' so that you can continue to stack. data Capa2 = Capa2 Thing Stuff -- We want it to be final, so no

Re: [Haskell-cafe] Helper classes for Generics

2012-03-12 Thread Yves Parès
I'd have a question concerning GHC.Generics: how does it relate to SYB's Data.Generics? Is it intended to replace it or complete it? In other words: does class Data.Generics.Data class do things that class GHC.Generics.Generic can't do? Le 12 mars 2012 04:27, Reiner Pope reiner.p...@gmail.com a

Re: [Haskell-cafe] Helper classes for Generics

2012-03-12 Thread Yves Parès
to replace SYB. Cheers, Pedro [1] http://www.haskell.org/haskellwiki/Generics [2] http://www.cs.uu.nl/wiki/bin/view/GenericProgramming/SYB On Mon, Mar 12, 2012 at 16:35, Yves Parès yves.pa...@gmail.com wrote: I'd have a question concerning GHC.Generics: how does it relate to SYB's

Re: [Haskell-cafe] Understanding GC time

2012-03-10 Thread Yves Parès
I'm afraid without uniqueness or linear typing it would be hard to avoid. 2012/3/10 Thiago Negri evoh...@gmail.com I see. Thanks for the answers. Any data structure or source annotation that would prevent that? For example, if I try the same program to run on a [1..] list,

Re: [Haskell-cafe] Understanding GC time

2012-03-10 Thread Yves Parès
time you need to access it). But I can't think of a way to check that property (list never accessed twice) statically in Haskell. [*] But wouldn't GHC do in that specific case do something about that with -O2 activated? 2012/3/10 Yves Parès yves.pa...@gmail.com I'm afraid without uniqueness

Re: [Haskell-cafe] Type classes for converting to Text and String

2012-03-08 Thread Yves Parès
If you just need to go back and forth from String to Text, why do you need to be generic? pack and unpack from Data.Text do the job. Plus, in the way of what Christopher said, you can use the OverloadedStrings extension. You can then use the string syntax at a place that expects a text: {-#

Re: [Haskell-cafe] GHCi fails to load C++ object files (missing symbol)

2012-03-08 Thread Yves Parès
Thanks Mark! It works also here, and even without the -fpic flag. Was it necessary for you? 2012/3/8 Mark Wright markwri...@internode.on.net Hi Yves, It works (on Gentoo) when I compile it as a shared library. % g++ -o libstuff.so -fpic -shared Stuff.cpp % ghci Main.hs -L$PWD -lstuff

[Haskell-cafe] GHCi fails to load C++ object files (missing symbol)

2012-03-07 Thread Yves Parès
Hi, I'm trying to have GHCi load a haskell file that depends on a C++ object file, which causes GHCi to fail because of an unknown symbol (*and I did link with **libstdc++*), whereas the link into an executable with ghc works and runs perfectly. I've reduced my code to the smallest one that

Re: [Haskell-cafe] GHCi fails to load C++ object files (missing symbol)

2012-03-07 Thread Yves Parès
Sorry for the double post, but I forgot to mention I'm using GHC 7.4 and gcc/libstdc++ 4.5.2. (Running Ubuntu 11.04 Natty Narwhal). 2012/3/7 Yves Parès yves.pa...@gmail.com Hi, I'm trying to have GHCi load a haskell file that depends on a C++ object file, which causes GHCi to fail because

Re: [Haskell-cafe] Haskell showcase in 5 minutes

2012-02-29 Thread Yves Parès
Yes, but in 5 minutes I take it they won't have time to ask questions before your presentation is over. I haven't thought about parallel computing but it's one of the many assets of the language. The problem IMHO with STM is that it relies on too many Haskell elements to be grasped in 5 minutes.

Re: [Haskell-cafe] Haskell showcase in 5 minutes

2012-02-28 Thread Yves Parès
Where exactly does that event take place? Is it open to public? And I strongly disadvise fibonacci, quicksort and other mind-blowing reality-escapist stuff. Show something real world and practical. 2012/2/27 Arnaud Bailly arnaud.oq...@gmail.com Hello Cafe, I will be (re)presenting Haskell in

Re: [Haskell-cafe] Haskell showcase in 5 minutes

2012-02-28 Thread Yves Parès
Nevermind, I think I found: http://jduchess.org/duchess-france/blog/battle-language-a-la-marmite/ You could try the JSON parser exercise. ( https://github.com/revence27/JSON-hs) Or anything else with Parsec, it's a pretty good power-showing library. 2012/2/28 Yves Parès yves.pa...@gmail.com

Re: [Haskell-cafe] Vim plugin for ghc-mod

2012-02-28 Thread Yves Parès
Hi, I downloaded those vim extensions, and I just wonder how I could have done before syntastic ;) Is there a vim plugin useful for runtime (putting breakpoints, seeing if an expression has been evaluated or if it's still a thunk?) I believe it exists for emacs. 2012/2/16 Nicolas Wu

[Haskell-cafe] FFI: Overhead of foreign unsafe imports

2012-02-26 Thread Yves Parès
Hello, When I was using C code from Python, the overhead put on calling C code by Python was significant. To simplify, say I have on C-side two procedures f and g, I do all the stuff to call them in a row from Python, well I'm better off factorizing: adding on C side a wrapper h procedure that

Re: [Haskell-cafe] Clarifying a mis-understanding about regions (and iteratees)

2012-02-23 Thread Yves Parès
Hi, so there are different regions libraries? Is there a shootout comparing them, possibly also with ResourceT from conduit (which has also been implemented in a stand-alone package http://hackage.haskell.org/package/resource-simple-0.1 by Robin Banks), for I take it it tries to respond to the

[Haskell-cafe] Stable pointers: use of cast to/from Ptr

2012-02-12 Thread Yves Parès
Hello, According to the documentation ( http://hackage.haskell.org/packages/archive/base/4.5.0.0/doc/html/Foreign-StablePtr.html), StablePtrs aims at being opaque on C-side. But they provide functions to be casted to/from regular *void**'s. Does that mean if for instance you have a StablePtr CInt

Re: [Haskell-cafe] Stable pointers: use of cast to/from Ptr

2012-02-12 Thread Yves Parès
Antoine Latter aslat...@gmail.com On Sun, Feb 12, 2012 at 8:18 AM, Yves Parès yves.pa...@gmail.com wrote: Hello, According to the documentation ( http://hackage.haskell.org/packages/archive/base/4.5.0.0/doc/html/Foreign-StablePtr.html ), StablePtrs aims at being opaque on C-side

Re: [Haskell-cafe] Stable pointers: use of cast to/from Ptr

2012-02-12 Thread Yves Parès
limits their interest, doesn't it? 2012/2/12 Albert Y. C. Lai tre...@vex.net On 12-02-12 09:18 AM, Yves Parès wrote: According to the documentation (http://hackage.haskell.org/**packages/archive/base/4.5.0.0/** doc/html/Foreign-StablePtr.**htmlhttp://hackage.haskell.org/packages/archive/base

Re: [Haskell-cafe] Stable pointers: use of cast to/from Ptr

2012-02-12 Thread Yves Parès
2012/2/12 Antoine Latter aslat...@gmail.com On Sun, Feb 12, 2012 at 3:09 PM, Yves Parès yves.pa...@gmail.com wrote: But then, In use case 1), how can a Haskell function modify the data addressed? http://hackage.haskell.org/packages/archive/base/latest/doc/html/Foreign-StablePtr.html

Re: [Haskell-cafe] Mersenne-random and standard random API

2012-02-10 Thread Yves Parès
I just thought about something: basically all these APIs provides a IO [a] (where a is a randomly generable type) function. Is there a problem with the approach that is to rely on lazy evaluation to pass to pure code (either explicitely or through State) the infinite list generated in IO and

Re: [Haskell-cafe] Mersenne-random and standard random API

2012-02-10 Thread Yves Parès
in that case. What so big would the runtime need to keep in memory except for the closure that generates the infinite list? 2012/2/10 Aleksey Khudyakov alexey.sklad...@gmail.com On 10.02.2012 18:38, Yves Parès wrote: I just thought about something: basically all these APIs provides a IO [a] (where

Re: [Haskell-cafe] Concurrency strategy for 2 threads and rare events

2012-02-08 Thread Yves Parès
Why do you think it's a lot? MVar are a teeny tiny and convenient primitive of communication, and I don't see why they wouldn't suit your need. Sure a throwTo would do the trick... But they're is do the trick and do the job, you see? Using STM and TVars *would* be kind of overkill. 2012/2/8 JP

[Haskell-cafe] Mersenne-random and standard random API

2012-02-08 Thread Yves Parès
Hi, I've been in the past told that mersenne-random was much better than the standard random package. However, System.Random.Mersenne doesn't follow the general API described in System.Random, MTGen is not an instance of RandomGen. But a sample on System.Random.Mersenne.getStdRandom documentation

Re: [Haskell-cafe] ANN: exists-0.1

2012-02-07 Thread Yves Parès
Are there documentation on constraints being types, how they can be declared/handled and what are the interests? 2012/2/7 Mikhail Vorozhtsov mikhail.vorozht...@gmail.com On 02/06/2012 03:32 AM, Gábor Lehel wrote: There's a common pattern in Haskell of writing: data E where E :: C a = a -

Re: [Haskell-cafe] Rewrite this imperative in FP way

2012-02-06 Thread Yves Parès
is just base on its first element. Basically it means: [(1,2), (2,2)] `union` [(1,0), (2,0), (0,0)] produce [(1,2), (2,2), (0,0)] rather than [(1,2),(2,2),(1,0),(2,0),(0,0)] by default. -Haisheng On Sun, Feb 5, 2012 at 11:37 PM, Yves Parès yves.pa...@gmail.com wrote: Concerning your

Re: [Haskell-cafe] Rewrite this imperative in FP way

2012-02-05 Thread Yves Parès
Concerning your first solution, I don't understand why you redefine Eq but not Ord instance. Ord will still work by comparing the tuples and not the first elements of said tuples. Plus the good news is you don't have to do this: just use regular tuples and use sort*By *or group*By *functions from

Re: [Haskell-cafe] Rewrite this imperative in FP way

2012-02-05 Thread Yves Parès
For instance your Eq instance could have been written x == y = (==) `on` (fst . getTuple) Sorry, wrong arity: (==) = (==) `on` (fst . getTuple) Okay for the imperative code. 2012/2/5 Yves Parès yves.pa...@gmail.com Concerning your first solution, I don't understand why you redefine Eq

Re: [Haskell-cafe] ANN: exists-0.1

2012-02-05 Thread Yves Parès
That is a great initiative. I didn't know about those Kind extensions that enable you to pass a typeclass as a type parameter... However, have you considered putting the Data.Exists.Default module in a separate package? That would reduce the dependencies for those who just need Exists and

Re: [Haskell-cafe] space leak when repeatedly calling Control.Monad.State.Strict.modify

2012-01-30 Thread Yves Parès
Have you tried to compile your code with optimisations? I guess GHC's strictness analysis would find strict evaluation is better here. 2012/1/30 Joey Hess j...@kitenet.net Claude Heiland-Allen wrote: Control.Monad.State.Strict is strict in the actions, but the state itself is still lazy,

Re: [Haskell-cafe] TCP Server

2012-01-28 Thread Yves Parès
http://hackage.haskell.org/package/network-server Straightforward to use, but unfortunately uses unix package. I take it it is not portable. However its first version did not use it, so maybe the concerned part could be rewritten. I think there is still no consensus on which iteratee library

Re: [Haskell-cafe] TCP Server

2012-01-28 Thread Yves Parès
automata) 2012/1/28 Erik de Castro Lopo mle...@mega-nerd.com Yves Parès wrote: Yes, and IMO this is a growing problem. Since iteratees were designed, a lot of different libraries providing this kind of service have appeared. Thats mainly because the solution space was new and lots of unexplored

[Haskell-cafe] Terminology: different levels of strictness

2012-01-27 Thread Yves Parès
If I consider the functions head, length, elem sum, each is of them is strict, as: head/length/elem x/sum _|_ are always _|_. However: head (x:_|_) is never _|_. length [_|_, _|_, _|_ ...] is also never _|_. elem x [4,5,6,8,2,90,_|_,_|_ ...] is *only sometimes *_|_ (depending on x value). In

Re: [Haskell-cafe] Hierarchical tracing for debugging laziness

2012-01-26 Thread Yves Parès
One day, I _really_ should learn all GHCI commands... Thanks, Felipe ^^ 2012/1/25 Felipe Almeida Lessa felipe.le...@gmail.com On Wed, Jan 25, 2012 at 7:38 PM, Yves Parès yves.pa...@gmail.com wrote: But I haven't found a way to tell GHCI to fully evaluate 'x' but _not_ print its value

[Haskell-cafe] Just found GHCI can be used as a debugger

2012-01-25 Thread Yves Parès
Hello, By randomly typing :Tab under GHCI, I discovered it could be used as a debugger (:breakpoint, :step, etc.) Three questions in that regard: 1) Is there some documentation about it? 2) I haven't investigated much, is that fairly thorough and convenient? Does some people over here use those

Re: [Haskell-cafe] Hierarchical tracing for debugging laziness

2012-01-25 Thread Yves Parès
Hi, nice little package! I just made a fork and added a new function makeHTrace to be able to have separate variables 'level'. I also add the htrace type signature (or else haddock won't generate documentation for this module): https://github.com/YwenP/htrace I was also investigating in a way to

[Haskell-cafe] Data newtype differences. Today: strictness

2012-01-22 Thread Yves Parès
Hello, I had for long thought that data and newtype were equivalent, but then I spotted some differences when it comes to strictness. Those can be summed up as: data Test = Test Int newtype TestN = TestN Int pm (Test _) = 12 -- Strict (pm undefined = undefined) pm2 t = t `seq` 12 -- Strict

Re: [Haskell-cafe] Data newtype differences. Today: strictness

2012-01-22 Thread Yves Parès
⊥. Put shorter: newtype TestN = TestN Int TestN x = undefined Then x = undefined. Which means you cannot make a boxed type out of un unboxed one using newtype. That makes sense. 2012/1/22 Roman Cheplyaka r...@ro-che.info * Yves Parès yves.pa...@gmail.com [2012-01-22 11:32:30+0100] These make

Re: [Haskell-cafe] Data newtype differences. Today: strictness

2012-01-22 Thread Yves Parès
Big sum up of everything: If TestN is a newtype constructor, then 'TestN undefined' and 'undefined' are exactly the same thing. 2012/1/22 Yitzchak Gale g...@sefer.org Yves Parès wrote: Is there some litterature expliciting in a less empiric way than I did the differences like

Re: [Haskell-cafe] [C][enums][newbie] What is natural Haskell representation of such enum?

2012-01-22 Thread Yves Parès
I may be curious to see how you intend to use such enum... It is very C-wise, I'm not sure it will be very handy, but I need some context. 2012/1/22 Данило Глинський abcz2.upr...@gmail.com What is natural Haskell representation of such enum? enum TypeMask { UNIT, GAMEOBJECT,

Re: [Haskell-cafe] Monads, do and strictness

2012-01-21 Thread Yves Parès
(StrictT op) = f = StrictT (op = \ x - x `seq` runStrictT (f x)) Are you sure? Here you evaluate the result, and not the computation itself. Wouldn't it be: (StrictT op) = f = op ` seq` StrictT (op = \x - runStrictT (f x)) ?? 2012/1/21 David Barbour dmbarb...@gmail.com On Sat, Jan 21, 2012

Re: [Haskell-cafe] Unboxed Rationals?

2012-01-12 Thread Yves Parès
uvector is deprecated, its functionnalities has been ported into vector. 2012/1/11 Artyom Kazak artyom.ka...@gmail.com Also, uvector already supports unboxed Ratios: http://hackage.haskell.org/package/uvector In fact, I am surprised that Data.Vector doesn't have a Ratio instance, but has a

Re: [Haskell-cafe] Solved but strange error in type inference

2012-01-06 Thread Yves Parès
2012/1/6 AUGER Cédric sedri...@gmail.com when you write forall a. exists b. a - b - a, then you allow the caller to have access to b to produce a (didn't you write a-b-a?) Yes, sorry, I always assumed independence between the type variables. Like in: f :: forall a. a - (forall b. b - a) being

Re: [Haskell-cafe] Solved but strange error in type inference

2012-01-05 Thread Yves Parès
a. a - ((forall b. b) - a) to: foo :: forall a. exists b. a - b - a ?? 2012/1/4 AUGER Cédric sedri...@gmail.com Le Wed, 4 Jan 2012 20:13:34 +0100, Yves Parès limestr...@gmail.com a écrit : f :: forall a. (forall b. b - b) - a - a f id x = id x is very similar to the first case, x

Re: [Haskell-cafe] Solved but strange error in type inference

2012-01-04 Thread Yves Parès
Le Tue, 3 Jan 2012 20:46:15 +0100, Yves Parès limestr...@gmail.com a écrit : Actually, my question is why the different type can't be unified with the inferred type? Because without ScopedTypeVariable, both types got expanded to : legSome :: *forall nt* t s. LegGram nt t s - nt

Re: [Haskell-cafe] Solved but strange error in type inference

2012-01-04 Thread Yves Parès
:: forall a. a Which is obviously wrong: when you *have entered* f, x has been instatiated to a specific type 'a', and then you want it to x to be of *any *type? That doesn't make sense.* **It's only logical. * 2012/1/4 Yucheng Zhang yczhan...@gmail.com On Wed, Jan 4, 2012 at 3:46 AM, Yves Parès

Re: [Haskell-cafe] Solved but strange error in type inference

2012-01-04 Thread Yves Parès
this sentence is correct. Some heads-up from a type expert would be good. Would you try: f :: a - a f x = undefined :: a And tell me if it works? IMO it doesn't. 2012/1/4 Yucheng Zhang yczhan...@gmail.com On Wed, Jan 4, 2012 at 7:58 PM, Yves Parès limestr...@gmail.com wrote: f :: forall

  1   2   3   4   >