Re: split (was Re: [Haskell-cafe] Simple program. Simple problem?)

2009-10-11 Thread Reid Barton
On Sun, Oct 11, 2009 at 08:17:48PM -0400, Reid Barton wrote:
> It seems that the definition of split in System.Random is not really
> satisfactory.  

For the curious, the reason for the asymmetry between fst . split and
snd . split is that the RNG states produced by mkStdGen have varying
first component but second component (virtually) always equal to 1.
For full details see http://hackage.haskell.org/trac/ghc/ticket/3575

Regards,
Reid Barton
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Documentation (was: ANN: text 0.5, a major revision of the Unicode text library)

2009-10-11 Thread Derek Elkins
On Sun, Oct 11, 2009 at 8:55 AM, Iain Barnett  wrote:
>
> On 11 Oct 2009, at 13:58, John Lato wrote:
>
>> For anyone writing introductions to generic programming, take this as
>> a plea from Haskellers everywhere.  If one of the RWH authors can't
>> understand how to make use of these techniques, what hope do the rest
>> of us have?
>>
>> John Lato
>>
>> P.S. Some might wryly note that I'm the maintainer of a package which
>> is also known for incomprehensible documentation.  To which I would
>> reply that our effort is much newer, I consider it a problem, and it's
>> being worked on, contrasted to the state of GP where similarly
>> impenetrable documentation has been and continues to be the norm.
>>
>
> You could say that about most documentation (for Haskell and beyond).
> Apparently, programmers like programming better than documenting. The effect
> of this is that less people use their programming, making their efforts
> redundant.
>
> Silly really, considering programmers are (allegedly:) intelligent.

Apparently, programmers like programming better than reading as
well... in my experience.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Libraries for Commercial Users

2009-10-11 Thread Mark Wotton


On 11/10/2009, at 8:11 AM, Don Stewart wrote:


brad.larsen:


With this hypothetical ``import foreign jvm'' mechanism, what would
the be type of imported Java stuff?  Would it all be done in IO?

The more I think about it, the trickier it seems.  Beside the purity
mismatch of Haskell and Java, there is an OO/functional mismatch.


That's more of an issue. But the prior work has been done.


At the risk of exposing my ignorance: would you recommend any  
particular papers?
Hubris has a particularly restricted model of this, simply because I  
don't know how to approach it in a more comprehensive fashion.


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


Re: [Haskell-cafe] Re: Libraries for Commercial Users

2009-10-11 Thread wren ng thornton

Patrick LeBoutillier wrote:

Don,


Having painless Haskell <- Java interoperability would be great.  I'm
curious though:  could it really be so simple as a one-line ``import
foreign jvm'' directive?  I imagine the purity mismatch between
Haskell and Java would be very troublesome.

No more so than C, surely. We're used to stateful APIs. They're a pain.



With this hypothetical ``import foreign jvm'' mechanism, what would
the be type of imported Java stuff?  Would it all be done in IO?

The more I think about it, the trickier it seems.  Beside the purity
mismatch of Haskell and Java, there is an OO/functional mismatch.

That's more of an issue. But the prior work has been done.


Do you have any references to this work?



It was a major research topic about a decade ago, though the projects 
have died since. And the topic comes up about every 4 months on the 
Cafe, so I'd recommend sifting through the archives. I know last time it 
came up (or the time before?) I gave a rather extensive list of 
projects. And the wiki[1] still lists a few of them.


The last time this discussion came up people got involved enough to 
revive LambdaVM[2], which was one of the more mature options back in the 
day. If you're interested in the topic, I suggest getting in touch with 
the author and helping out.


On the topic of automatically embedding OO-style languages into Haskell, 
you should also check out hprotoc[3]. It's a package for Google's 
protocol buffers, which are ostensibly language agnostic but actually 
assume a (weakly) OO language. The hprotoc library will create a family 
of virtual modules based on the protocol spec and makes a pretty nice 
interface out of them.



[1] 
http://www.haskell.org/haskellwiki/Applications_and_libraries/Interfacing_other_languages

[2] http://wiki.brianweb.net/LambdaVM/LambdaVM
[3] http://hackage.haskell.org/package/hprotoc

--
Live well,
~wren
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


split (was Re: [Haskell-cafe] Simple program. Simple problem?)

2009-10-11 Thread Reid Barton
It seems that the definition of split in System.Random is not really
satisfactory.  Imagine a tree-like computation of the form

f gen = {- some expression using b, g1, g2 -}
  where b = fst (random gen) :: Bool
(gen1, gen2) = split gen
g1 = f gen1
g2 = f gen2

Let's look at the first 30 values of b produced along the right side
of the tree:

GHCi> length $ nub [ take 30 . map (fst . random) . iterate (snd . split) $ 
mkStdGen i :: [Bool] | i <- take 1 . randoms $ mkStdGen 0 ]
1

Great, we tried 1 different initial gens and got 1 different
sequences.  Now let's look at the left side:

GHCi> length $ nub [ take 30 . map (fst . random) . iterate (fst . split) $ 
mkStdGen i :: [Bool] | i <- take 1 . randoms $ mkStdGen 0 ]
8

This doesn't seem good.

Michael's code (below) is effectively doing iterate (fst . split).

Regards,
Reid Barton

On Sun, Oct 11, 2009 at 04:24:55PM -0700, michael rice wrote:
> main = do
>   gen <- getStdGen
>   coinToss gen
>   gen <- newStdGen
>   main
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Simple program. Simple problem?

2009-10-11 Thread michael rice
For the code below, if I CNTL-C after the list is printed, and run it again, I 
get a different list of colors, each time. This doesn't seem to be happening 
with my earlier example.

Michael

=

import System.Random
import Data.Ord

data Color
    = Red
    | Blue
    | Green
    | Yellow
    | Orange
    | Brown
    deriving (Show, Read, Eq, Enum, Ord, Bounded)

main = do
  gen <- getStdGen
  let code = map toEnum $ take 4 $ randomRs (0,5) gen :: [Color]
  putStrLn $ "List is " ++ show code
  guessString <- getLine
  newGen <- newStdGen
  main 


--- On Sun, 10/11/09, Felipe Lessa  wrote:

From: Felipe Lessa 
Subject: Re: [Haskell-cafe] Simple program. Simple problem?
To: haskell-cafe@haskell.org
Date: Sunday, October 11, 2009, 7:08 PM

On Mon, Oct 12, 2009 at 12:42:16AM +0200, Peter Verswyvelen wrote:
> btw I always find it amusing to play with interact and lazy IO:

I always find it frightening to play with lazy IO :).

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



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


Re: [Haskell-cafe] Simple program. Simple problem?

2009-10-11 Thread michael rice
There's still something screwy going on here with the random generation or 
passing the gen to cointoss. Shouldn't newStdGen be updating getStdGen?

I've been running it and entering 'h' four (4) times, then aborting with CNTL-C.
Each time I either get

You lose!
You lose!
You win!
You lose!

or

You win!
You win!
You lose!
You win!

That's all, should be getting some variation.

Michael

==

import System.Random

coinToss :: StdGen -> IO ()
coinToss gen = putStrLn "What's your guess, heads or tails ('h' or 't')?"
   >> fmap head getLine
   >>= \c -> let (randInt, _) = randomR(0,1) gen :: (Int, StdGen)
 in if c == ((!!) "ht" randInt) then putStrLn "You 
win!" else putStrLn "You lose!"

main = do
  gen <- getStdGen
  coinToss gen
  gen <- newStdGen
  main


--- On Sun, 10/11/09, Felipe Lessa  wrote:

From: Felipe Lessa 
Subject: Re: [Haskell-cafe] Simple program. Simple problem?
To: haskell-cafe@haskell.org
Date: Sunday, October 11, 2009, 7:08 PM

On Mon, Oct 12, 2009 at 12:42:16AM +0200, Peter Verswyvelen wrote:
> btw I always find it amusing to play with interact and lazy IO:

I always find it frightening to play with lazy IO :).

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



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


Re: [Haskell-cafe] Simple program. Simple problem?

2009-10-11 Thread Felipe Lessa
On Mon, Oct 12, 2009 at 12:42:16AM +0200, Peter Verswyvelen wrote:
> btw I always find it amusing to play with interact and lazy IO:

I always find it frightening to play with lazy IO :).

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


Re: [Haskell-cafe] Simple program. Simple problem?

2009-10-11 Thread michael rice
Thanks for the tip, and the lazy example.



I think I'm finally beginning to "get" monads, so I decided to test my
understanding with this small example. So far so good, except for that
little bump in the road.



Onward and upward.



Michael


--- On Sun, 10/11/09, Peter Verswyvelen  wrote:

From: Peter Verswyvelen 
Subject: Re: [Haskell-cafe] Simple program. Simple problem?
To: "michael rice" 
Cc: haskell-cafe@haskell.org
Date: Sunday, October 11, 2009, 6:42 PM

btw I always find it amusing to play with interact and lazy IO:
guess :: [Char] -> [String] -> [String]guess (c:cs) ~(i:is) =   "What's your 
guess, heads or tails ('h' or 't')?" : 
  (if [c]==i then "You win!" else "You lose!") :  guess cs is 
main = do  gen <- getStdGen  let rs = randomRs  (0,1::Int) gen
      cs = map ("ht"!!) rs  interact $ unlines . guess cs . lines


On Mon, Oct 12, 2009 at 12:24 AM, Peter Verswyvelen  wrote:

It always helps to put a Debug.Trace.trace:
                    in if trace (show (fromEnum c)) $ c == ((!!) "ht" randInt) 
then p

What's your guess, heads or tails ('h' or 't')?
h104You win!What's your guess, heads or tails ('h' or 't')?10You lose!What's 
your guess, heads or tails ('h' or 't')?


So getChar also receives the linefeed character.
An easy way to get around this, is to use getLine instead and just use the 
first character, as in


               >> fmap head getLine 
But of course we're hacking away here :-)

On Mon, Oct 12, 2009 at 12:10 AM, michael rice  wrote:



What is going wrong here?


Michael

===

import System.Random

coinToss :: StdGen -> IO ()
coinToss gen = putStrLn "What's your guess, heads or tails ('h' or 't')?"
   >> getChar


   >>= \c -> let (randInt, _) = randomR(0,1) gen :: (Int, StdGen)
    in if c == ((!!) "ht" randInt) then putStrLn "You win!" 
else putStrLn "You lose!"



main = do
 gen <- getStdGen
 coinToss gen
 gen
 <- newStdGen
 main

===

[mich...@localhost ~]$ runhaskell cointoss.hs
What's your guess, heads or tails ('h' or 't')?
h
You win!
What's your guess, heads or tails ('h' or 't')?


You lose!
What's your guess, heads or tails ('h' or 't')?
h
You lose!
What's your guess, heads or tails ('h' or 't')?
You lose!
What's your guess, heads or tails ('h' or 't')?


^Ccointoss.hs: cointoss.hs: interrupted
[mich...@localhost ~]$ 






  
___

Haskell-Cafe mailing list

Haskell-Cafe@haskell.org

http://www.haskell.org/mailman/listinfo/haskell-cafe









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


Re: [Haskell-cafe] Simple program. Simple problem?

2009-10-11 Thread Peter Verswyvelen
btw I always find it amusing to play with interact and lazy IO:
guess :: [Char] -> [String] -> [String]
guess (c:cs) ~(i:is) =
  "What's your guess, heads or tails ('h' or 't')?" :
  (if [c]==i then "You win!" else "You lose!") :
  guess cs is

main = do
  gen <- getStdGen
  let rs = randomRs  (0,1::Int) gen
  cs = map ("ht"!!) rs
  interact $ unlines . guess cs . lines



On Mon, Oct 12, 2009 at 12:24 AM, Peter Verswyvelen wrote:

> It always helps to put a Debug.Trace.trace:
> in if trace (show (fromEnum c)) $ c == ((!!) "ht"
> randInt) then p
>
> What's your guess, heads or tails ('h' or 't')?
> h
> 104
> You win!
> What's your guess, heads or tails ('h' or 't')?
> *10*
> You lose!
> What's your guess, heads or tails ('h' or 't')?
>
> So getChar also receives the linefeed character.
>
> An easy way to get around this, is to use getLine instead and just use the
> first character, as in
>
>>> fmap head getLine
>
> But of course we're hacking away here :-)
>
> On Mon, Oct 12, 2009 at 12:10 AM, michael rice  wrote:
>
>> What is going wrong here?
>>
>> Michael
>>
>> ===
>>
>> import System.Random
>>
>> coinToss :: StdGen -> IO ()
>> coinToss gen = putStrLn "What's your guess, heads or tails ('h' or 't')?"
>>>> getChar
>>>>= \c -> let (randInt, _) = randomR(0,1) gen :: (Int,
>> StdGen)
>> in if c == ((!!) "ht" randInt) then putStrLn "You
>> win!" else putStrLn "You lose!"
>>
>> main = do
>>  gen <- getStdGen
>>  coinToss gen
>>  gen <- newStdGen
>>  main
>>
>> ===
>>
>> [mich...@localhost ~]$ runhaskell cointoss.hs
>> What's your guess, heads or tails ('h' or 't')?
>> h
>> You win!
>> What's your guess, heads or tails ('h' or 't')?
>> You lose!
>> What's your guess, heads or tails ('h' or 't')?
>> h
>> You lose!
>> What's your guess, heads or tails ('h' or 't')?
>> You lose!
>> What's your guess, heads or tails ('h' or 't')?
>> ^Ccointoss.hs: cointoss.hs: interrupted
>> [mich...@localhost ~]$
>>
>>
>>
>> ___
>> Haskell-Cafe mailing list
>> Haskell-Cafe@haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>>
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: What *is* a DSL?

2009-10-11 Thread Brandon S. Allbery KF8NH

On Oct 11, 2009, at 18:00 , Ben Franksen wrote:

Ben Franksen wrote:

Ben Franksen wrote:

Next thing I'll try is to transform such a grammar into an actual
parser...


Which I also managed to get working.


First, before all this talking to myself here is boring you to  
death, please
shout and I'll go away. Anyway, at least one person has privately  
expressed

interest, so I'll post my code for the translation.(*)


It's -cafe, so let 'er rip.  And maybe write it up for TMR, if you  
don't want to set up a blog with all the goodies?


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




PGP.sig
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Simple program. Simple problem?

2009-10-11 Thread Peter Verswyvelen
It always helps to put a Debug.Trace.trace:
in if trace (show (fromEnum c)) $ c == ((!!) "ht"
randInt) then p

What's your guess, heads or tails ('h' or 't')?
h
104
You win!
What's your guess, heads or tails ('h' or 't')?
*10*
You lose!
What's your guess, heads or tails ('h' or 't')?

So getChar also receives the linefeed character.

An easy way to get around this, is to use getLine instead and just use the
first character, as in

   >> fmap head getLine

But of course we're hacking away here :-)

On Mon, Oct 12, 2009 at 12:10 AM, michael rice  wrote:

> What is going wrong here?
>
> Michael
>
> ===
>
> import System.Random
>
> coinToss :: StdGen -> IO ()
> coinToss gen = putStrLn "What's your guess, heads or tails ('h' or 't')?"
>>> getChar
>>>= \c -> let (randInt, _) = randomR(0,1) gen :: (Int,
> StdGen)
> in if c == ((!!) "ht" randInt) then putStrLn "You win!"
> else putStrLn "You lose!"
>
> main = do
>  gen <- getStdGen
>  coinToss gen
>  gen <- newStdGen
>  main
>
> ===
>
> [mich...@localhost ~]$ runhaskell cointoss.hs
> What's your guess, heads or tails ('h' or 't')?
> h
> You win!
> What's your guess, heads or tails ('h' or 't')?
> You lose!
> What's your guess, heads or tails ('h' or 't')?
> h
> You lose!
> What's your guess, heads or tails ('h' or 't')?
> You lose!
> What's your guess, heads or tails ('h' or 't')?
> ^Ccointoss.hs: cointoss.hs: interrupted
> [mich...@localhost ~]$
>
>
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Simple program. Simple problem?

2009-10-11 Thread michael rice
What is going wrong here?

Michael

===

import System.Random

coinToss :: StdGen -> IO ()
coinToss gen = putStrLn "What's your guess, heads or tails ('h' or 't')?"
   >> getChar
   >>= \c -> let (randInt, _) = randomR(0,1) gen :: (Int, StdGen)
    in if c == ((!!) "ht" randInt) then putStrLn "You win!" 
else putStrLn "You lose!"

main = do
 gen <- getStdGen
 coinToss gen
 gen <- newStdGen
 main

===

[mich...@localhost ~]$ runhaskell cointoss.hs
What's your guess, heads or tails ('h' or 't')?
h
You win!
What's your guess, heads or tails ('h' or 't')?
You lose!
What's your guess, heads or tails ('h' or 't')?
h
You lose!
What's your guess, heads or tails ('h' or 't')?
You lose!
What's your guess, heads or tails ('h' or 't')?
^Ccointoss.hs: cointoss.hs: interrupted
[mich...@localhost ~]$ 




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


[Haskell-cafe] Re: What *is* a DSL?

2009-10-11 Thread Ben Franksen
Ben Franksen wrote:
> Ben Franksen wrote:
>> Next thing I'll try is to transform such a grammar into an actual
>> parser...
> 
> Which I also managed to get working.

First, before all this talking to myself here is boring you to death, please
shout and I'll go away. Anyway, at least one person has privately expressed
interest, so I'll post my code for the translation.(*)

> {-# LANGUAGE ExistentialQuantification, GADTs, Rank2Types #-}
> {-# LANGUAGE TypeSynonymInstances, MultiParamTypeClasses,
ImpredicativeTypes #-}
> import qualified Text.ParserCombinators.Parsec as P

Note that I have parameterized everything on the token (terminal) type. Here
are the data types, adapting the rest of the code is completely mechanical.

> data Production nt t a
> =   Stopa
> |   Terminalt  (Production nt t a)
> | forall b. NonTerminal (nt b) (Production nt t (b -> a))

> newtype Rule nt t a = Rule [Production nt t a]

> type RuleSet nt t = forall a. nt a -> Rule nt t a

> type Grammar nt t b = (nt b, RuleSet nt t)

I should probably turn this into a proper data type, which would BTW also
make the ImpredicativeTypes extension unnecessary.

Translation to Parsec
-

We restrict ourselves to Char as terminals for simplicity. The
generalization to arbitrary token types would need another three arguments:
showTok :: (tok -> String), nextPos :: (SourcePos -> tok -> [tok] ->
SourcePos), and testTok :: (tok -> Maybe a), which are needed by
P.tokenPrim.

> parseGrammar :: Print nt => Grammar nt Char a -> P.Parser a
> parseGrammar (start,rules) = parseNonTerminal rules start

> parseNonTerminal :: Print nt => RuleSet nt Char -> nt a -> P.Parser a
> parseNonTerminal rs nt = parseRule rs (rs nt) P. pr nt

> parseRule :: Print nt => RuleSet nt Char -> Rule nt Char a -> P.Parser a
> parseRule rs (Rule ps) = P.choice (map ({- P.try . -} parseProduction rs)
ps)

> parseProduction :: Print nt => RuleSet nt Char -> Production nt Char a ->
P.Parser a
> parseProduction _  (Stop x) = return x
> parseProduction rs (Terminal c p) = P.char c >> parseProduction rs p
> parseProduction rs (NonTerminal nt p) = do
>   vnt <- parseNonTerminal rs nt
>   vp <- parseProduction rs p
>   return (vp vnt)

This is really not difficult, once you understand how the list-like
Production type works. The trick is that a NonTerminal forces the "rest" of
the production to return a function type, so you can apply its result to
the result of parsing the nonterminal. Whereas the result of parsing
terminals gets ignored by the "rest" of the production. You might wonder
how the code manages to return the correct integer values inside an ENum.
Well, I did, at least. I don't yet understand it completely but I think the
answer is in in the Functor and Applicative instances: all the code that
interprets syntactic elements (up to the abstract syntax) inside the myGrm
function gets pushed down through the elements of a production until it
ends up at a Stop, where we can finally pull it out (see the first clause
of parseProduction).

Note also the (commented-out) use of P.try in function parseRule. Let's try
it:

*Main> putStrLn (printGrammar myGrm)
*Start ::= Sum
Sum ::= Product '+' Sum | Product
Product ::= Value '*' Product | Value
Value ::= Number | '(' Sum ')'
Number ::= Digit Number | Digit
Digit ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
*Main> P.parseTest (parseGrammar myGrm) "2*(2+52)"
parse error at (line 1, column 2):
unexpected "*"
expecting Number

After re-inserting the P.try call, I can actually parse expressions (yay!):

*Main> :r
[1 of 1] Compiling Main ( Grammar.lhs, interpreted )
Ok, modules loaded: Main.
*Main> P.parseTest (parseGrammar myGrm) "2*(2+52)"
EProduct (ENum 2) (ESum (ENum 2) (ENum 52))

BTW, does anyone know a source (books, papers, blogs, whatever) about
algorithms for automatic left-factoring? I searched with google and found
some interesting papers on eliminating left recursion but nothing so far on
left-factoring. Have these problems all been solved before the internet
age?

Cheers
Ben

(*) One of these days I really should get my hands dirty and set up a
weblog; suggestions for how to proceed are appreciated. I would especially
like something where I can just upload a literate Haskell file and it gets
formatted automagically. Bonus points for beautifying operator symbols a la
lhs2tex ;-)

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


[Haskell-cafe] SDL build problem

2009-10-11 Thread Henk-Jan van Tuyl


L.S.,

I am trying to install SDL, but I get error messages about multiple  
definition of `main'; before I spend many hours of debugging, does anybody  
know why this happens? See the log below.


Regards,
Henk-Jan van Tuyl


C:\Programs\Haskell\Libs\SDL-0.5.5>runhaskell Setup configure  
--extra-include-dirs=C:\Programs\MSYS\1.0\include\SDL


Setup.lhs:2:2:
Warning: In the use of `defaultUserHooks'
 (imported from Distribution.Simple):
 Deprecated: "Use simpleUserHooks or autoconfUserHooks, unless  
you need Cabal-1.2
 compatibility in which case you must stick with  
defaultUserHooks"

Warning: defaultUserHooks in Setup script is deprecated.
Configuring SDL-0.5.5...
checking for sdl-config... /usr/bin/sdl-config
configure: creating ./config.status
config.status: creating config.mk
config.status: creating SDL.buildinfo
config.status: creating includes/HsSDLConfig.h
config.status: includes/HsSDLConfig.h is unchanged

C:\Programs\Haskell\Libs\SDL-0.5.5>runhaskell Setup build

Setup.lhs:2:2:
Warning: In the use of `defaultUserHooks'
 (imported from Distribution.Simple):
 Deprecated: "Use simpleUserHooks or autoconfUserHooks, unless  
you need Cabal-1.2
 compatibility in which case you must stick with  
defaultUserHooks"

Preprocessing library SDL-0.5.5...
dist\build\Graphics\UI\SDL\General_hsc_make.o:General_hsc_make.c:(.text+0x0):  
multiple definition of `main'
C:\Programs\ghc\ghc-6.10.4/gcc-lib/libmingw32.a(main.o):main.c:(.text+0x0):  
first defined here
C:/Programs/MinGW/lib/libSDLmain.a(SDL_win32_main.o): In function  
`console_main':
/Users/hercules/trunk/SDL-1.2/./src/main/win32/SDL_win32_main.c:246:  
undefined reference to `SDL_main'

collect2: ld returned 1 exit status
linking dist\build\Graphics\UI\SDL\General_hsc_make.o failed
command was: C:\Programs\ghc\ghc-6.10.4\gcc.exe  
-BC:\Programs\ghc\ghc-6.10.4\gcc-lib  
-IC:\Programs\ghc\ghc-6.10.4\include\mingw -lSDL -L/usr/lib -lmingw32  
-lSDLmain -lSDL -mwindows -LC:\Programs\ghc\ghc-6.10.4\base-4.1.0.0  
-lwsock32 -luser32 -lshell32 -LC:\Programs\ghc\ghc-6.10.4\integer-0.1.0.1  
-LC
:\Programs\ghc\ghc-6.10.4\ghc-prim-0.1.0.0 -LC:\Programs\ghc\ghc-6.10.4  
-LC:\Programs\ghc\ghc-6.10.4/gcc-lib -lm -lffi -lgmp -lwsock32  
dist\build\Graphics\UI\SDL\General_hsc_make.o -o  
dist\build\Graphics\UI\SDL\General_hsc_make.exe




--

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


Re: [Haskell-cafe] Haskell-tan competition

2009-10-11 Thread Svein Ove Aas
On Sun, Oct 11, 2009 at 5:58 PM, Paul Johnson  wrote:
> What about Lambdabot?
>
You're welcome to draw one for her. :-)

-- 
Svein Ove Aas
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell Weekly News: Issue 134 - October 10, 2009

2009-10-11 Thread Ben Franksen
Patrick LeBoutillier wrote:
> Could/should the Haskell Weekly News be posted to the beginners list as
> well?
> 
> I normally don't follow haskell-cafe (too much traffic and generally above
> my level I must admit...), but I like to follow what's going on in the
> Haskell community.

I find reading the HWN is a lot is a lot more convenient with a web browser,
you don't have to jump up and down the document to find the links. There is
also an RSS feed (http://sequence.complete.org/node/feed) to keep you up to
date.

Cheers
Ben

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


[Haskell-cafe] Re: What *is* a DSL?

2009-10-11 Thread Ben Franksen
Ben Franksen wrote:
> Next thing I'll try is to transform such a grammar into an actual
> parser...

Which I also managed to get working. However, this exposed yet another
problem I am not sure how to solve.

The problem manifests itself with non-left-factored rules like

  Number ::= Digit Number | Digit

Translating such a grammar directly into a Parsec parser leads to parse
errors because Parsec's choice operator is predictive: if a production has
consumed any input the whole choice fails, even if alternative productions
would not:

*Main> P.parseTest (parseGrammar myGrm) "2"
parse error at (line 1, column 2):
unexpected end of input
expecting Number

Of course, one solution is to apply Parsec's try combinator to all choices
in a rule. But this rather defeats the purpose of using a (by default)
predictive parser in the first place which is to avoid unnecessary
backtracking.

So, a better solution is to left-factor the grammar before translating to
Parsec. Since we have a data representation of the grammar that we can
readily analyse and transform, this should be possible given some suitable
algorithm. But how is this transformation to be typed?

My first naive attempt was to define (recap: nt :: * -> * is the type of
nonterminals, t :: * is the type of terminals a.k.a. tokens, and a is the
result type):

> leftFactor :: Grammar nt t a -> Grammar nt t a

Of course, this is wrong:  Left-factoring is expected to introduce new
nonterminals, so on the right-hand side of the type we should not have the
same 'nt' as on the left. Instead we shoudl have some other type that
is "'nt' extended with new constructors". Moreover, we cannot statically
know how many new nonterminals are added, so we cannot simply apply a type
function to nt. Is this solvable at all in Haskell or do I need proper
dependent types to express this?

I have very vague ideas that revolve around setting up some recursive type
function that on each level adds one constructor, define a common interface
with a (multiparam) type class and then use existential quantification in
the result type to hide the resulting type of nonterminals.

The next question is: Even if this turns out to be possible, isn't it
overkill? Maybe it is better to use an infinite type for the nonterminals
in the first place and let the grammar be a partial function? OTOH, the
formulation of the grammar as a function that pattern matches on the
nonterminals is very elegant.

Cheers
Ben

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


[Haskell-cafe] Re: [Haskell] The Monad.Reader (14) - Call for copy

2009-10-11 Thread Brent Yorgey
Er, correction, obviously that should be Issue 15, not 14.  The submission
deadline is correct, though! =)


On Sun, Oct 11, 2009 at 02:34:54PM -0400, Brent Yorgey wrote:
> Call for Copy: The Monad.Reader - Issue 14
> --
> 
> Whether you're an established academic or have only just started
> learning Haskell, if you have something to say, please consider
> writing an article for The Monad.Reader! The submission deadline for
> Issue 14 will be:
> 
>   **Friday, January 8, 2010**
> 
> 
> The Monad.Reader
> 
> 
> The Monad.Reader is a electronic magazine about all things Haskell.
> It is less formal than journal, but somehow more enduring than a
> wiki-page. There have been a wide variety of articles: exciting code
> fragments, intriguing puzzles, book reviews, tutorials, and even
> half-baked research ideas.
> 
> Submission Details
> ~~
> 
> Get in touch with me if you intend to submit something -- the sooner
> you let me know what you're up to, the better.
> 
> Please submit articles for the next issue to me by e-mail (byorgey at
> cis.upenn.edu).
> 
> Articles should be written according to the guidelines available from
> 
> http://themonadreader.wordpress.com/contributing/
> 
> Please submit your article in PDF, together with any source files you
> used. The sources will be released together with the magazine under a
> BSD license.
> 
> If you would like to submit an article, but have trouble with LaTeX
> please let me know and we'll sort something out.
> 
> 
> ___
> Haskell mailing list
> hask...@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] The Monad.Reader (14) - Call for copy

2009-10-11 Thread Brent Yorgey
Call for Copy: The Monad.Reader - Issue 14
--

Whether you're an established academic or have only just started
learning Haskell, if you have something to say, please consider
writing an article for The Monad.Reader! The submission deadline for
Issue 14 will be:

  **Friday, January 8, 2010**


The Monad.Reader


The Monad.Reader is a electronic magazine about all things Haskell.
It is less formal than journal, but somehow more enduring than a
wiki-page. There have been a wide variety of articles: exciting code
fragments, intriguing puzzles, book reviews, tutorials, and even
half-baked research ideas.

Submission Details
~~

Get in touch with me if you intend to submit something -- the sooner
you let me know what you're up to, the better.

Please submit articles for the next issue to me by e-mail (byorgey at
cis.upenn.edu).

Articles should be written according to the guidelines available from

http://themonadreader.wordpress.com/contributing/

Please submit your article in PDF, together with any source files you
used. The sources will be released together with the magazine under a
BSD license.

If you would like to submit an article, but have trouble with LaTeX
please let me know and we'll sort something out.


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


Re: [Haskell-cafe] Re: Libraries for Commercial Users

2009-10-11 Thread John A. De Goes

On Oct 10, 2009, at 12:47 PM, Brad Larsen wrote:

With this hypothetical ``import foreign jvm'' mechanism, what would
the be type of imported Java stuff?  Would it all be done in IO?


Yes, that's a good first-start.


The more I think about it, the trickier it seems.  Beside the purity
mismatch of Haskell and Java, there is an OO/functional mismatch.


That just means an extra argument to every function and some unsafe  
downcasts; and maybe some funky mechanism for subclassing, for those  
libraries that require it (deprecated in modern OOP but not uncommon).



Haskell / Java interop could be a huge boon; I just have trouble
seeing how it could be so simple as a one-line import in your Haskell
code.


I'm not saying the one-line import would give you anything more than  
purely imperative wrappers around Java code. But that's a start. It's  
"good enough". If it existed, I could transition two companies over to  
Haskell, and likely more in the future.


Regards,

John A. De Goes
N-Brain, Inc.
The Evolution of Collaboration

http://www.n-brain.net|877-376-2724 x 101


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


Re: [Haskell-cafe] Re: Libraries for Commercial Users

2009-10-11 Thread John A. De Goes


I don't have any research, but anecdotally, I know numerous startups,  
and most of them are producing web applications (usually client and  
server, but sometimes server only). Those doing desktop and mobile  
apps usually do server development, too, because in the age of  
ubiquitous network connectivity, applications that cannot take  
advantage of the Internet are few and far between.


Most internal development is in the form of web apps (it's rare to see  
a company that produces desktop applications for in-house use), and  
most job postings today are for client-side developers (JavaScript,  
CSS/HTML, Flash) or server-side developers (Java, PHP, Ruby, etc.).


Regards,

John A. De Goes
N-Brain, Inc.
The Evolution of Collaboration

http://www.n-brain.net|877-376-2724 x 101

On Oct 10, 2009, at 12:11 PM, John Melesky wrote:


On 2009-10-09, at 7:53 PM, John A. De Goes wrote:

The vast majority of applications being built today are web apps.


I'm not convinced this is the case. There are still a great many  
enterprise desktop apps and mobile apps being built, and the  
selection bias towards internet-based applications on a mailing list  
(not to mention the selection bias in blogs, reddit, etc).


I'm not saying you're wrong, just that i'd love to see some research  
into it.


-johnnn



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


Re: [Haskell-cafe] Re: Libraries for Commercial Users

2009-10-11 Thread John A. De Goes

On Oct 9, 2009, at 10:37 PM, Curt Sampson wrote:


So this makes me wonder, if cross-platform support is so necessary,
why have these PHP, Ruby and Python folks not switched to Java, rather
than remain suffering doing their development on Linux boxes?


PHP runs on all platforms (it's common for developers to test locally  
on Windows/Mac, and deploy to a Linux server), and has such an  
extensive library that most other libraries a developer might need are  
likely to be pure PHP, built on top the base. So while not "cross  
platform" in the sense that Java is, the approach taken by PHP  
achieves much of the benefit.[1]


Moreover, PHP is a perfect example of the principle that libraries are  
essential to language success. PHP's standard library is so immense,  
it includes just about everything the average web developer needs. And  
many functions it provides are very high-level -- for example,  
file_get_contents() works seamlessly across local files, http files,  
https files, etc.


PHP never would have achieved the success it has if it weren't for the  
immense library available for it (of course, it's not the sole factor  
in its success).



And if libraries are the issue, why would not just creating a SWIG for
GHC make all of these people move to Haskell?


Making it possible and making it easy are two different things. It's  
already _possible_ to do Haskell interop with any other language, it's  
just difficult and cumbersome.


Moreover, Haskell will never attract the following of a mainstream  
language like PHP. But there are numerous applications where Haskell  
is clearly a superior choice assuming library equality.


I agree it's a nich market, too. So I guess our point of  
disagreement is

that you believe that it's lack of libraries keeping it a nich market,


Haskell will never be "popular", because it's too hard for the masses.  
But I could see big companies like Yahoo, Facebook, Google, etc.,  
using Haskell extensively to develop web infrastructure -- _if_ there  
were no longer a significant penalty to doing so. Right now the  
barrier of entry is too high, because too much infrastructure would  
have to be developed from scratch, and then maintained at cost.



That just seems pointless to me, because those looking for real
improvements can't use that sort of stuff. When I need RDBMS access,
libraries like Hibernate and Active Record are useless to me, because
they force me to work in a stupid manner. For web sites, Rails is
useless because again, it deals with stuff in a stupid, unproductive
way.


Well, I don't know much about Rails, but I do know some Rails  
developers can build a fully-functional, database-backed Web 2.0 site  
in a matter of hours.[2] That level of productivity is not available  
in Haskell yet.


Put another way, it would cost me far more to hire you to develop a  
Haskell site than a good Rails developer,[3] and what a Rails  
developer produces can be deployed at numerous Rails hosting sites at  
no upfront cost to me. So why should I hire you?


[1] The Haskell Platform could eventually take Haskell in a similar  
direction, it it provides a broad enough base that developers can  
built nearly any other library directly on top of it.

[2] 
http://www.readwriteweb.com/archives/rails_rumble_92_web_apps_created_in_48_hours.php
[3] The difference in cost is strictly due to libraries. If you had  
some killer Haskell libraries at your disposal, I have no doubt you  
could do it for less than a Rails developer.


Regards,

John A. De Goes
N-Brain, Inc.
The Evolution of Collaboration

http://www.n-brain.net|877-376-2724 x 101


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


Re: [Haskell-cafe] Haskell-tan competition

2009-10-11 Thread Paul Johnson

What about Lambdabot?

On 10/10/09 20:22, Miguel Mitrofanov wrote:
Just a note: Haskell and 'tan' in one sentence, combined with some 
girlish flavour, makes me think about Audrey TANg.


On 10 Oct 2009, at 23:02, Svein Ove Aas wrote:


I say "competition", but.. at the moment I'm only aware of a single
Haskell-tan, namely the one at
http://www.reddit.com/r/programming/comments/9ss7n/haskell%E3%82%BF%E3%83%B3_%E7%B5%B5/. 



This cannot stand. Haskell needs an anthropomorphized personification,
like any other modern language. Anyway, have any of you seen any
others?

--
Svein Ove Aas
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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



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


Re[2]: [Haskell-cafe] ANN: text 0.5, a major revision of the Unicode text library

2009-10-11 Thread Bulat Ziganshin
Hello Neil,

Sunday, October 11, 2009, 5:58:51 PM, you wrote:

> I had a crack at a simple proper Data instance, and got as far as
> needing a Data instance for ByteString#, accompanied by an error I don't

impossible. i'm not sure wher i've read this but those # types (Int#,
ByteArray# and so on) are not regular Haskell types. they cannot be
class instances, cannot be passed to polymorphic functions and so on


-- 
Best regards,
 Bulatmailto:bulat.zigans...@gmail.com

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


Re: [Haskell-cafe] Haskell Weekly News: Issue 134 - October 10, 2009

2009-10-11 Thread Joe Fredette
I'm happy to tack it on to the sendout, but as others have mentioned,  
subscription to haskell-general (to use GManes nomenclature) is  
probably the better option. -beginners, iirc, is principally for  
questions, not community content. Is this the consensus over there?


I'll do whatever you folks decide on...

/Joe


On Oct 11, 2009, at 8:10 AM, Patrick LeBoutillier wrote:


Hi,

Could/should the Haskell Weekly News be posted to the beginners list  
as well?


I normally don't follow haskell-cafe (too much traffic and generally  
above my level I must admit...), but I like to follow what's going  
on in the Haskell community.



Patrick

On Sat, Oct 10, 2009 at 3:47 AM,  wrote:

---
Haskell Weekly News
http://sequence.complete.org/hwn/20091010
Issue 134 - October 10, 2009
---
  Welcome to issue 134 of HWN, a newsletter covering developments in  
the

  [1]Haskell community.

  What with Don Stewart's [2]call to [3]arms to lead Haskell to  
conquest

  over (E)DSL-land, I've once again tried to highlight discussion of
  EDSL's this week. Fortunately, it was actually more difficult  
choosing

  what _not_ to include this week, since there was so much discussion
  about DSLs and Syntax extensions (a related notion, in my opinion).
  Also, this week Bryan O'Sullivan put his Criterion Library to good  
use
  on the `text` package, leading to [4]code which is more than ten  
times
  faster than before! With all this fantastic news, I won't hold you  
up

  any longer, Haskellers, the Haskell Weekly News!

Announcements

  CfPart: FMICS 2009, 2-3 November 2009, Final Call. FMICS 2009  
workshop

  chair [5]announced the final call for particpaction for FMICS 2009

  ICFP videos now available. Wouter Swierstra [6]announced the
  availablity of videos from the International Conference on  
Functional

  Programming (ICFP)

  GPipe-1.0.0: A functional graphics API for programmable GPUs. Tobias
  Bexelius [7]announced the first release of GPie, a functional  
graphics

  API for programmable GPUs.

  text 0.5, a major revision of the Unicode text library. Bryan
  O'Sullivan [8]announced a new, major version of the text package.  
New

  API features, and huge improvments in speed, as Bryan says, 'Get it
  while it's fresh on Hackage, folks!'

  vty-ui 0.2. Jonathan Daugherty [9]announced a new version of the  
vty-ui

  package, with fewer bugs, more widgets, and cleaner code due to new
  more powerful abstractions.

  htzaar-0.0.1. Tom Hawkins [10]announced HTZAAR, a Haskell
  implementation of TZAAR

  Graphalyze-0.8.0.0 and SourceGraph-0.5.5.0. Ivan Lazar Miljenovic
  [11]announced To keep this editor happy, Ivan released two new  
packaged

  in one announcement. This time, he's added Legend support to
  Graphalyze, but also many new changes to SourceGraph, including a
  legend so you can see what all the symbols mean, Better color  
support,

  and much more.

  TxtSushi 0.4.0. Keith Sheppard [12]announced a new version of  
TxtSushi,

  a set of command line utilities for processing CSV and TSV files.

Discussion

  Applicative do? Philippa Cowderoy [13]asked about a `do` like syntax
  for Applicative functors.

  How to add use custom preprocessor in cabal. Bernd Brassel [14]asked
  how to add a custom preprocessor to the build chain of a cabal file.

  On DSLs - one last time. Gunther Schmidt [15]summarized his  
impressions

  on al the recent discussion of DSLs

  What is a DSL? Oleg [16]offered some insight into different
  [17]properties that can be part of a single tagless framework. He  
also
  pointed to some slides and other materials such as a website  
[18]here

  and slides [19]here about DSL implementations and definitions.

  What is a DSL? Gunther Schmidt [20]posed the question, 'What is a  
DSL',

  and with some further questions added by yours truly, a lively
  discussion about the definition of a DSL ensued.

  Finally tagless - stuck with implementation of 'lam'. Gunther  
Schmidt
  [21]asked another question about Finally Tagless DSLs and  
resolving an

  issue with the implementation of 'lam'

Blog noise

  [22]Haskell news from the [23]blogosphere. Blog posts from people  
new
  to the Haskell community are marked with >>>, be sure to welcome  
them!

* Darcs: [24]darcs weekly news #43.
* JP Moresmau: [25]What client for an Haskell Multi Player Game?.
* Mikael Vejdemo Johansson (Syzygy-): [26][MATH198] Third  
lecture is

  up.
* Bryan O'Sullivan: [27]Announcing a major revision of the Haskell
  text library.
* Eric Kow (kowey): [28]darcs hashed-storage work merged (woo!).
* David Amos: [29]Symmetries of PG(n,Fq).
* The GHC Team: [30]Parallelism /= Concurrency.
* >>> Nefigah: [31]Fake World Haskell. Nefigah, a recent  
addition to
  the community, has been working through RWH, and is providing  
s

Re: [Haskell-cafe] a library for control of terminal driver modes?

2009-10-11 Thread Andrew Coppin

Iain Barnett wrote:
I'm looking for a library like Perl's Term-Readkey, so that I can turn 
on and off the echo for secure password input from a terminal. Anyone 
know which library I need to use for this?


The package ansi-terminal allows you to do various things to the 
terminal; I think it might include turning local echo on/off. 
Alternatively, there was an announcement recently about a text-mode UI 
package, which might do what you want. (I don't recall the name...)


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


Re: [Haskell-cafe] ANN: text 0.5, a major revision of the Unicode text library

2009-10-11 Thread Neil Brown

Bryan O'Sullivan wrote:
On Fri, Oct 9, 2009 at 8:33 AM, Jeremy Shaw > wrote:



What are the chances of seeing a, instance Data Text, some day?


I might as well follow up here, since I've sent Jeremy a couple of 
messages on this subject.


I think maybe someone else will have to take a crack at a Data 
instance for Text, because the documentation for Data.Data is not 
written in English. In its syntax and structure, it closely hews to 
what we think of as English, but it is the kind of documentation that 
can only be understood by someone who already knows what it is going 
to say.


This is an exemplar of my experience with the cottage industry of 
generic programming in Haskell: I'd really quite like to use the 
stuff, but for goodness's sake, o beloved researchers, please aim your 
expository papers at non-specialists once in a while. An endless chain 
of papers of the form "my technique, which you won't understand, is 
better than this other technique, which you haven't read about and 
won't anyway understand, in subtle ways that you won't understand" 
does not feel to me like progress.
Data is probably the most complex bit of Haskell I've seen, and pretty 
much needs a full paper to have an idea of what's going on, so I'm not 
sure it's a typical piece of Haskell (nor even a typical bit of generic 
programming) to pick on.


I had a crack at a simple proper Data instance, and got as far as 
needing a Data instance for ByteString#, accompanied by an error I don't 
fully understand, but I think is telling me that things involving magic 
hashes are magic:


Data/Text/Array.hs:104:35:
   Couldn't match kind `#' against `*'
   When matching the kinds of `ByteArray# :: #' and `d :: *'
 Expected type: d
 Inferred type: ByteArray#
   In the first argument of `z', namely `Array'

What is the Data instance required for here, exactly?  Is it generic 
transformations, or for generic serialisation (or some other need)?  It 
may be possible to fake the Data instance to cover the needed aspects.  
I'm not in favour of the boxing/unboxing that Jeremy suggested, because 
Text doesn't really contain a String, but I'm also not sure that a real 
Data instance (exposing all the innards) is that great either.


By the way: text-0.5 doesn't build for me on my GHC 6.8.2 system with 
base-3, mainly because you are assuming the class-based exception 
mechanism from base-4 in the Data.Text.Encoding.Error module, without 
using the extensible-exceptions package.  I'm happy to knock up some 
patches that fixes it, if you still want to support that configuration?


Thanks,

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


Re: [Haskell-cafe] Documentation (was: ANN: text 0.5, a major revision of the Unicode text library)

2009-10-11 Thread Iain Barnett


On 11 Oct 2009, at 13:58, John Lato wrote:


For anyone writing introductions to generic programming, take this as
a plea from Haskellers everywhere.  If one of the RWH authors can't
understand how to make use of these techniques, what hope do the rest
of us have?

John Lato

P.S. Some might wryly note that I'm the maintainer of a package which
is also known for incomprehensible documentation.  To which I would
reply that our effort is much newer, I consider it a problem, and it's
being worked on, contrasted to the state of GP where similarly
impenetrable documentation has been and continues to be the norm.



You could say that about most documentation (for Haskell and beyond).  
Apparently, programmers like programming better than documenting. The  
effect of this is that less people use their programming, making  
their efforts redundant.


Silly really, considering programmers are (allegedly:) intelligent.

Iain


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


[Haskell-cafe] a library for control of terminal driver modes?

2009-10-11 Thread Iain Barnett
I'm looking for a library like Perl's Term-Readkey, so that I can  
turn on and off the echo for secure password input from a terminal.  
Anyone know which library I need to use for this?


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


[Haskell-cafe] Documentation (was: ANN: text 0.5, a major revision of the Unicode text library)

2009-10-11 Thread John Lato
For anyone writing introductions to generic programming, take this as
a plea from Haskellers everywhere.  If one of the RWH authors can't
understand how to make use of these techniques, what hope do the rest
of us have?

John Lato

P.S. Some might wryly note that I'm the maintainer of a package which
is also known for incomprehensible documentation.  To which I would
reply that our effort is much newer, I consider it a problem, and it's
being worked on, contrasted to the state of GP where similarly
impenetrable documentation has been and continues to be the norm.

>
> From: "Bryan O'Sullivan" 
>
> I think maybe someone else will have to take a crack at a Data instance for
> Text, because the documentation for Data.Data is not written in English. In
> its syntax and structure, it closely hews to what we think of as English,
> but it is the kind of documentation that can only be understood by someone
> who already knows what it is going to say.
>
> This is an exemplar of my experience with the cottage industry of generic
> programming in Haskell: I'd really quite like to use the stuff, but for
> goodness's sake, o beloved researchers, please aim your expository papers at
> non-specialists once in a while. An endless chain of papers of the form "my
> technique, which you won't understand, is better than this other technique,
> which you haven't read about and won't anyway understand, in subtle ways
> that you won't understand" does not feel to me like progress.
>
> Yours in some misery and frustration,
> Bryan.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: How do I get this done in constant mem?

2009-10-11 Thread Ben Franksen
mf-hcafe-15c311...@etc-network.de wrote:
> On Sat, Oct 10, 2009 at 11:11:24PM +0200, Daniel Fischer wrote:
>> No, readFile reads the file lazily.
> 
> hm?  oh, you are right, now that i fixed all the other problems in my
> code readFile isn't a problem any more either...  (-:
> 
> (but then how does it know when to close the handle?  gotta go read
> the code i guess.)

It is somewhat documented, see
http://www.haskell.org/ghc/docs/latest/html/libraries/base/System-IO.html
or http://www.haskell.org/onlinelibrary/io.html, section 21.2.2 Semi-Closed
Handles:

"[...] A semi-closed handle becomes closed:
 * if hClose is applied to it; 
 * if an I/O error occurs when reading an item from the handle; 
 * or once the entire contents of the handle has been read."

It is not stated here that the file /immediately/ gets closed after the last
byte has been read. Does that mean implementations are free to postpone
closing (e.g. until the next GC cycle)?

Cheers
Ben

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


Re: [Haskell-cafe] Haskell Weekly News: Issue 134 - October 10, 2009

2009-10-11 Thread Max Rabkin
Why don't you subscribe to haskell? It's much lower volume, and I
think it's a better option than taking -beginners off-topic.

--Max

On Sun, Oct 11, 2009 at 2:10 PM, Patrick LeBoutillier
 wrote:
> Hi,
>
> Could/should the Haskell Weekly News be posted to the beginners list as
> well?
>
> I normally don't follow haskell-cafe (too much traffic and generally above
> my level I must admit...), but I like to follow what's going on in the
> Haskell community.
>
>
> Patrick
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Libraries for Commercial Users

2009-10-11 Thread Patrick LeBoutillier
Don,

>
> > Having painless Haskell <- Java interoperability would be great.  I'm
> > curious though:  could it really be so simple as a one-line ``import
> > foreign jvm'' directive?  I imagine the purity mismatch between
> > Haskell and Java would be very troublesome.
>
> No more so than C, surely. We're used to stateful APIs. They're a pain.
>
>
> > With this hypothetical ``import foreign jvm'' mechanism, what would
> > the be type of imported Java stuff?  Would it all be done in IO?
> >
> > The more I think about it, the trickier it seems.  Beside the purity
> > mismatch of Haskell and Java, there is an OO/functional mismatch.
>
> That's more of an issue. But the prior work has been done.
>

Do you have any references to this work?

I'm quite interested in this, both from a Haskell perpective (although I'm
still a beginner) and from being the author of a Perl <-> Java
interoperability module (see http://search.cpan.org/~patl/Inline-Java-0.52/).


Thanks,

Patrick


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




-- 
=
Patrick LeBoutillier
Rosemère, Québec, Canada
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell Weekly News: Issue 134 - October 10, 2009

2009-10-11 Thread Patrick LeBoutillier
Hi,

Could/should the Haskell Weekly News be posted to the beginners list as
well?

I normally don't follow haskell-cafe (too much traffic and generally above
my level I must admit...), but I like to follow what's going on in the
Haskell community.


Patrick

On Sat, Oct 10, 2009 at 3:47 AM,  wrote:

>
> ---
> Haskell Weekly News
> http://sequence.complete.org/hwn/20091010
> Issue 134 - October 10, 2009
> ---
>   Welcome to issue 134 of HWN, a newsletter covering developments in the
>   [1]Haskell community.
>
>   What with Don Stewart's [2]call to [3]arms to lead Haskell to conquest
>   over (E)DSL-land, I've once again tried to highlight discussion of
>   EDSL's this week. Fortunately, it was actually more difficult choosing
>   what _not_ to include this week, since there was so much discussion
>   about DSLs and Syntax extensions (a related notion, in my opinion).
>   Also, this week Bryan O'Sullivan put his Criterion Library to good use
>   on the `text` package, leading to [4]code which is more than ten times
>   faster than before! With all this fantastic news, I won't hold you up
>   any longer, Haskellers, the Haskell Weekly News!
>
> Announcements
>
>   CfPart: FMICS 2009, 2-3 November 2009, Final Call. FMICS 2009 workshop
>   chair [5]announced the final call for particpaction for FMICS 2009
>
>   ICFP videos now available. Wouter Swierstra [6]announced the
>   availablity of videos from the International Conference on Functional
>   Programming (ICFP)
>
>   GPipe-1.0.0: A functional graphics API for programmable GPUs. Tobias
>   Bexelius [7]announced the first release of GPie, a functional graphics
>   API for programmable GPUs.
>
>   text 0.5, a major revision of the Unicode text library. Bryan
>   O'Sullivan [8]announced a new, major version of the text package. New
>   API features, and huge improvments in speed, as Bryan says, 'Get it
>   while it's fresh on Hackage, folks!'
>
>   vty-ui 0.2. Jonathan Daugherty [9]announced a new version of the vty-ui
>   package, with fewer bugs, more widgets, and cleaner code due to new
>   more powerful abstractions.
>
>   htzaar-0.0.1. Tom Hawkins [10]announced HTZAAR, a Haskell
>   implementation of TZAAR
>
>   Graphalyze-0.8.0.0 and SourceGraph-0.5.5.0. Ivan Lazar Miljenovic
>   [11]announced To keep this editor happy, Ivan released two new packaged
>   in one announcement. This time, he's added Legend support to
>   Graphalyze, but also many new changes to SourceGraph, including a
>   legend so you can see what all the symbols mean, Better color support,
>   and much more.
>
>   TxtSushi 0.4.0. Keith Sheppard [12]announced a new version of TxtSushi,
>   a set of command line utilities for processing CSV and TSV files.
>
> Discussion
>
>   Applicative do? Philippa Cowderoy [13]asked about a `do` like syntax
>   for Applicative functors.
>
>   How to add use custom preprocessor in cabal. Bernd Brassel [14]asked
>   how to add a custom preprocessor to the build chain of a cabal file.
>
>   On DSLs - one last time. Gunther Schmidt [15]summarized his impressions
>   on al the recent discussion of DSLs
>
>   What is a DSL? Oleg [16]offered some insight into different
>   [17]properties that can be part of a single tagless framework. He also
>   pointed to some slides and other materials such as a website [18]here
>   and slides [19]here about DSL implementations and definitions.
>
>   What is a DSL? Gunther Schmidt [20]posed the question, 'What is a DSL',
>   and with some further questions added by yours truly, a lively
>   discussion about the definition of a DSL ensued.
>
>   Finally tagless - stuck with implementation of 'lam'. Gunther Schmidt
>   [21]asked another question about Finally Tagless DSLs and resolving an
>   issue with the implementation of 'lam'
>
> Blog noise
>
>   [22]Haskell news from the [23]blogosphere. Blog posts from people new
>   to the Haskell community are marked with >>>, be sure to welcome them!
> * Darcs: [24]darcs weekly news #43.
> * JP Moresmau: [25]What client for an Haskell Multi Player Game?.
> * Mikael Vejdemo Johansson (Syzygy-): [26][MATH198] Third lecture is
>   up.
> * Bryan O'Sullivan: [27]Announcing a major revision of the Haskell
>   text library.
> * Eric Kow (kowey): [28]darcs hashed-storage work merged (woo!).
> * David Amos: [29]Symmetries of PG(n,Fq).
> * The GHC Team: [30]Parallelism /= Concurrency.
> * >>> Nefigah: [31]Fake World Haskell. Nefigah, a recent addition to
>   the community, has been working through RWH, and is providing some
>   excellent examples. Though, This editor prefers the title 'Real
>   Life Haskell' as opposed to his choice.
> * Tom Schrijvers: [32]Release 0.6 of Monadic Constraint Programming.
> * Neil Brown: [33]Concurrency Can Be Deterministic (But The Type
>   System Doesn'

Re: [Haskell-cafe] How do I get this done in constant mem?

2009-10-11 Thread mf-hcafe-15c311f0c

On Sat, Oct 10, 2009 at 11:11:24PM +0200, Daniel Fischer wrote:
> To: haskell-cafe@haskell.org
> From: Daniel Fischer 
> Date: Sat, 10 Oct 2009 23:11:24 +0200
> Subject: Re: [Haskell-cafe] How do I get this done in constant mem?
> 
> Am Samstag 10 Oktober 2009 22:14:38 schrieb mf-hcafe-15c311...@etc-network.de:
> > On Sat, Oct 10, 2009 at 09:33:52AM -0700, Thomas Hartman wrote:
> > > To: Luke Palmer 
> > > Cc: mf-hcafe-15c311...@etc-network.de, haskell-cafe@haskell.org
> > > From: Thomas Hartman 
> > > Date: Sat, 10 Oct 2009 09:33:52 -0700
> > > Subject: Re: [Haskell-cafe] How do I get this done in constant mem?
> > >
> > > > Yes, you should not do this in IO.  That requires the entire
> > > > computation to finish before the result can be used.
> > >
> > > Not really the entire computation though... whnf, no?
> >
> > In that example, yes.  But readFile takes the entire file into a
> > strict String before it gives you the first Char, right?  (Sorry again
> > for my misleading code "simplification".)
> 
> No, readFile reads the file lazily.

hm?  oh, you are right, now that i fixed all the other problems in my
code readFile isn't a problem any more either...  (-:

(but then how does it know when to close the handle?  gotta go read
the code i guess.)

thanks!
-m
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Snow Leopard, gtk2hs

2009-10-11 Thread Arne Dehli Halvorsen
On Sun, Oct 11, 2009 at 3:29 AM, Judah Jacobson wrote:

> On Tue, Oct 6, 2009 at 11:41 AM, Arne Dehli Halvorsen
>  wrote:
> > Does anyone have a recipe for getting ghc + gtk2hs + gtk working on
> MacOSX
> > Snow Leopard?
> > Best regards,
> > Arne D Halvorsen
>
> I was able to get gtk2hs working with ghc-6.10.3 (after patching the
> /usr/bin scripts with -m32) by following the steps from
>
> http://www.haskell.org/haskellwiki/Gtk2Hs#Using_the_GTK.2B_OS_X_Framework
>
> with one change:  call configure for gtk2hs as
>
> ./configure --disable-split-objs --disable-gio
>

Thanks, that seems to have done the trick under ghc 6.10.4 - almost.

Current output:
adhmac:demo arne$ cd buttonbox
adhmac:buttonbox arne$ make
ghc --make ButtonBox.hs -o buttonbox
[1 of 1] Compiling Main ( ButtonBox.hs, ButtonBox.o )
Linking buttonbox ...
ld: warning: duplicate dylib /opt/local/lib/libiconv.2.dylib
ld: warning: duplicate dylib /opt/local/lib/libz.1.dylib
adhmac:buttonbox arne$ ls
ButtonBox.hi ButtonBox.hs ButtonBox.o Makefile buttonbox
adhmac:buttonbox arne$ ./buttonbox

(buttonbox:42418): Pango-WARNING **: failed to create cairo scaled font,
expect ugly output. the offending font is 'Lucida Grande 12'

The buttons have boxes instead of letters, due to the font problem. So
close...

Arne D Halvorsen


>
> Hope that helps,
> -Judah
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] how to determine the dependency versions before packaging and submitting to hackage

2009-10-11 Thread Magnus Therning

Andrew U. Frank wrote:
i plan to submit a package to hackage. i run it on my machine with a cabal file 
which has for all dependencies "any" (except for base, where it says >=4.0 -- 
see previous discussion on haskell-cafe). 
i am not certain, if my code runs agains any version, but i fear it is too 
restrictive to say >= "current version", which could exclude too much? testing 
against all previous versions of the packages seems complicated and very time 
consuming.


what is the advice in this case?


I usually take a conservative approach, I only put in requirements that I can 
verify myself.  However, I make sure to include all tests and if someone 
reports that it works with looser requirements then I'm happy to adjust it.


/M

--
Magnus Therning(OpenPGP: 0xAB4DFBA4)
magnus@therning.org  Jabber: magnus@therning.org
http://therning.org/magnus identi.ca|twitter: magthe



signature.asc
Description: OpenPGP digital signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] how to determine the dependency versions before packaging and submitting to hackage

2009-10-11 Thread Roel van Dijk
Have a look at the Package Versioning Policy:

http://haskell.org/haskellwiki/Package_versioning_policy

On Sun, Oct 11, 2009 at 11:41 AM, Andrew U. Frank
 wrote:
> i am not certain, if my code runs agains any version, but i fear it is too
> restrictive to say >= "current version", which could exclude too much? testing
> against all previous versions of the packages seems complicated and very time
> consuming.

If you assume that the packages you depend on follow the PVP then you
can specify a range of versions which should have a stable API. For
instance, if you depend on a package A and you build it on you system
with A-1.0.2 then you can specify "A >= 1.0.2 && < 1.1". You know it
to work with A-1.0.2 and from the PVP you can assume that A's API will
not change until A-1.1.

The question is which packages follow the PVP.

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


[Haskell-cafe] how to determine the dependency versions before packaging and submitting to hackage

2009-10-11 Thread Andrew U. Frank
i plan to submit a package to hackage. i run it on my machine with a cabal file 
which has for all dependencies "any" (except for base, where it says >=4.0 -- 
see previous discussion on haskell-cafe). 
i am not certain, if my code runs agains any version, but i fear it is too 
restrictive to say >= "current version", which could exclude too much? testing 
against all previous versions of the packages seems complicated and very time 
consuming.

what is the advice in this case?
thank you

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


Re: [Haskell-cafe] Type-level naturals & multiplication

2009-10-11 Thread Manuel M T Chakravarty

Brad Larsen:

Suppose we implement type-level naturals as so:

data Zero
data Succ a

Then, we can reflect the type-level naturals into a GADT as so (not
sure if ``reflect'' is the right terminology here):

data Nat :: * -> * where
 Zero :: Nat Zero
 Succ :: Nat a -> Nat (Succ a)

Using type families, we can then proceed to define type-level  
addition:


type family Add a b :: *
type instance Add Zero b = b
type instance Add (Succ a) b = Succ (Add a b)

Is there any way to define type-level multiplication without requiring
undecidable instances?


No, not at the moment.  The reasons are explained in the paper "Type  
Checking with Open Type Functions" (ICFP'08):


  http://www.cse.unsw.edu.au/~chak/papers/tc-tfs.pdf

We want to eventually add closed *type families* to the system (ie,  
families where you can't add new instances in other modules).  For  
such closed families, we should be able to admit more complex  
instances without requiring undecidable instances.


Manuel

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