Re: [Haskell-cafe] Simple but interesting (for me) problem

2009-10-21 Thread Alex Queiroz
Hallo,

On 10/21/09, Tim Wawrzynczak inforichl...@gmail.com wrote:
 Here's an example in the IO monad:

 import Data.IORef
 import System.IO.Unsafe

 counter = unsafePerformIO $ newIORef 0

 next = do
   modifyIORef counter (+1)
   readIORef counter

 Naturally, this uses unsafePerformIO, which as you know, is not kosher...


 This is different because counter is global.

Cheers,
-- 
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Creating an alias for a function

2009-10-06 Thread Alex Queiroz
Hallo,

On Tue, Oct 6, 2009 at 11:01 PM, michael rice nowg...@yahoo.com wrote:

 How do I create an alias for a function, like giving CAR the same 
 functionality as HEAD. I know I can do it by creating a definition (see 
 below), but is there a better way, like Scheme's

 (define head car)

 car ::  [a] - a
 car x = head x

 The reason for doing this is to more closely mirror legacy code.


 Just do:

car = head

--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell for Physicists

2009-09-30 Thread Alex Queiroz
Hallo,

On 9/30/09, ed...@ymonad.com ed...@ymonad.com wrote:
 Hi,

  I will give a seminar to physicists at USP (Universidade de São Paulo, 
 Brazil) university and they asked me for a good title, something that can 
 attract physicists. Anyone has some suggestions? (Will be
  a seminar about the use of Haskell to substitute C or Fortran
  in a lot of tasks, and how it can be used in some problems instead of
  Matlab, Mathematica, etc.)


Haskell for physicists ?

-- 
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell programmers in São Carlo s - SP - Brazil?

2009-05-20 Thread Alex Queiroz
Hallo,

On 5/20/09, Diego Souza paravinic...@yahoo.com.br wrote:
 Not exactly São Carlos: São Paulo - SP.


 Me too, Sao Paulo - SP.

Cheers,
-- 
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] compilation to C, not via-C

2009-04-24 Thread Alex Queiroz
Hallo,

On 4/24/09, Bulat Ziganshin bulat.zigans...@gmail.com wrote:

  so, if you just need haskell-C++ interaction, you may look into using
  FFI [1,2]. if you believe that you can compile some
  java/ruby/haskellwhatever code down to C++ and incorporate it into
  your function - sorry, they all have too different computing model


 Actually some Scheme compilers have a c-declare form that lets
you create C functions, which can be called from C, Haskell, Java,
Ruby etc.

Cheers,
-- 
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re[2]: [Haskell-cafe] compilation to C, not via-C

2009-04-24 Thread Alex Queiroz
Hallo,

On 4/24/09, Bulat Ziganshin bulat.zigans...@gmail.com wrote:

 and it supports lazy lists? :) all compiled languages has some FFI, the
  problem is that FFI limited to common subset of all those languages -
  i.e. primitive types and pointers


 I am not saying that Scheme is Haskell. I am just refuting your
assertion that one cannot compile whatever code to C and
incorporate it into your function.

Cheers,
-- 
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] compilation to C, not via-C

2009-04-24 Thread Alex Queiroz
Hallo,

On 4/24/09, Donn Cave d...@avvanta.com wrote:
 Quoth Alex Queiroz asand...@gmail.com,


Actually some Scheme compilers have a c-declare form that lets
   you create C functions, which can be called from C, Haskell, Java,
   Ruby etc.


 That would be like what you get with Haskell FFI export?

  When I do this with nhc98, I need a nhc98 main, and I would expect
  the same with GHC.  Part of the deal would be smuggling in and
  initializing the Haskell runtime.  Also figuring out storage, if
  returning any values from the exported Haskell function (as opposed
  to poking them into address parameters.)  I can see how this would
  not be suitable for a library.


 Incurring the risk of being too much off-topic, I'll just say
that I use the Gambit-C Scheme compiler to produce C code that I link
with my C driver code. I need to write the driver (main and friends)
in C because my software is compiled as a Windows service or POSIX
daemon, which requires special care. But of course you must link in
the Scheme runtime, with the garbage collector, Scheme data types etc.

Cheers,
-- 
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Converting IO [XmlTree] to [XmlTree]

2009-04-14 Thread Alex Queiroz
Hallo,

On 4/14/09, rodrigo.bonifacio rodrigo.bonifa...@uol.com.br wrote:


 Dear Sirs,

 I guess this is a very simple question. How can I convert IO [XmlTree] to
 just a list of XmlTree?


 The short answer is: You cannot. The longer answer is: Only put
things in the IO monad when you need to interact with the outside,
i. e., reading, displaying etc.

Cheers,
-- 
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Against cuteness

2009-03-13 Thread Alex Queiroz
Hallo,

On Fri, Mar 13, 2009 at 1:23 PM, Benjamin L. Russell
dekudekup...@yahoo.com wrote:
 On Fri, 13 Mar 2009 12:29:25 +0100, Achim Schneider bars...@web.de

Water overcomes stone:
Shapeless, it requires no opening:
The benefit of taking no action.

Yet benefit without action,
And experience without abstraction,
Are practiced by very few.

 Nice poem.  Did you write it yourself, or can you document the source?


 If I remember correctly, this is from the Daodejing.

Cheers,
-- 
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] some ideas for Haskell', from Python

2009-01-14 Thread Alex Queiroz
Hallo,

On Wed, Jan 14, 2009 at 5:06 PM, Max Rabkin max.rab...@gmail.com wrote:
 On Wed, Jan 14, 2009 at 10:48 AM, Jonathan Cast
 jonathancc...@fastmail.fm wrote:
 Do you have an example of
 a macro that can't be replaced by higher-order functions and laziness?

 I believe I do: one macro I found useful when writing a web app in
 Lisp was something I called hash-bind, which binds variables to the
 values in a hashtable, with the variable names as keys. For example:


 I have one for binding GET/POST variables to regular variables
transparently and with error checking, just inside the body of the
macro.

-- 
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] some ideas for Haskell', from Python

2009-01-14 Thread Alex Queiroz
Hallo,

On Wed, Jan 14, 2009 at 5:16 PM, Max Rabkin max.rab...@gmail.com wrote:
 On Wed, Jan 14, 2009 at 11:11 AM, Alex Queiroz asand...@gmail.com wrote:
 I have one for binding GET/POST variables to regular variables
 transparently and with error checking, just inside the body of the
 macro.

 N! You reinvented PHP. What happens if a request variable shadows
 the name of another variable used in the body?


 I list the variables I want to bind in the form. I do not ask to
automatically bind all of them. :)

(query-let (id name job salary)
   (if ( salary 1000) ...))

-- 
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] some ideas for Haskell', from Python

2009-01-14 Thread Alex Queiroz
Hallo,

On Wed, Jan 14, 2009 at 8:47 PM, Dougal Stanton ith...@gmail.com wrote:
 (defun avg (rest args)
   (/ (apply #'+ args) (length args)))

 Or as a macro like this:

 (defmacro avg (rest args)
   `(/ (+ ,@args) ,(length args)))

 The reason the macro is better is that the length of the list is known at
 compile time, so you don't need to traverse the list to calculate the length
 of the list.



 I'm trying to work out how awesome the (+) operator is that you can
 add the values together without needing to traverse the list ;-)


 Don't need to traverse the list at run time, not compile
(actually macro-expansion) time.

Cheers,
-- 
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: Salsa: A .NET Bridge for Haskell

2008-10-13 Thread Alex Queiroz
Hallo,

On Fri, Oct 10, 2008 at 5:48 PM, Andrew Coppin
[EMAIL PROTECTED] wrote:
 Don Stewart wrote:

 This could be a game changer.


 In what way? As far as I'm aware, .NET never really caught on and has long
 since become obsolete. Or do you just mean the type system machinery that
 has been developed could be used for other projects?


 In what alternate universe?

-- 
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] New to Haskell

2007-12-19 Thread Alex Queiroz
Hallo,

On Dec 19, 2007 9:25 PM, John Meacham [EMAIL PROTECTED] wrote:

 Actually, it is a pretty fundamental feature of the lisp-derived
 languages that they can self modify their own source, and hence keep
 their own source representation all the way through runtime.


 This is not actually true. You may be thinking of macros, but
macro expansion time is before compile time. After compilation, not
many, if any, modern Lisps keep the source around. Of course the old
Lisp machines were different.

Cheers,
-- 
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Parsing R5RS Scheme with Parsec

2007-10-03 Thread Alex Queiroz
Hallo,

On 10/3/07, Pasqualino 'Titto' Assini [EMAIL PROTECTED] wrote:
 Hi Alex,

 I hope not to spoil your fun but have you had a look at this:

 Write Yourself a Scheme in 48 Hours
 http://halogen.note.amherst.edu/~jdtang/scheme_in_48/tutorial/overview.html


 Yes, I'm actually using it as a basis. But it doesn't parse the
whole R5RS grammar.

Cheers,
-- 
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Parsing R5RS Scheme with Parsec

2007-10-02 Thread Alex Queiroz
Hallo,

 For fun and learning I'm trying to parse R5RS Scheme with Parsec.
The code to parse lists follows:

--
-- Lists
--

parseLeftList :: Parser [SchDatum]
parseLeftList = do
  char '('
  many parseDatum = return . filter (/=  SchAtmosphere)

parseDottedList :: [SchDatum] - Parser SchDatum
parseDottedList ls = do
  char '.'
  many1 parseAtmosphere
  d - parseDatum
  many parseAtmosphere
  char ')'
  return $ SchDottedList ls d

parseProperList :: [SchDatum] - Parser SchDatum
parseProperList ls = do
  char ')'
  return $ SchList ls

parseList :: Parser SchDatum
parseList = do
  ls - parseLeftList
  (parseDottedList ls) | (parseProperList ls)

 I've factored out the common left sub-expression in
parseLeftList. The problem is that ... is a valid identifier so when
inside the left of the list the parser sees a single dot, it tries to
match it with ..., which fails. Can anybody give advice on how to
rewrite these list parsing functions?

Cheers,
-- 
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Parsing R5RS Scheme with Parsec

2007-10-02 Thread Alex Queiroz
Hallo,

On 10/2/07, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote:

 On Oct 2, 2007, at 9:52 , Alex Queiroz wrote:

(parseDottedList ls) | (parseProperList ls)
 
   I've factored out the common left sub-expression in
  parseLeftList. The problem is that ... is a valid identifier so when
  inside the left of the list the parser sees a single dot, it tries to
  match it with ..., which fails. Can anybody give advice on how to
  rewrite these list parsing functions?

try (parseDottedList ls) | parseProperList ls

 Overuse of try is a bad idea because it's slow, but sometimes it's
 the only way to go; it insures backtracking in cases like this.


 This does not work. The parser chokes in parseLeftList, because
it finds a single dot which is not the beginning of 

Cheers,
-- 
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Parsing R5RS Scheme with Parsec

2007-10-02 Thread Alex Queiroz
Hallo,

On 10/2/07, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote:

 Sorry, just woke up and still not quite tracking right, so I modified
 the wrong snippet of code.  The trick is to wrap parseLeftList in a
 try, so the parser retries the next alternative when it fails.


 Since ... can only appear at the end of a list, I removed ...
from the possible symbols and added a new function:

parseThreeDottedList :: [SchDatum] - Parser SchDatum
parseThreeDottedList ls = do
  string ...
  many parseAtmosphere
  char ')'
  return $ SchList $ ls ++ [SchSymbol ...]

parseList :: Parser SchDatum
parseList = do
  ls - parseLeftList
  try (parseThreeDottedList ls) | (parseDottedList ls) |
(parseProperList ls)

 Thanks for the help.

Cheers,
-- 
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Explaining monads

2007-08-14 Thread Alex Queiroz
Hallo,

On 8/14/07, Jeff Polakow [EMAIL PROTECTED] wrote:

 Hello,

 There is clearly a problem with the Haskell/monad tutorials out there...

  The tutorials seriously need to step back and start with
   something like, To enforce order of evaluation we evaluate
   closures* returning a defined type.  The first closure will feed
   its result to the second which will in turn feed it's result to
   the third.  Since the third closure can't be evaluated without
   having the results from the second and first (and thus they had
   to be evaluated earlier in time) we get a defined evaluation
   sequence.  Here are some examples...
  
 The style of this description is nice; however the description itself is
 wrong.

 Monads DO NOT determine order of evaluation. Previous posts on this thread
 give several examples.


 And his point was completely missed.

Cheers,
-- 
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Maintaining the community

2007-07-16 Thread Alex Queiroz

Hallo,

On 7/16/07, Malcolm Wallace [EMAIL PROTECTED] wrote:


OK, so I'm not genuinely suggesting that you must possess or be studying
for a PhD, to grok Haskell.  But I find nothing alarming about the
suggestion that one needs a fairly high level of intelligence, and some
training, in order to be able to use Haskell effectively.



If I say I'm not stupid, would you believe me? I'm not saying
that Visual Basic-level programmers should be able to understand
haskell without a lot more studying and practice. What I'm saying is
that almost every topic in Haskell Café evolves into a very high level
discussion that may frighten some beginners, as it seems that without
a PhD in programming languages and category theory, the language is
not for you.

Cheers,
--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Maintaining the community

2007-07-15 Thread Alex Queiroz

Hallo,

On 7/14/07, Michael T. Richter [EMAIL PROTECTED] wrote:


 While it is understandable, given the intense interest most grognards of any language 
have in playing with the language, for people to enjoy conversations that go into the 
ever-more-esoteric, it is decidedly not helpful to the newcomer striving to understand 
things.  So yes:  Answer politely.  Explain your answer in detail suited to the perceived 
level of the asker.  Clear common misunderstandings.  But do not use this as a launchpad 
into the geek equivalent of language knowledge oneupmanship.  It confuses far more than 
it helps.  If you really need to enter into the game, branch out.  Don't even reply to 
the thread but start a new thread with your reply.  Leave the newcomer to the 
comprehensible side, even if it is perhaps somehow less than perfect by 
whatever standards you choose to measure perfection in.



This is so much true. It has the effect of disguising Haskell as
a PhD-only language.

Cheers,
--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Type system madness

2007-07-11 Thread Alex Queiroz

Hallo,

On 7/11/07, Andrew Coppin [EMAIL PROTECTED] wrote:


When I tell the editor to save UTF-8, it inserts some weird BOM
character at the start of the file - and thus, any attempt at
programatically processing that file instantly fails. :-(



Are you sure it's not UTF-16?

Cheers,
--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Type system madness

2007-07-10 Thread Alex Queiroz

Hallo,

On 7/10/07, Andrew Coppin [EMAIL PROTECTED] wrote:


Last time I looked, everything treats text as being 8 bits per
character. (Or, more commonly, 7, and if the MSB isn't 0, weird things
happen...) That's why (for example) HTML has lots of weird constructs
such as hellip; in it, instead of just typing in the actual character
you want. (And let's be clear here: SGML and all those decendents are
all using  and  - the mathematical greater and less operations -
when what they *really* mean are angle brackets, a quite distinct
glyph.) Last time I checked, nobody was keen on using 64 bits per
character...



You must look out more. I use áéíóúç in web pages all the time.

--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] In-place modification

2007-07-10 Thread Alex Queiroz

Hallo,

On 7/10/07, Sebastian Sylvan [EMAIL PROTECTED] wrote:


I highly doubt that. For two reasons:
1. People can only cling to unproductive and clumsy tools for so long
(we don't write much assembly any more...). Capitalism works to ensure
this; people who are willing to switch to  more efficient tools will
put the rest out of business (if they really are more efficient).


As I replied to Hugh, the Universe of computers is not restricted
to PCs. We, embedded developers, will be using C for a lot of time
still.

Cheers,
--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] In-place modification

2007-07-10 Thread Alex Queiroz

Hallo,

On 7/10/07, Sebastian Sylvan [EMAIL PROTECTED] wrote:


That might eliminate the concurrency imperative (for a while!), but it
doesn't adress the productivity point. My hypothesis is this: People
don't like using unproductive tools, and if they don't have to, they
won't.



So you think we use C because we like it? :-) When this
revolutionary tool of yours arrive that compiles Haskell to PIC
devices, I'm gonna be the first to use it.

Cheers,
--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] In-place modification

2007-07-10 Thread Alex Queiroz

Hallo,

On 7/10/07, Sebastian Sylvan [EMAIL PROTECTED] wrote:


The revolution (tm) won't come at the same time for all domains. C is
probably used/supported in embedded devices mostly because it's
popular for non-embedded devices (not because C is somehow uniquely
suited for embedded devices).


Wrong. Java and C# are far more popular languages, but C is just
the right tool for the job.

Cheers,
--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Collections

2007-06-19 Thread Alex Queiroz

Hallo,

On 6/19/07, Andrew Coppin [EMAIL PROTECTED] wrote:


However, Haskell only has 1 type of collection: linked lists. (And only
single-linked at that.) While other normal programming languages spend
huge amounts of effort trying to select exactly the right collection
type for the task in hand, Haskell programs only ever use linked lists.



   Huh?

--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] IDE?

2007-06-18 Thread Alex Queiroz

Hallo,

On 6/18/07, Michael T. Richter [EMAIL PROTECTED] wrote:


 Screenshots are worthless if they don't match my screen, aren't they?  I guess 
I can open up exactly the same file that's in your screenshot and then use your 
screenshot as a background to my screen so I have the illusion of decent fonts, 
but that's not exactly a productive environment now, is it?



So you'd rather use my image as background instead of compiling
GTK Emacs for you? I've got another idea, why don't you use MS Word?
It can save plain text files.

Cheers,
--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] yi or not to yi was: IDE?

2007-06-18 Thread Alex Queiroz

Hallo,

On 6/18/07, Andrew Coppin [EMAIL PROTECTED] wrote:


OTOH... how the heck do you write an operating system in a language that
doesn't even support I/O? :-S



You can start from here: http://programatica.cs.pdx.edu/House/

Cheers,
--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Implementing Mathematica

2007-05-30 Thread Alex Queiroz

Hallo,

On 5/30/07, Andrew Coppin [EMAIL PROTECTED] wrote:


OK, so you're saying that in 4 days you wrote something that
out-performs Mathematica, a program that has existed for decades and has
a vast, highly-funded RD effort behind it featuring some of the
brightest minds in the field?

I'm in a state of disbelief here.



If you want some amusement, just search for Jon Harrop in comp.lang.lisp.

--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Editor

2007-05-21 Thread Alex Queiroz

Hallo,

On 5/21/07, Michael T. Richter [EMAIL PROTECTED] wrote:


 Oh, and of course it wasn't just the config files I showed problems with, now, 
was it?  I seem to remember something about modality and bad syntax 
highlighting.  Maybe I was tripping.  It happens.



   You may not like modality, it's entirely within your rights, but
it is *not* a problem. Fortunately it's still there for the millions
of us who like it.

--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Poor first impression

2007-04-27 Thread Alex Queiroz

Hallo,

On 4/27/07, Fernando Cassia [EMAIL PROTECTED] wrote:


 Goodbye Haskell, I just wanted to compile a MP3 player, and perhaps if the
compiler installed OK with no issues, I'd have taken a look at the language.
But as of right now, I don't have time to waste with broken compiler
installers.

 Byebye


Haskell waves back, yelling 'good bye!' while the distance
between them increases. As a last thought, feeling sorry for the poor
boy, it raises a sign that reads: 'Newer Linux distributions come with
libreadline.so.5 only (e.g. SuSE 9.2), so we have provided a readline4
compatiblity RPM  for this case.'

Cheers,
--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Multi Line String literals

2007-04-26 Thread Alex Queiroz

Hallo,

On 4/26/07, Neil Mitchell [EMAIL PROTECTED] wrote:


Like the cpp will choke and die :) Multiline string literals were one
of the motivations for cpphs.



Does cpphs allow me to include a whole file into a Haskell source
file, inserting automatically the string gaps?

--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Multi Line String literals

2007-04-26 Thread Alex Queiroz

Hallo,

On 4/26/07, Neil Mitchell [EMAIL PROTECTED] wrote:


No, but Hugs does with Here documents.



Unfortunately I'm using GHC but thanks!

Cheers,
--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Why Perl is more learnable than Haskell

2007-04-12 Thread Alex Queiroz

Hallo,

On 4/12/07, kynn [EMAIL PROTECTED] wrote:


Hi.  I can't find that post.  Could you point it to me please?



It's in here:
http://cgi.cse.unsw.edu.au/~dons/blog/2007/03/10#programmable-semicolons

--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Why Perl is more learnable than Haskell

2007-04-11 Thread Alex Queiroz

Hallo,

On 4/11/07, riccardo cagnasso [EMAIL PROTECTED] wrote:

The post on dons' blog about the cpu scaler is a great example on how
haskell can easily used in the day-to-day hacking!



Just read it, it's a very nice post. I'm not afraid of math, but
it's a relief to see some code I can relate with. :-)

--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: A question about functional dependencies and existential

2007-03-29 Thread Alex Queiroz

Hallo,

On 3/29/07, Nicolas Frisby [EMAIL PROTECTED] wrote:

A wee bit off topic... but bear with me.



More off-topic... but bear with me. :-)

I'm starting with Haskell. I'm writing a real application with Gtk2hs
and HDBC for a small furniture shop. I have enjoyed it very much so
far, and I like the productivity boost. But I do not understand GADTs
or functional dependencies yet.

When I read threads such as this I begin to think. Are these black
magic type skills necessary for day-to-day work, or just for tasks not
doable in other languages, or at least not doable without much effort?
Are they for working around some problems of HM type systems or do
they give Haskell super-language powers? I guess I could answer these
questions if I understood what FD and GATDs are all about, but I'm not
just there yet. :-)

Cheers,
--
-alex
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Newbie vs. laziness

2007-03-20 Thread Alex Queiroz

Hallo list,

I don't quite get how ($!) works. I have this function:

dbCreateIndices con dtn dof = do
  let dummy = newDbItem
  let query = SELECT id FROM  ++ (dtn dummy) ++  ORDER BY  ++ (dof dummy)
  ids - liftM (map fromSql . concat ) $! quickQuery con query []
  return $ IntMap.fromList $ zip ids [0..]

quickQuery returns a lazy list of results, and I expected ($!) to make
it strict. But my program crashes if I use it this way. But, if I add
a print to the function:

dbCreateIndices con dtn dof = do
  let dummy = newDbItem
  let query = SELECT id FROM  ++ (dtn dummy) ++  ORDER BY  ++ (dof dummy)
  ids - liftM (map fromSql . concat ) $! quickQuery con query []
  print ids
  return $ IntMap.fromList $ zip ids [0..]

print makes the ids list strict and all is well. How is the correct
way to use ($!) ?

Cheers,
--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Newbie vs. laziness

2007-03-20 Thread Alex Queiroz

Hallo,

On 3/20/07, Jules Bean [EMAIL PROTECTED] wrote:


What $! does is force its arguments into WHNF before applying the
function. WHNF means, roughly, either a lambda or a constructor at the
top-level.



I think I got it now.



However that's a bit clumsy. What kind of error are you seeing when you
say 'it crashes'?



I must fetch all rows of the result, otherwise the database will
be in an inconsistent state and all subsequent queries crash the
application. Fetching all rows automatically finishes the previous
statement, so I must evaluate the spine of the list.

Cheers,
--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Newbie vs. laziness

2007-03-20 Thread Alex Queiroz

Hallo,

On 3/20/07, Jules Bean [EMAIL PROTECTED] wrote:


Personally I'd inclined to suggest use of the strict FetchRow which the
library provides than struggle with explicit uses of seq to fight an
over-lazy IO action.



Sounds like a good suggestion. Thanks very much for the help!

Cheers,
--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Read Instance for UArray won't port to linux

2007-03-14 Thread Alex Queiroz

Hallo,

On 3/14/07, Simon Peyton-Jones [EMAIL PROTECTED] wrote:

Ah, a fine idea.  I'll do that anyway; maybe others will have even better 
ideas, but that's a good start



Ah! So now I knows what it means. I've also been beaten by this
error message a couple of days ago.

Cheers,
--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: HDBC Windows binaries with SQLite 3 support

2007-03-06 Thread Alex Queiroz

Hallo,

On 3/6/07, John Goerzen [EMAIL PROTECTED] wrote:

I should add, though, that you were pointing to the old HDBC site.

Please download HDBC from http://software.complete.org/hdbc/downloads

The Sqlite3 driver is at
http://software.complete.org/hdbc-sqlite3/downloads

The quux.org download site will go away.



The links to the API docs from the wiki do not work.

Cheers,
--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] HDBC Windows binaries with SQLite 3 support

2007-03-05 Thread Alex Queiroz

Hallo list,

I guess the subject line says it all. Can anybody help me?

--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: HDBC Windows binaries with SQLite 3 support

2007-03-05 Thread Alex Queiroz

Hallo,

On 3/5/07, ArtemGr [EMAIL PROTECTED] wrote:


My instructions (i made it for myself! provided as is):



Worked after some tweaks for my system. It was actually much
easier than I thought. Thanks very much!

--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] LGPL libraries

2007-03-05 Thread Alex Queiroz

Hallo,

Gtk2Hs and HDBC are both LGPL licensed, but aren't they always
static linked? Is there a way to use them in closed-source programs?

Cheers,
--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] LGPL libraries

2007-03-05 Thread Alex Queiroz

Hallo,

On 3/5/07, Duncan Coutts [EMAIL PROTECTED] wrote:


If you're really worried (but I wouldn't be) then do recall that the
static linking thing only requires that the end user be able to relink
with a different version that preserves the same ABI. So you don't have
to provide source for your closed source app, you'd just need to provide
all the .o / .a files you need to link together to produce your final
program. So it's a bit of a hassle but it does meet the requirements of
the LGPL and allows a closed source app.



Yeah,  was pĺanning to send an object file with the application
to allow relinking. I was just curious about the LGPL because GHC
always links everything statically. Thanks for the thorough answer!

Cheers,
--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] basic field questions

2007-01-24 Thread Alex Queiroz

Hallo,

On 1/24/07, jamin1001 [EMAIL PROTECTED] wrote:


So then how should this be done?  What if I want to do something like

data Chair = Chair {pos:: Int, color :: Int}
data Table = Table {pos:: Int, color :: Int}



   data Chair = Chair { chairPos :: Int, chairColor :: Int }



Also, could someone tell me why this doesn't compile in GHC:

data Test = A {a::Int} | B {a::Int, b::Int}
data Test2 = C {c::A}



'A' is not a type, is a constructor for type 'Test'.

--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] basic field questions

2007-01-24 Thread Alex Queiroz

Hallo,

On 1/24/07, Ketil Malde [EMAIL PROTECTED] wrote:

jamin1001 wrote:
 What if I want to do something like

 data Chair = Chair {pos:: Int, color :: Int}
 data Table = Table {pos:: Int, color :: Int}

data Properties = Props { pos, color :: Int }
data Chair = Chair Props
data Table = Table Props



Do you mean:

data Chair = Chair Properties
data Table = Table Properties

?

--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Beta Gtk2Hs Getting Started

2007-01-09 Thread Alex Queiroz

Hallo,

On 1/8/07, Hans van Thiel [EMAIL PROTECTED] wrote:

Thanks, I didn't know that. What other widget libraries are supported at
this time?



Only GTK+. :-)

--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Beta Gtk2Hs Getting Started

2007-01-08 Thread Alex Queiroz

Hallo,

On 1/8/07, Hans van Thiel [EMAIL PROTECTED] wrote:

Hello All,

The beta of the 'Gtk2Hs:Getting Started' short tutorial for beginners,
Haskell GUI for Dummies, if you like :-) can be viewed at
http://j-van-thiel.speedlinq.nl/gtk2hs/gtk2hsGetStart.html



Nitpicking: Glade does not belong to GTK+, neither does libglade,
which are independent projects.

--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Building the community

2006-12-14 Thread Alex Queiroz

Hallo,

On 12/14/06, Paul Moore [EMAIL PROTECTED] wrote:


But overall I'd agree, this is a very helpful community - it's just
that you all seem so much cleverer than I, so I'm not sure I'll ever
be smart enough to write Haskell programs :-) (50% joke...)



I know the feeling. :-)

--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Aim Of Haskell

2006-12-13 Thread Alex Queiroz

Hallo,

On 12/13/06, Claus Reinke [EMAIL PROTECTED] wrote:


we have had lots of languages that were intended to be well-designed
(good, beautiful, ..), but never much used in practice, and we have also
had lots of languages that were intended to be pragmatic (practical,
useful, ..), without much interest in theoretical beauty. but how many
languages are there where the two aspects have converged, with both
communities still actively interested in the result?



Lua is a small scripting language created in academia, whose
authors are academics,  that has reached the industry embedded in
several well-known products such as World of Warcraft or Adobe
Lightroom (which is 40% Lua). Frequently people ask for bloat in the
mailing list, and the usual answer is why?. The authors claim that
when thinking about a new version of Lua they don't think of features
to add, but what features they can remove.
So I'd say it's perfectly possible to have an academia-backed
language useful for the real world.
Cheers,

--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Large data structures

2006-12-12 Thread Alex Queiroz

Hallo,

On 12/11/06, Matthew Brecknell [EMAIL PROTECTED] wrote:


Yes. Take a look at Data.Map. This data structure provides various
operations which create a new map from an old one in O(log n) time, by
splicing bits of the old map into the new one. Importantly, performing
any of these operations does not destroy the old map if your code still
references it. On the other hand, if your code drops references to the
old map, then the garbage collector can reclaim any branches of the old
map not used in the new one. You may also be interested in this paper:

http://www.cs.cmu.edu/~rwh/theses/okasaki.pdf



Thanks for the info and the link, looks interesting.
Cheers,

--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Large data structures

2006-12-12 Thread Alex Queiroz

Hallo,

On 12/12/06, Benjamin Franksen [EMAIL PROTECTED] wrote:

Alex Queiroz wrote:
 On 12/11/06, Stefan O'Rear [EMAIL PROTECTED] wrote:
 No.  Haskell's lists are linked lists, enlarge creates a single new link
 without modifying (and copying) the original.
  Thanks. Is there a way to mimic this behaviour with my own code?

It is the default for any data structure you define. Data is by default
represented internally as a pointer to the actual value. Otherwise
recursive structures (see below for an example) would not be easily
possible. And since no part of the data structure is 'mutable', different
instances can share (memory-wise) as much of their structure as the
implementation is able to find.



Ok, I think I got it now. :-)



PS: Please try to include exactly the relevant context in replies, no more,
no less. Your original question (stripped down to the body of the text)
would have been relevant, here, but neither 'Hello', nor 'Cheers' are worth
quoting.



Sorry, but I did not quote hello or cheers.

--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Large data structures

2006-12-11 Thread Alex Queiroz

Hi all,

I'm considering the use of Haskell to manipulate large data
structures for Computer Graphics (large geometric datasets). I'm
wondering what's the best way to do it. As objects (not in the OO
sense) in Haskell are immutable, how can I add a vertex to a large
mesh without using obscene amounts of memory? Making an analogy:


enlarge :: a - [a] - [a]
enlarge c cs = c : cs

enlarge 15 [1..10]


Will this copy the whole list to make a new one with an element more?
Cheers,

--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Large data structures

2006-12-11 Thread Alex Queiroz

Hallo,

On 12/11/06, Stefan O'Rear [EMAIL PROTECTED] wrote:


No.  Haskell's lists are linked lists, enlarge creates a single new link
without modifying (and copying) the original.
___


Thanks. Is there a way to mimic this behaviour with my own code?
Cheers,

--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: The Future of MissingH

2006-11-27 Thread Alex Queiroz

Hallo,

On 11/27/06, Max Vasin [EMAIL PROTECTED] wrote:


A small addition: some GPLed libraries (libstdc++ AFAIK) allow
linking with proprietary software by adding clause to lisence
which relaxes GPL requirements.



Nope, it's LGPL with an extra binary linking permission.
Cheers,

--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: best Linux for GHC?

2006-11-13 Thread Alex Queiroz

Hallo,

On 11/13/06, Mark T.B. Carroll [EMAIL PROTECTED] wrote:


How up to date will Debian unstable's GHC be kept, though? It seems
pretty good at the moment, but there have been times when we've had to
install from source instead of via Debian earlier this year so that we
had GHC features and bugfixes in place - the Debian version has got
rather out of date at times with respect to stuff we needed.



No OpenGL neither Gtk2hs in Debian Sid yet. :-(

--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Is Haskell a 5GL?

2006-09-25 Thread Alex Queiroz

Hallo,

On 9/25/06, Ch. A. Herrmann [EMAIL PROTECTED] wrote:

Hi,

Henning Thielemann wrote:

 assembly language (Assembler ist deutsch :-)

for mysterious reasons it entered the English world.



'Assembly' is a language. 'Assembler' is a program.

--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Haskell web forum

2006-09-21 Thread Alex Queiroz

Hallo,

On 9/21/06, Bill Wood [EMAIL PROTECTED] wrote:

I have only recently started accessing some web fora, but I've noticed
that some of those powered by phpBB are vulnerable to spamming,
whereas the news groups seem to be less so.  For example, the
python-forum has nearly lost it's General forum to spammers.  Maybe
the experts know better engines, better ways to set up a forum, or
better ways to administer them after they're up, but it is a concern.



I only hope this mailing list will continue. I can't stand the
slowness/spams/avatar/size of web fora.

--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] does the compiler optimize repeated calls?

2006-09-06 Thread Alex Queiroz

Hallo,

On 9/6/06, Tamas K Papp [EMAIL PROTECTED] wrote:


PS: I realize that I am asking a lot of newbie questions, and I would
like to thank everybody for their patience and elucidating replies.


   I am a newbie myself (second week of learning Haskell), but I'll
give it a shot: Since functions have no side effects, the compiler
executes the function only once.

--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: does the compiler optimize repeated calls?

2006-09-06 Thread Alex Queiroz

Hallo,

On 9/6/06, Lennart Augustsson [EMAIL PROTECTED] wrote:

Furthermore, doing that optimization (common subexpression
elimination) can lead to space leaks.  So you should not count on the
compiler doing it.  Besides, I often find it more readable and less
error prone to name a common subexpression; only one place to change
when you need to change the call.



So there is no benefits from the functions have no side-effects
property, performance-wise. Pity.

--
-alex
http://www.ventonegro.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe