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 > he recent discussion of whether storablevector should be deprecated in > favor of vector

[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 (20

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 > Hi Rico, > > Rico Moorman wrote: > >> data Tree = Leaf Integer | Branch (Tree Integer) (Tree

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 importan

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 > Do you want to hide the specific types of the job? Presumably to then > define a type

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 th

Re: [Haskell-cafe] Using promoted lists

2012-06-07 Thread Yves Parès
e wild guess '42 does 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/NewAxioms<http://hackage.haskell.org/trac/ghc/wiki/NewAxioms> 2012/6/8 AntC > Yves Parès gmai

[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.

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 > > > I love Haskell. It is my absolute favorite language. > > > But I have a very hard time finding places where I can actually use it! > > >

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

2012-06-01 Thread Yves Parès
Yes, it's that one, the first Quickcheck paper, thanks. The link on the wikipedia page is also dead. 2012/6/1 Ivan Perez > Is this the paper you are looking for: > http://www.eecs.northwestern.edu/~robby/courses/395-495-2009-fall/quick.pdf > ? > > On 1 June 2012 11:2

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 > Am 01.06.2012 12:00, schrieb Yves: > >> Out of curiosity, does someone know if QuickCheck was

[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 http://en.wikipedia.org/w

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 > * Yves Parès [2012-05-28 11:28:22+0200] > > > ob

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] 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 > 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:

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 dat

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 wrote: > > > > > > Note about []: Don't even mention foldl. The folding > > > > combinator for lists is foldr, period. > > > > > > Yes, I do agre

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

2012-05-23 Thread Yves Parès
ch kind of numbers do developers work with more often? Regular Ints and Doubles or Peano lazy numbers?) 2012/5/23 wren ng thornton > 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 us

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-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-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
> 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 "mo

[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 data

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 > Kevin Charter writes: > > snip > > For example, imagine you're new to the language, and as an

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

2012-05-16 Thread Yves Parès
ations are shared between list1 and list2 (I expected list1 to get 100% and list2 0%, due to sharing). Strange... 2012/5/16 Anthony Cowley > 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 spotte

[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 consum

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 implic

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 http://www.haskell.org/haskellwiki/Performance/

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=all&lang=ghc&lang2=java Would've expected always shorter code and better performances on average. 2012/5/8 Silvio Frischknecht > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1

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

2012-05-06 Thread Yves Parès
Sorry sorry sorry ^^ I read too fast and realized I was wrong before you sent this. Okay so then it would be nice that somewhere with higher skills tells us where does Haskell recursive calls stand when compared to C's. 2012/5/6 Roman Cheplyaka > It is not tail-recursive. > >

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 > On 06.05.2012 10:44, Ivan Lazar Miljenovic wrote: > >> On 6 May 2012 16:40,

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 > Hi Morten, > > If speed is really important I would go with the vector package. It > has a more modern API and better performance. > > --

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 > Hi, > Assuming this: > run :: Monad IO a -> IO a > data Test = Test {

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 a écrit : > *Homepage:* http://egonschiele.github.com/HandsomeSoup > *On Hackage:* http://hackage.haskell.org/package/HandsomeSoup > > *Blurb:*

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 a écrit : > Joachim Breit

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

2012-04-10 Thread Yves Parès
3, Joachim Breitner 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-co

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

2012-04-10 Thread Yves Parès
don't use Debian? And why was Joey Hess talking about performance issues? (I'll be eventually interested, as Graham Klyne suggested earlier, in compiling for Raspberry Pi, if the hardware suits). Le 10 avril 2012 12:49, Joachim Breitner a écrit : > Hi, > > Am Dienstag, den 10.04.20

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

2012-04-10 Thread Yves Parès
n ARM, which means GHC can be compiled for ARM. Le 10 avril 2012 12:27, Joachim Breitner 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-breitne

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 a écrit : > Thomas DuBuisson wrote: > > On Sun, Apr 8, 2012 at 4:03 PM, Francesco Mazzoli wrote: > > > No, it is not possible to build G

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 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 left-fold enumerat

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] 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 a écrit : > I uninstalled ghc, removed my ~/.cabal directory, reinstalled ghc, then > tried to install snap. I get: > > $ cabal install sna

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] 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 a écrit : > On 27 March 2012 21:46, Yves Parès wrote: > > Yes, thank you to remind me of that, I remember now having

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

2012-03-27 Thread Yves Parès
L.Vector V.Vector a Le 27 mars 2012 20:38, Bas van Dijk a écrit : > On 27 March 2012 11:00, Yves Parès wrote: > > Hello, > > > > As vector provides a class generalizing all flavours > > (Data.Vector.Generic.Vector), it occurs to me that the same could be done > &g

[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 l

Re: [Haskell-cafe] Using HaXml

2012-03-26 Thread Yves Parès
l: > > http://www.haskell.org/haskellwiki/HXT > > I also show some basic functionality of HXT in this blog post: > > > http://adit.io/posts/2012-03-10-building_a_concurrent_web_scraper_with_haskell.html > > I'm curious to hear how HaXml compares to HXT / HXML / TagS

[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 sub

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 a écrit : > erik flister wrote: > >> giving >>> a real-time audio synthe

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

2012-03-22 Thread Yves Parès
e 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 a écrit : > This joins the question I asked two days ago here. (See > http://haskell

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 a écrit : > Hi, > > I have just started learning Haskell FFI. I am trying to send a string > f

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

2012-03-21 Thread Yves Parès
(. castPtr) 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 a écrit : > On Wed, Mar 21, 2012 at 3:35 AM, Yves Parès wrote: > > Hello, > &g

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

2012-03-21 Thread Yves Parès
nvenient way to convert Text into Vector? Le 21 mars 2012 12:35, James Cook 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 wcha

[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 to

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 addit

Re: [Haskell-cafe] Helper classes for Generics

2012-03-12 Thread Yves Parès
e faster than SYB. It isn't planned 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 wrote: > >> I'

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 a écrit : > Hi all, > >

Re: [Haskell-cafe] Understanding GC time

2012-03-10 Thread Yves Parès
each 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 > I'm afraid without uniquene

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 > 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, I'll get an

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 > 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 > GHCi, version 7.4.1: ht

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: {-# LANGU

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 > 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 a

[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 produc

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. M

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 > On 16 Fe

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 > Where exac

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 > Hello Cafe, > > I will be (re)presenting Haskell in a "Batlle Language"

[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 call

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 same

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

2012-02-12 Thread Yves Parès
to use regular Ptrs with Foreign.Marshall.Alloc.malloc 2012/2/12 Antoine Latter > On Sun, Feb 12, 2012 at 3:09 PM, Yves Parès 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/h

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

2012-02-12 Thread Yves Parès
), that mostly limits their interest, doesn't it? 2012/2/12 Albert Y. C. Lai > 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.**html<ht

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

2012-02-12 Thread Yves Parès
/2/12 Antoine Latter > On Sun, Feb 12, 2012 at 8:18 AM, Yves Parès 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 opaq

[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] Mersenne-random and standard random API

2012-02-10 Thread Yves Parès
ng, but it's just I don't picture the overhead being so huge 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 > On 10.02.2012 18:38, Yves Parès wrote: > >> I just thou

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 cons

[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] 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

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 > 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 -> E >> also written >

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

2012-02-06 Thread Yves Parès
wo list of MyTuple 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

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 Existent

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 > Concerning your first solution, I don't understand why you redefine Eq but >

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 D

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 > Claude Heiland-Allen wrote: > > Control.Monad.State.Strict is strict in the actions, but the state > > itself is still lazy, so you end up

Re: [Haskell-cafe] TCP Server

2012-01-28 Thread Yves Parès
f pure closure-based automata) 2012/1/28 Erik de Castro Lopo > 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 sp

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 librar

[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 fac

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 > On Wed, Jan 25, 2012 at 7:38 PM, Yves Parès wrote: > > But I haven't found a way to tell GHCI to fully evaluate 'x' but _not_ > print > > its value. >

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] Just found GHCI can be used as a debugger

2012-01-25 Thread Yves Parès
Hello, By randomly typing : 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 funct

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 Данило Глинський > What is natural Haskell representation of such enum? > > enum TypeMask > { >UNIT, >GAMEOBJECT, > >CREATURE_OR_GAMEOB

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 > Yves Parès wrote: > >> Is there some litterature expliciting in a less empiric way than I did > the >

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

2012-01-22 Thread Yves Parès
atched against ⊥. 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 > * Yves Parès [2012-01-22 11:32:30+0100] > > These make me thin

[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] 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 > On Sat, Jan 21, 2012 at 10:0

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 > 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 Complex instance.

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

2012-01-06 Thread Yves Parès
2012/1/6 AUGER Cédric > 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 the s

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

2012-01-05 Thread Yves Parès
Something) -> SomethingElse And to be sure: foo :: forall a. a -> (forall b. b -> a) is equivalent to: foo :: forall a b. a -> b -> a Right? And: foo :: forall a. a -> ((forall b. b) -> a) to: foo :: forall a. exists b. a -> b -> a ?? 2012/1/4 AUGER Cédric > Le Wed, 4

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

2012-01-04 Thread Yves Parès
id so f will decide what will be its type. In this case, because it's applied to 'x', id type will get instanciated to 'a -> a' (where a is rigid, because bound by f signature). 2012/1/4 AUGER Cédric > Le Wed, 4 Jan 2012 14:41:21 +0100, > Yves Parès a écrit : >

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

2012-01-04 Thread Yves Parès
; > f :: Int -> Int > f x = undefined :: a > > f :: Int -> Int > f x = 3 :: (Num a => a) > > > Can someone explain case by case? > > Thanks, > Thiago. > > 2012/1/4 Yves Parès : > >> I don't see the point in universally quantifying over typ

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

2012-01-04 Thread Yves Parès
" the scoping of variables, so that > f :: a -> a > f x = x :: a > becomes valid? You mean either than compiling with ScopedTypeVariables and adding the explicit forall a. on f? I don't think. 2012/1/4 Brandon Allbery On Wed, Jan 4, 2012 at 08:41, Yves Parès wrote: > Wo

  1   2   3   4   >