Re: [Haskell-cafe] Why so many strings in Network.URI, System.Posix and similar libraries?

2012-03-14 Thread Jason Dusek
2012/3/12 Jeremy Shaw jer...@n-heptane.com: On Sun, Mar 11, 2012 at 1:33 PM, Jason Dusek jason.du...@gmail.com wrote: Well, to quote one example from RFC 3986:  2.1.  Percent-Encoding   A percent-encoding mechanism is used to represent a data octet in a   component when that octet's

Re: [Haskell-cafe] Prettier pretty-printing of data types?

2012-03-14 Thread Johan Holmquist
I guess you want an automatically derived show that indents, but if you don't mind defining you own, Data.PrettyPrint is really nice. Here is an example that produces roughly the same as your example: import Data.PrettyPrint tree2doc Leaf = text Leaf tree2doc (Bin x l r) = text Bin $$

Re: [Haskell-cafe] Prettier pretty-printing of data types?

2012-03-14 Thread José Pedro Magalhães
Hi, On Wed, Mar 14, 2012 at 07:54, Johan Holmquist holmi...@gmail.com wrote: I guess you want an automatically derived show that indents, but if you don't mind defining you own, Data.PrettyPrint is really nice. Though most likely any form of pretty-printing will be generic, and can be

Re: [Haskell-cafe] Prettier pretty-printing of data types?

2012-03-14 Thread Heinrich Apfelmus
Christopher Done wrote: Maybe an Emacs script to expand the nodes nicely: http://www.youtube.com/watch?v=6ofEZQ7XoEA I don't find mere pretty printing that useful compared to the “expanding” paradigm I'm used to in Chrome and Firebug. Great demo video. My recent GSoC project suggestions aims

Re: [Haskell-cafe] Why so many strings in Network.URI, System.Posix and similar libraries?

2012-03-14 Thread Graham Klyne
Hi, I only just noticed this discussion. Essentially, I think you have arrived at the right conclusion regarding URIs. For more background, the IRI document makes interesting reading in this context: http://tools.ietf.org/html/rfc3987; esp. sections 2, 2.1. The IRI is defined in terms of

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

2012-03-14 Thread Erik Hesselink
However, be aware that aFields, bFields and cFields are now partial functions that will crash when applied to the wrong constructor. Not a-okay in my book. Erik On Wed, Mar 14, 2012 at 02:24, John Meacham j...@repetae.net wrote: Why not data Super        = SuperA {                

Re: [Haskell-cafe] Adding type annotations to an AST?

2012-03-14 Thread Sean Leather
Hi Stephen, On Mon, Mar 5, 2012 at 08:52, Stephen Tetley wrote: How do I add type annotations to interior locations in an abstract syntax tree? I use an annotated expression tree in my work. The nodes of the AST are annotated with the type, assumption set, and constraint set as described in

[Haskell-cafe] Unable to call function from DLL using FFI

2012-03-14 Thread rajendra prasad
Hi, I am new to Haskell and I need to call a c function by loading dynamic link library in Haskell. I started with very simple code to create a dll in visual studio 2008 and then trying to load it in haskell. I am listing here the steps I follwed to achieve this: *Step 1: * My c++

Re: [Haskell-cafe] Unable to call function from DLL using FFI

2012-03-14 Thread Claude Heiland-Allen
On 14/03/12 14:01, rajendra prasad wrote: My c++ code(HelloWorld.cpp) looks like this: Try adding extern C { ... } to use the C ABI instead of a C++ ABI (which usually features symbol name mangling to add type information, among other things). (This may not solve the entire problem, but is

Re: [Haskell-cafe] Adding type annotations to an AST?

2012-03-14 Thread Stephen Tetley
Hi Sean Many thanks - the note on flow-issues might be particularly helpful for me (last para section 4 introduction). My current code has a bug which maybe this identifies. I'm currently using a modified algorithm M which I believe is top down, I'll switch to algorithm W. Thanks again Stephen

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] An idea to document inter department dependencies in Haskell

2012-03-14 Thread C K Kashyap
Thanks a lot Alberto, Actual code generation is not really my immediate goal ... What my immediate requirement is to validate the consistency of design changes. So essentially, this EDSL would not generate any target code - it's successful compilation would be the desired result and perhaps more

[Haskell-cafe] [ANNOUNCE] JuicyPixels 1.2 - image loading library

2012-03-14 Thread Vincent Berthoux
Hi list, I'm pleased to announce JuicyPixels v1.2, the major feature of the version is the Jpeg writing part. Juicy.Pixels 1.2 change log : - Catching IO exceptions for the read* functions, and embedding them in EIther (thanks to Clark Gaebel). - Adding support for transparent pixel and

Re: [Haskell-cafe] using mutable data structures in pure functions

2012-03-14 Thread wren ng thornton
On 3/11/12 11:52 PM, Ben Gamari wrote: That being said, there are some cases where you really do want to be able to utilize a mutable data structure inside of an otherwise pure algorithm. This is precisely the use of the ST monad. ST serves to allow the use of mutable state inside of a function

Re: [Haskell-cafe] using mutable data structures in pure functions

2012-03-14 Thread Johan Tibell
On Wed, Mar 14, 2012 at 5:50 PM, wren ng thornton w...@freegeek.org wrote: Do note, however, that in certain cases the ST approach can be much slower than the obvious immutable approach (i.e., the State monad--- especially when implemented directly via argument passing, rather than using the

[Haskell-cafe] A new home for haskell-mode

2012-03-14 Thread Johan Tibell
Hi all, After a discussion with Philip Weaver and a few other interested parties in the community we've moved Philip's repo from https://github.com/pheaver/haskell-mode to the new official location at: https://github.com/haskell/haskell-mode You can file bugs/feature requests at:

[Haskell-cafe] Mapping string to a function

2012-03-14 Thread Haisheng Wu
Hi there, Do you have any comments / suggestions for the following scenario? I have two list and a function over list testdata :: [Int] testdata2 :: [Int] f testdata = map g testdata What I like to do is choosing what test data via command line arguments. i.e. test.hs testdata2 will

Re: [Haskell-cafe] Mapping string to a function

2012-03-14 Thread Oliver Batchelor
You could store your test data in a named map e.g. import qualified Data.Map as M import System testSets :: M.Map String [Int] testSets = M.fromList [ (testdata, testdata) , (testdata2, testdata2) ] f :: Int - Something f = main = do [arg] - getArgs case M.lookup arg

Re: [Haskell-cafe] Functional programming podcast

2012-03-14 Thread Clint Moore
We're closing in on a month since this post. Did everyone decide to do their own thing, do nothing, or ? On Wed, Feb 22, 2012 at 7:12 PM, Ryan Newton rrnew...@gmail.com wrote: On Wed, Feb 22, 2012 at 12:00 PM, Clint Moore cl...@ivy.io wrote: On Wed, Feb 22, 2012 at 5:50 AM, Christopher Done