[Haskell-cafe] [Off-topic]Functional parsing theory

2010-10-06 Thread Maurí­cio CA
Hi, all, I've been working in a tool that reads a grammar with associated actions and act on input based on that grammar. I would like to rewrite it in a functional style, but I've not been able to find a theory that would handle any possible grammar with cyclicity and empty productions, and

[Haskell-cafe] Re: ANN: bitspeak 0.0.1

2010-06-23 Thread Maurí­cio CA
Sure, Huffman was actually my first tought. But I couldn't think of a pratical display for the result of Huffman encoding that could be easily followed by a human looking at the screen. Since it's an optimal code, letters would not be grouped in alphabetical order. There is a compromise. There

[Haskell-cafe] ANN: bitspeak 0.0.1

2010-06-21 Thread Maurí­cio CA
Hi, all, bitspeak is a small proof of concept application that allows writing text using only two commands (yes/no, 1/2, top/down etc.). It is intended to show how people with disabilities similar to Stephen Hawking's (i.e., good cognitive hability, but very few movements) can write text.

[Haskell-cafe] Re: ANN: bitspeak 0.0.1

2010-06-21 Thread Maurí­cio CA
bitspeak is a small proof of concept application that allows writing text using only two commands (yes/no, 1/2, top/down etc.). Looks cool! Did you forget any dependencies tho? I get the following error: Oops... Three modules ended up missing in .cabal file. Just uploaded 0.0.2 to hackage,

[Haskell-cafe] Re: ANN: bitspeak 0.0.1

2010-06-21 Thread Maurí­cio CA
bitspeak is a small proof of concept application that allows writing text using only two commands (yes/no, 1/2, top/down etc.). There is a parallel between data compression algorithms and this sort of task, expressing a sentence in the minimal number of bits via compression also minimized the

[Haskell-cafe] Embedded funcional programming?

2010-04-17 Thread Maurí­cio CA
Hi, all, I've beeing working with some people who do programming for wireless devices. 100% of their code uses C, and I would like to show them nice things they could do with funcional programming (not necessarily Haskell. I believe, say, Standard ML could be also very nice.) I'm new to this,

[Haskell-cafe] Re: Using Haskell's FFI to send ancillary data over Unix domain sockets

2010-03-05 Thread Maurí­cio CA
For me, this presents a few problems. I don't know where to get the SCM_CREDENTIALS constant, I have no idea what flags to use (does the Network module help with that?), I don't know how to get from a list of file descriptors or a tuple to a Ptr, and perhaps most importantly, I have no idea

[Haskell-cafe] Re: GPL answers from the SFLC (WAS: Re: ANN: hakyll-0.1)

2010-03-05 Thread Maurí­cio CA
To my knowledge, the LGPL only allows *linking* with non-(L)GPL software. But GHC doesn't just link but performs massive cross-module inlining. So in my opinion, LGPL is not a solution, too. Use BSD3! But that massive cross-module inlining happens at your computer, where the rights allowed

[Haskell-cafe] Re: do we need types?

2010-02-26 Thread Maurí­cio CA
A type class is a relation between types. Yes, but not officially, just de facto: http://hackage.haskell.org/trac/haskell-prime/ticket/90 Best, Maurício ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Re: Using Cabal during development

2010-02-11 Thread Maurí­cio CA
Eventually, I think using cabal during development may be convenient. The only drawback is that you have to specify each dependency and -- above all -- every module each time you add one. When writing bindings-posix, bindings-glib etc., which have lots of modules, I used a shell script to

[Haskell-cafe] Hackage download statistis

2010-02-11 Thread Maurí­cio CA
Hi, all, Some time ago a download statistic of hackage was made available, and analysed in a few ways. Googling for it still find that at a Galois web page. I though that, since the tools to get that were there, this would be output once in a while, but it seems it hasn't been done since then.

[Haskell-cafe] Re: GUI programming

2010-02-04 Thread Maurí­cio CA
The problem is that the GUI code has become very ugly and I'm tempted to rewrite it totally. I've been looking forward to the FRP stuff, but I've never seen a single definition of the term. Conal Eliot's denotational programming is too general to be definition. I want to try Grapefruit, but

[Haskell-cafe] Re: C functional programming techniques?

2010-01-30 Thread Maurí­cio CA
Sorry if this looks weird, but do you know of experiences with functional programming, or type programming, with C? I would use a higher level language to emit valid C. Basically, use a strongly typed macro language. All you will have to prove is that your emitter produces type safe code,

[Haskell-cafe] C functional programming techniques?

2010-01-29 Thread Maurí­cio CA
Hi, all, Sorry if this looks weird, but do you know of experiences with functional programming, or type programming, with C? Using macro tricks or just good specifications? I know this is not absurd to a small extent. I've heard of proof tool certificated C code on the net (although I don't

[Haskell-cafe] Re: ANN: bindings-DSL 1.0.4 (Category: FFI)

2010-01-28 Thread Maurí­cio CA
http://hackage.haskell.org/package/bindings-DSL http://bitbucket.org/mauricio/bindings-dsl The only thing I've missed for now is a #ccall equivalence for stdcall functions, I hacked one up myself and called it #stdcall, but it would be nice to have in the package proper if possible.

[Haskell-cafe] Re: ANN: bindings-DSL 1.0.4 (Category: FFI)

2010-01-28 Thread Maurí­cio CA
Here is my attempt. I added #callconv macro, that accepts a calling convention parameter. The lines below are now equivalent. Builds fine here and looks reasonably fine. Okay. Package uploaded, documentation updated. Best, Maurício ___

[Haskell-cafe] ANN: bindings-DSL 1.0.4 (Category: FFI)

2010-01-22 Thread Maurí­cio CA
Hi, bindings-DSL is a mature and well documented preprocessor domain specific language you can use to generate bindings to a C API. It's based on functionality provided by hsc2hs. These are links to Hackage page and documentation: http://hackage.haskell.org/package/bindings-DSL

[Haskell-cafe] Re: changelogs for packages on Hackage

2009-12-16 Thread Maurí­cio CA
Some packages have a changelog file in them that we could display, though most don't. Debian policy requires changelogs of standard format. Most packages use a well known version control system (darcs, mercurial etc.). Cabal also has fields helping identifying where in vcs history are each

[Haskell-cafe] Re: consulting and contracting

2009-12-15 Thread Maurí­cio CA
I was wondering how many haskell consultants and contractors (ie. freelance programmers) there are and how much demand there is for their work. I've done three Haskell contracts last year and this year, all in the financial industry in the New York area. Two of them were for the same

[Haskell-cafe] Checking dependencies from C packages in cabal

2009-12-09 Thread Maurí­cio CA
Hi, all, When pkg-config info is not available for a library (when I could use pkgconfig-depends), what should I use to check if needed libraries are installed and to give the compiler all needed info about include files and library location? Also, is it possible to do that without configure

[Haskell-cafe] Re: Checking dependencies from C packages in cabal

2009-12-09 Thread Maurí­cio CA
Until you get the perfect answer you may want to have a look at the cabal definitions of zlib digest OpenGLRaw GLUT readline GLFW wxcore terminfo berkeleydb BerkeleyDB hubris pcre-light HDBC-mysql HDBC-sqlite3 HDBC-odbc HDBC-postgresql I do know them. But they just include needed .h and .c

[Haskell-cafe] Re: Do you need Windows USB in Haskell?

2009-12-07 Thread Maurí­cio CA
I don't need usb and I can't say I'm a windows user, but I'd be glad to test it since I have it on a virtual machine. In my case, installation fails on bindings-common. bindings-common fails on windows due to an old version of C library with GHC's windows version of gcc. Current version of

[Haskell-cafe] Re: binding to C libraries on Windoww

2009-12-07 Thread Maurí­cio CA
To reply to an earlier point of Andrew's (I can't find the quote now, sorry), one of the biggest difficulties developers face on Windows is the lack of common install locations/practices. Windows software is usually distributed as a binary, which may or may not include header files. These

[Haskell-cafe] Re: binding to C libraries on Windoww

2009-12-06 Thread Maurí­cio CA
I guess there's a difference in culture here. On Unix, it is usual to distribute programs as source, and build from source. I see more than a cultural issue here. Suppose you write bindings to somelib-1.0.2, and release it with somelib-1.0.2. Then, somelib-1.0.3 is released to solve a

[Haskell-cafe] Do you need Windows USB in Haskell?

2009-12-05 Thread Maurí­cio CA
Hi, I keep this direct binding to libusb-1.0.x: http://hackage.haskell.org/package/bindings-libusb on top of which Bas maintains a nice USB library: http://hackage.haskell.org/package/usb Work has been done to support libusb-1.0.x in Windows. So, as long as my bindings-libusb works

[Haskell-cafe] Re: Binding to C in Windows (was: Low Level Audio - Writing bytes to the sound card?)

2009-12-05 Thread Maurí­cio CA
Unfortunately, I've yet to find a single Haskell package that binds to C which will actually compile on Windows. :-( Do you know how can we check dependencies to C libraries in Windows? Is pkg-config available? What about packages with no pkg-config configuration? Thanks, Maurício

[Haskell-cafe] Re: I miss OO

2009-11-25 Thread Maurí­cio CA
Python: note1.time() cursor1.time() staff1.time() (...) So I'm thinking of moving to a scheme in Haskell using modules, most types being defined in their own modules, and doing qualified imports. Generic names like 'time' can be defined in each module w/o clashing. (...) I would

[Haskell-cafe] Re: Haskell Weekly News: Issue 140 - November 22, 2009

2009-11-24 Thread Maurí­cio CA
Incidentally, I've always wondered about the politically correct way of referring to this programming language (and related implementation in the above-mentioned type system) in academic circles; Is this a question of politically correctness? Since there's no discrimination or prejudice

[Haskell-cafe] Re: Idea for a very simple GUI llibrary

2009-11-23 Thread Maurí­cio CA
Nice idea. I will try it if you write runGUI :-) Sure, just let me know :) If this is to be done, I think it's better that the person writing the Haskell code do not write runGUI, so the implementation details wouln't discourage ideas that make life easier for users. This is an imperative

[Haskell-cafe] Re: How does cabal determine version ranges in the dependencies?

2009-11-23 Thread Maurí­cio CA
I recently started porting cabal-install to Freebsd. When I looked at its dependencies on hackage, I noticed HTTP (=4000.0.2 4001). However the latest HTTP version on hackage is 4000.0.8. That struck me as kinda odd. How can cabal tell that it won't be compatible with HTTP version 4001? If

[Haskell-cafe] Re: Idea for a very simple GUI llibrary

2009-11-23 Thread Maurí­cio CA
Thinking of a parallel with Java for a second, is there a GUI library out there that's structured like Java Swing? Meaning, there is a GUI library that has a small platform-specific GUI foundation (e.g. a per platform implementation of the core AWT functionality) and the rest of the

[Haskell-cafe] Re: How does cabal determine version ranges in the dependencies?

2009-11-23 Thread Maurí­cio CA
If it doesn't break dependencies, it won't be called http 4001, it will be called 4000.0.9 :) Check: http://www.haskell.org/haskellwiki/Package_versioning_policy I see. Thanks for the link. I wasn't aware of the versioning policy. Just to clarify though, wouldn't the next higher major version

[Haskell-cafe] Idea for a very simple GUI llibrary

2009-11-22 Thread Maurí­cio CA
Hi, Here is a sketch for a library with these properties: - Easy to test. All Haskell code can be tested in a text terminal. Also, testing code that uses the library can also be done without using a GUI. - Extremely easy to document and use. - Not even close to Gtk2hs power, but enough for

[Haskell-cafe] Re: ANN: bindings-SDL 1.0.2, the domain specific language for FFI description

2009-11-19 Thread Maurí­cio CA
I did not notice when this was released, but I saw it on Hackage yesterday and, with it, wrote some of the easiest bindings to a fairly complex C API I've written in a while. This package is excellent! Thank you for sharing it. Thanks. My hope is that it saves as much time from users as the

[Haskell-cafe] Re: ANN: bindings-SDL 1.0.2, the domain specific language for FFI description

2009-11-19 Thread Maurí­cio CA
I had two structs, one of which used the other as a field type. I was using the generated identifier of the first as the type for the second, so it had the form c'STRUCT_NAME. So the field macro looked like this: #field foo , c'STRUCT_NAME It did not like this, complaining about the

[Haskell-cafe] ANN: bindings-SDL 1.0.2, the domain specific language for FFI description

2009-11-16 Thread Maurí­cio CA
Hi, This package is to be used with hsc2hs. (hsc2hs is called automatically if you use Cabal.) It's a self-contained set of macros used to create a Haskell wrap for a C interface. They follow the idea that it's better to have a C-like wrap code first and then write Haskell-like code on top of

[Haskell-cafe] How much time until dependencies are rebuilt in hackage?

2009-11-14 Thread Maurí­cio CA
Suppose package B depends on A. If a new version of A is uploaded to hackage, how much later package B will be rebuilt (either to show a problem with the new version or to solve a problem with a previous version of A)? Thanks, Maurício ___

[Haskell-cafe] Re: Weird dependency failure log

2009-11-13 Thread Maurí­cio CA
There's one thing special about bindings-DSL. It's a package with a set of macros for hsc2hs, and contains no Haskell code. Maybe this revealed some hidden error in package dependency checking. This is a package with no library and no executables. That's not supposed to work. It contains

[Haskell-cafe] Re: Could someone teach me why we use Data.Monoid?

2009-11-13 Thread Maurí­cio CA
I have looked the concept of monoid and something related, but still, I do not know why we use it? I don't know if it's a good example, but it's simple. This package I wrote uses reverse polish notation to write gtk2hs layout windows. http://hackage.haskell.org/package/gtk2hs-rpn Since the

[Haskell-cafe] Re: Weird dependency failure log

2009-11-13 Thread Maurí­cio CA
This is a package with no library and no executables. That's not supposed to work. Why shouldn't this be supposed to work? It does install needed files (two include files for hsc2hs), and they do stand for themselves to justify a package of its own. Header files are associated with a

[Haskell-cafe] Re: Weird dependency failure log

2009-11-13 Thread Maurí­cio CA
Header files are associated with a library. If there is no library then nothing gets registered. This is by design. If it's not a library, nothing can depend on it. But please tell me then where my package fits. I'm not sure I understand the question. Can you clarify what you

[Haskell-cafe] Weird dependency failure log

2009-11-12 Thread Maurí­cio CA
Hi, all, Hackage shows a log failure for 'bindings-gsl': Configuring bindings-gsl-0.1.1... cabal-setup: At least the following dependencies are missing: bindings-DSL ==1.0.* But here is, at version 1.0.1, no building problems: http://hackage.haskell.org/package/bindings-DSL

[Haskell-cafe] Sending patches to ghc related repositories

2009-11-10 Thread Maurí­cio CA
Hi, all, I just tried to send a patch to a ghc tool. I see in hackage that the maintainer e-mail is 'cvs-fpto...@haskell.org' (package is hsc2hs). I tried sending darcs patch to this e-mail, but it's refused as it's not on that server allowed e-mails table. The patch isn't really important,

[Haskell-cafe] Re: Nice addition to Foreign: castAny

2009-11-07 Thread Maurí­cio CA
castAny :: (Storable a, Storable b) = a - b castAny = unsafePerformIO . genericCast where genericCast :: (Storable a, Storable b) = a - IO b genericCast v = return undefined = \r - allocaBytes (max (sizeOf v) (sizeOf r)) $ \p - poke p v if False then return r else peek

[Haskell-cafe] Re: Marshalling arrays without flakiness?

2009-10-29 Thread Maurí­cio CA
I would like to know whether there is a good way to marshal the following structure to C without using pointer arithmetic done by a programmer (as opposed to a tool). typedef struct{ double a[10]; double b[10]; double b[10]; } foo; With my my 'bindings-common' package it's done

[Haskell-cafe] Re: Marshalling arrays without flakiness? (poke example)

2009-10-29 Thread Maurí­cio CA
I would like to know whether there is a good way to marshal the following structure to C without using pointer arithmetic done by a programmer (as opposed to a tool). Here is an example with poke. It's completely useless, except for demonstration :) You have a global variable in C that

[Haskell-cafe] C headers in cabal dependencies

2009-10-28 Thread Maurí­cio CA
Hi, I've been using 'install-includes' in a package. I sometimes make small changes to those include files, and I've seen that cabal doesn't consider then dependencies, i.e., doesn't rebuild .hsc files depending on then. I'm not sure if this is an error, as parsing hsc2hs input may not be cabal

[Haskell-cafe] Re: Word128, Word256

2009-10-26 Thread Maurí­cio CA
To have it defined is one thing. To actually implement i128 and i256 is quite another thing. Are you willing to actually do all of the work necessary to implement the unboxed i128 code? Dream away! John Meacham also told me that even if I get there, it wouldn't do what I want (use it to

[Haskell-cafe] Nice addition to Foreign: castAny

2009-10-26 Thread Maurí­cio CA
This could be beside castPtr, castCharToCChar etc. castAny :: (Storable a, Storable b) = a - b castAny = unsafePerformIO . genericCast where genericCast :: (Storable a, Storable b) = a - IO b genericCast v = return undefined = \r - allocaBytes (max (sizeOf v) (sizeOf r)) $

[Haskell-cafe] Re: CComplex in jhc (was: Word128, Word256)

2009-10-25 Thread Maurí­cio CA
Something like 'CComplex CDouble' has been proposed before... 2) Since all (few) answers were favorable, should I ask for a ticket to be created? How? Well, before trying to get it standardized, you need to get it implemented and tested by at least one compiler to explore the design space

[Haskell-cafe] Re: Word128, Word256

2009-10-24 Thread Maurí­cio CA
Something like 'CComplex CDouble' has been proposed before... I know, I started most of the discussions :) The wiki says before asking for a ticket I should try to talk about it in the mailing list. My attempts never got much attention, but all replies gave favorable answers. Last week,

[Haskell-cafe] Re: A 3 line program -- Reid, Don, Daniel

2009-10-24 Thread Maurí­cio CA
Philippos, Doesn't the line below means everything to be interpreted will be considered as latin1? \usepackage[latin1]{inputenc} Unicode as UTF-8 won't fit here. I would sugest transfering the problem to latex. Why not to print 'fa\c cade' instead of 'façade'? It's 7 bits and will never

[Haskell-cafe] Word128, Word256

2009-10-22 Thread Maurí­cio CA
Hi, Do you think we could have the range of sizes for Int* and Word* expanded to allow also 128 and 256 bits sizes? My reason is that I have a long standing issue trying to bind to C numerical libraries using complex numbers, as those are usually structs passed by value. See this from GNU GSL:

[Haskell-cafe] Re: pretty printing with comments

2009-10-20 Thread Maurí­cio CA
�typeURL= String Maybe the difference is the missing space between type and URL. Ah, of course, I see it now, thanks! It ocurred to me that you could catch these kind of errors faster if haskell-src-exts included a basic program to pretty print a Haskell module that we could use out of

[Haskell-cafe] Re: ANN: Reverse Dependencies in Hackage (demo)

2009-10-15 Thread Maurí­cio CA
You can sort the tables of reverse dependencies by clicking on the column headers. I wouldn't have thought about clicking in the columns headers. Maybe you could show the order arrow already in the beggining, before any clicks, this would give a hint. - Rev. deps overview for all packages;

[Haskell-cafe] Re: [Haskell] ANNOUNCE: usb-0.1

2009-10-01 Thread Maurí­cio CA
At least the following packages suffer from this problem: bindings-common bindings-libusb bindings-posix Most .tar files contain entries for the directories that precede the entries for the files. This is only by convention however. It looks like this tar file has an entry for

[Haskell-cafe] Re: Doing people's homework?

2009-09-29 Thread Maurí­cio CA
If you do a student's homework, you are cheating that student out of an education. Personally, I tend to find exercises without access to the answers a poor way to learn. You'll learn more from a well crafted example than you ever will by struggling at something yourself. In these lines,

[Haskell-cafe] Re: Doing people's homework?

2009-09-28 Thread Maurí­cio CA
I'm not really hip to the culture here so this is just an observation, but some of the recent questions posted to this list (and beginn...@haskell.org) look a lot like someone's homework. Well, if homework looks like homework, the teacher is guilty of cheating. Best, Maurício

[Haskell-cafe] Re: help with FFI

2009-09-17 Thread Maurí­cio CA
typedef struct { int *a; int *b; /*lots of stuff ... */ int *z; } foo; int create_foo(foo *f,FILE *file,int x,int y); int use_foo(foo *f,int w); int destroy_foo(foo *f); newtype Foo = Foo () foreign import ccall static foo.h create_foo c_create_foo :: Ptr (Foo) - Ptr (CFile) - CInt - CInt - IO

[Haskell-cafe] Re: ANNOUNCE: A Levenberg-Marquardt implementation

2009-09-14 Thread Maurí­cio CA
Unless you think that extra-libraries is a good long term solution, I'll still investigate on how to add pkg-config generation to configuration scripts and try to send a sugestion with a patch to maintainers of libraries wrapped in bindings-*. It is not practical to use pkg-config for such

[Haskell-cafe] Re: ANNOUNCE: A Levenberg-Marquardt implementation

2009-09-14 Thread Maurí­cio CA
Yes. It works this way. Tested in debian and old fedora Thank you for testing. I have just released bindings-levmar-0.1.0.1 on hackage. It simply replaces pkgconfig-depends with extra-libraries. I hope this solves the installation problems. Debian maintainer was willing to add pkg-config to

[Haskell-cafe] Re: ANNOUNCE: A Levenberg-Marquardt implementation

2009-09-11 Thread Maurí­cio CA
The C library prints error messages to stderr. (...) Attached is the patch to the C levmar library. Thanks for the file. The license issue is indeed a problem. Either your (linked + distributed) code must be GPL or you must acquire a different (commercial) license from the author of the C

[Haskell-cafe] Re: ANNOUNCE: A Levenberg-Marquardt implementation

2009-09-10 Thread Maurí­cio CA
Our binding consists of three packages: * http://hackage.haskell.org/package/bindings-levmar-0.1 Which were the changes you needed to do to the library code? I believe this is going to cause you two problems: maintenance (as you can't always be sure the patched version didn't introduce a bug)

[Haskell-cafe] Re: ForeignFunPtr

2009-09-06 Thread Maurí­cio CA
Isn't freeHaskellFunPtr a required finalization procedure? Maurício the purpose of ForeignPtr is to attach a finalization procedure to the object behind the pointer. for example, you can have close called aimplicitly whenever the garbage collector finds you don't need a file handle any more.

[Haskell-cafe] ForeignFunPtr

2009-09-05 Thread Maurí­cio CA
Hi, We have ForeignPtr. Why isn't there a corresponding ForeignFunPtr? Thanks, Maurício ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Linking problem with GHCi

2009-08-24 Thread Maurí­cio CA
With a specific package (bindings-common, with the latest version in hackage) if I ask GHCi to read it I get: ghc-6.8.2: /home/mauricio/lib/bindings-common-0.2.5/ghc-6.8.2/HSbindings-common-0.2.5.o: unknown symbol `atexit' If I build a library or executable cabal package depending on it, I

[Haskell-cafe] Re: Linking problem with GHCi

2009-08-24 Thread Maurí­cio CA
With a specific package (bindings-common, with the latest version in hackage) if I ask GHCi to read it I get: ghc-6.8.2: /home/mauricio/lib/bindings-common-0.2.5/ghc-6.8.2/HSbindings-common-0.2.5.o: unknown symbol `atexit' If I build a library or executable cabal package depending on it, I

[Haskell-cafe] Re: simulation in the haskell way

2009-08-18 Thread Maurí­cio CA
...) But for simulation kind-of problems, in which I think OO really fits the best, what's the haskell way to structure such problems? I once thought maybe I can use the State monad to simulate objects. But it's really hard for me to implement, because I think State monad is used to simulate a

[Haskell-cafe] Re: simulation in the haskell way

2009-08-18 Thread Maurí­cio CA
When I was using C and Python, I used to think of most applications in an simulation way. I think it's right to say that programs are simulations. But now I have to change my mind in Haskell, I have to think in a data-flow way, that is: data in, processing using function composition, data out.

[Haskell-cafe] Re: ANN: OpenCLRaw 1.0.1000

2009-08-17 Thread Maurí­cio CA
I've released a raw binding to the OpenCL platform on Hackage. The main differences between it and the C bindings are that constants have been replaced by newtypes for type safety reasons, (...) If you think there's something I could change in the package below to make it usefull for this

[Haskell-cafe] Blank definition list in haddock

2009-08-16 Thread Maurí­cio CA
I read in haddock documentation that we write definition lists like this: -- [...@something@] Definition of something. However, using that structure to document many itens, I get a blank list of definitions, like you can see in this section ('Macros') of the documentation for a package of

[Haskell-cafe] Re: Blank definition list in haddock

2009-08-16 Thread Maurí­cio CA
I read in haddock documentation that we write definition lists like this: [...] Did I used those definitons the wrong way? I think the problem is that you have written normal comments instead of Haddock comments. Try adding a | in front of the paragraphs, or just merge them all into one

[Haskell-cafe] Finalizers on FunPtrs

2009-08-12 Thread Maurí­cio CA
I see in Foreign.Ptr documentation that it is good practice to call freeHaskellFunPtr when a pointer to a Haskell function (obtained using 'dynamic' stubs) is not going to be used anymore. Is it possible to do that in a way that is similar to ForeignPtr behavior, where pointers are finalized

[Haskell-cafe] Space for commentaries on hackage

2009-08-05 Thread Maurí­cio CA
It would be nice to have a place for anonimous comments below each page of a hackage package, maybe with a cabal option to enable/disable that for a particular package. Authors of packages with few users may want that as a way to get first impressions on their work they would otherwise not get.

[Haskell-cafe] Re: Space for commentaries on hackage

2009-08-05 Thread Maurí­cio CA
It would be nice to have a place for anonimous In these days of web spam, anonymous is not such a good idea. Sure! Replace anonymous for easy to write. Although, thinking better, this should be something to ask at repository hosters, not at hackage. Best, Maurício

[Haskell-cafe] Re: Space for commentaries on hackage

2009-08-05 Thread Maurí­cio CA
Sure! Replace anonymous for easy to write. [...] [...] every package I upload to hackage includes my email address in the maintainer field, and I love getting emails from people who use anything I maintain (even if they're asking me to do work! I may not do it, but it's nice to know that

[Haskell-cafe] Do you understand posix well?

2009-08-05 Thread Maurí­cio CA
I've beeing writing a low-level binding to posix that can be usefull if you want to use posix but has no time to learn FFI: http://hackage.haskell.org/package/bindings-posix However, my understandment of posix is barely nothing, and I see that many of its functionality is enabled or disabled by

[Haskell-cafe] Re: Adding a field to a data record

2009-07-28 Thread Maurí­cio CA
Suppose you have a data type like: Data Foo = Foo { a :: Int, b :: Int, ... many other fields ... y :: Int } deriving (Eq, Read, Show, Typeable, Data) Now I would like to add a field z :: Int to the end of Foo. If I have a ton of data out on disk, which I wrote with, say writeFile a.data

[Haskell-cafe] Re: Recompiling Hackage to estimate the impact of a change [Was: StricterLabelledFieldSyntax]

2009-07-26 Thread Maurí­cio
In general, I think it would be a good idea to provide some statistics of how many packages would break as the result of a backwards incompatible change. Agreed. And it should be required as part of release processes for GHC. One possible alternative, or complementary, action would be

[Haskell-cafe] FFI to double constants, printf

2009-07-17 Thread Maurí­cio
When we printf doubles from C (like when using hsc2hs to bind to a constant) we can get something that's not valid Haskell. See these 2 examples: 3.40282347e+38F inf Do you know some way to printf a double using printf (or any other standard function) that's always going to give me valid

[Haskell-cafe] Re: FFI to double constants, printf

2009-07-17 Thread Maurí­cio
That helps, but: #include stdio.h #include math.h int main () { long double d = HUGE_VAL; printf(%.30Lf\n, d); } still prints just (as it should, I think): inf Is there maybe some way to check if a double or long double do have a proper value? You probably want something like

[Haskell-cafe] Re: Pattern matching does not work like this?

2009-07-15 Thread Maurí­cio
I do not notice this before. fun ([0, 1] ++ xs) = .. in my code could not be compiled, parse error. Maybe a small abstract can help, as I once also got confused by that. * First, syntax without operators You can only match on constructors. So, if you have data Test = Test1

[Haskell-cafe] Re: Mixing C and Haskell code in the same file

2009-07-15 Thread Maurí­cio
#def inline int signof(int x) {return x0?-1:x0?1:0;} foreign import ccall safe signof :: CInt - CInt Is it possible to get that #def as a result of a macro? Say, something like this: --- (WARNING: invalid code) #define ret(name,value,type) \ #def inline type name (void) {return value;}

[Haskell-cafe] Re: Mixing C and Haskell code in the same file

2009-07-12 Thread Maurí­cio
Is it possible to insert C code directly to, say, .hsc files? I see this construct in ghc user docs: I think you can find your answer here: http://www.haskell.org/ghc/docs/latest/html/users_guide/hsc2hs.html I did read that. It says I can use #def to insert a C definition, but there are no

[Haskell-cafe] Could C libraries be part of Haskell Platform?

2009-07-12 Thread Maurí­cio
Probably not, but... There are stable and portable libraries that implement functionality missing in Haskell. It could be nice to be able to list then in a cabal file (using, say, pkgconfig-depends) and know for sure that any system with Haskell Platform will have then available for use with FFI.

[Haskell-cafe] Re: Could C libraries be part of Haskell Platform?

2009-07-12 Thread Maurí­cio
Probably not, but... There are stable and portable libraries that implement functionality missing in Haskell. It could be nice to be able to list then in a cabal file (using, say, pkgconfig-depends) and know for sure that any system with Haskell Platform will have then available for use with

[Haskell-cafe] Re: Could C libraries be part of Haskell Platform?

2009-07-12 Thread Maurí­cio
This isn't clear to me; in general you only need to bind them once and then they're available in Haskell. Why not include the library with its bindings? There are many ways to bind to a library. The first one isn't usually the best. Including the library with its bindings means you have to

[Haskell-cafe] Mixing C and Haskell code in the same file

2009-07-10 Thread Maurí­cio
Is it possible to insert C code directly to, say, .hsc files? I see this construct in ghc user docs: #def ... which should insert definitions, but I could not find examples of usage in Hackage. My goal is to write some cpp macros that build both a C function and its 'foreign import ccall'

[Haskell-cafe] Re: How to present the commonness of some objects?

2009-07-03 Thread Maurí­cio
Wow, this complex Thank you. I will try that. No, don't! There is an easier way. (...) This is the point at which you are forced to move away from OO thinking. This seems to be worth clearing a little bit. I usually read people saying that this kind of misundestanding is a confusion

[Haskell-cafe] Re: hiding instance definitions in imported modules or redefining them, can it be done?

2009-07-03 Thread Maurí­cio
Is there a way to hide instance definitions when importing a module for instance No, there isn't. See item 5.4: http://haskell.org/onlinereport/modules.html Best, Maurício ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Re: Could FFI support pass-by-value of structs?

2009-07-01 Thread Maurí­cio
Yeah, I'm not suggesting going via Storable (for all those reasons), just extending the FFI to say tuples of FFI types get passed as the corresponding C ABI structs. All the magic to match the current platform C ABI then lives in the compiler. Agree. The tuples idea is far better than my first

[Haskell-cafe] Re: Could FFI support pass-by-value of structs?

2009-07-01 Thread Maurí­cio
Do you imagine an objection on creating a ticket asking for something like CComplex on Foreign.C.Types? No, I would like it. Also add a 'CBool' that maps to the calling convention for _Bool while you are at it. Here is a draft. Please comment: Proposal: complement Foreign.C.Types A few

[Haskell-cafe] Re: Could FFI support pass-by-value of structs?

2009-07-01 Thread Maurí­cio
* CComplexFloat, CComplexDouble Related to 'float complex' and 'double complex'. We need a way to actually examine the values, since 'fromIntegral' won't work. I think the easiest way is to actually reuse Complex which is already in Haskell 98, defining What do you think of newtype

[Haskell-cafe] C global vars local to threads

2009-06-28 Thread Maurí­cio
I would like to write a wrapper to C global variable, but that variable is unique to each thread. Is there some native support on that in Haskell FFI? (I imagine I probably should write a C function to get its pointer as an 'IO (Ptr ...)', but I would like to check if there's a more standard way

[Haskell-cafe] Multi-module scripts

2009-06-26 Thread Maurí­cio
Is it possible to write a Haskell script that uses a module that is also going to be interpreted? Like, say: #!/usr/bin/runhaskell module Main (main) where import OtherModule main = (...) where OtherModule is available in, say, OtherModule.hs and not in the already compiled and installed

[Haskell-cafe] Re: Could FFI support pass-by-value of structs?

2009-06-24 Thread Maurí­cio
It's not usual, but it is allowed to have values of structs passed between functions directly instead of using pointers: (...) Would it be possible to allow that in Haskell FFI (...) There are a couple problems with this. First, the storage layout for a given C struct may be radically

[Haskell-cafe] Re: ANN: haskell-src-exts-1.0.0

2009-06-22 Thread Maurí­cio
It is with great pleasure I hereby announce the first stable release of the haskell-src-exts package, version 1.0.0! There's a kind of programming work that have great intelectual impact, as it lets you see your code in diferent ways. Yours, however, is of a special kind, as it has a physical

[Haskell-cafe] Re: Wiki user accounts

2009-06-17 Thread Maurí­cio
I'm hearing reports of people having difficulty obtaining accounts on the Haskell wiki, (...) Maybe OpenID could help with spam problems without the need for manual intervention: I doubt it - I know LiveJournal has a problem with spambots gaining free accounts, and it provides OpenID. They

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

2009-06-17 Thread Maurí­cio
clock http://hackage.haskell.org/package/clock (...) I like the way you use Unicode on operators. It was implemented in response to a haskell-cafe discussion: http://www.mail-archive.com/haskell-cafe@haskell.org/msg51244.html Since I started that, I have to say thanks! Any suggestions for

[Haskell-cafe] Could FFI support pass-by-value of structs?

2009-06-16 Thread Maurí­cio
It's not usual, but it is allowed to have values of structs passed between functions directly instead of using pointers: /*/ struct ex { int x; int y; int z; }; ex example_functions (ex p) { (...) } /*/ Would it be possible to allow that in Haskell FFI by, say, allowing

  1   2   3   >