[Haskell-cafe] GHC Out of memory

2010-11-22 Thread John Smith
I get an out-of-memory error about two thirds of the way through building qtHaskell. If I start again, the remaining 
modules are compiled successfully, although GHC's memory usage creeps up to about 1.5Gb by the time it's finished. Is 
there a memory leak?


(Compiling on Win64 with 4Gb RAM.)

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


Re: [Haskell-cafe] Cabal-install is broken

2010-11-22 Thread Antoine Latter
On Mon, Nov 22, 2010 at 4:16 PM, Permjacov Evgeniy  wrote:
> current cabal-install (0.8.2) cannot be compiled with ghc-7.0.1 set of
> boot libraries. It requires cabal 1.8.* wich fails to compile. Does
> anyone worked this out ?

On some of my development environments I've been using the development
version of cabal-install.

On others, I stick to the Haskell Platform, which does not yet support GHC 7.

It's a real pain to get cabal-install going on GHC 7, as you need to
install all of the dependencies of cabal-install by hand.

The next release of the platform is in January, with an RC is December[1].

Antoine

[1] http://trac.haskell.org/haskell-platform/wiki/ReleaseTimetable
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Cabal-install is broken

2010-11-22 Thread Permjacov Evgeniy
current cabal-install (0.8.2) cannot be compiled with ghc-7.0.1 set of
boot libraries. It requires cabal 1.8.* wich fails to compile. Does
anyone worked this out ?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Re: Reply-To: Header in Mailinglists

2010-11-22 Thread Maciej Piechotka
On Sun, 2010-11-21 at 08:24 +, Malcolm Wallace wrote:
> > If the mailing list replaced Reply-To header it would required
> > additional effort for responders instead of just pressing reply-to- 
> > all.
> 
> If the list were to add a "Reply-To:" header, but only in the case  
> where one was not already present, that would seem to me to be ideal.   
> (None of the internet polemics against Reply-To that I have seen, have  
> considered this modest suggestion.)
> 

Except... I don't use Reply-To because it defaults to sender so it will
still be breaking the RFC - in most cases (as most people don't set the
Reply-To header).

Regards


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


[Haskell-cafe] Build problems with HDBC-mysql on the Mac

2010-11-22 Thread Martijn van Steenbergen

Dear cafe,

Following the instructions at 
http://matt.freels.name/2010/hdbc-mysql-os-x.html I successfully 
installed HDBC-mysql on my Mac!


However when doing a "cabal install" in a local package which depends on 
HDBC-mysql, cabal proceeds to reinstall HDBC-mysql (is this a bug? see 
my other email from a few moments ago), this time unsuccessfully because 
it is using the unpatched cached version downloaded from hackage. This 
breaks my installation: ghc-pkg list colors the package red.


Now comes the weird part. :-) I try to reinstall HDBC-mysql with my 
unpacked, patched version. It fixes my installation of HDBC-again, even 
though it exits prematurely with some errors! I've included the output 
at the end of this email.


I wonder:

Where do these errors suddenly come from? The first time the 
installation went without trouble.


How come it fixes my installation even though it reports errors?

Thank you in advance,

Martijn.



Output of "cabal install --extra-lib-dirs=/usr/local/lib:" in a local 
version of HDBC-mysql, patched according to 
http://matt.freels.name/2010/hdbc-mysql-os-x.html:


Resolving dependencies...
[1 of 1] Compiling Main ( Setup.lhs, dist/setup/Main.o )

Setup.lhs:8:0:
Warning: In the use of `findProgramOnPath'
 (imported from Distribution.Simple.Program):
 Deprecated: "use findProgramLocation instead"
Linking ./dist/setup/setup ...
Configuring HDBC-mysql-0.6.3...
Preprocessing library HDBC-mysql-0.6.3...
Connection.hsc:23:19: error: mysql.h: No such file or directory
Connection.hsc: In function ‘main’:
Connection.hsc:166: error: ‘MYSQL_FIELD’ undeclared (first use in this 
function)

Connection.hsc:166: error: (Each undeclared identifier is reported only once
Connection.hsc:166: error: for each function it appears in.)
Connection.hsc:170: error: expected specifier-qualifier-list before 
‘MYSQL_FIELD’

Connection.hsc:170: error: expected ‘;’ before ‘)’ token
Connection.hsc:170: error: expected statement before ‘)’ token
Connection.hsc:171: error: expected specifier-qualifier-list before 
‘MYSQL_FIELD’

Connection.hsc:171: error: expected ‘;’ before ‘)’ token
Connection.hsc:171: error: expected statement before ‘)’ token
Connection.hsc:172: error: expected specifier-qualifier-list before 
‘MYSQL_FIELD’

Connection.hsc:172: error: expected ‘;’ before ‘)’ token
Connection.hsc:172: error: expected statement before ‘)’ token
Connection.hsc:173: error: expected specifier-qualifier-list before 
‘MYSQL_FIELD’

Connection.hsc:173: error: expected ‘;’ before ‘)’ token
Connection.hsc:173: error: expected statement before ‘)’ token
Connection.hsc:174: error: expected specifier-qualifier-list before 
‘MYSQL_FIELD’

Connection.hsc:174: error: expected ‘;’ before ‘)’ token
Connection.hsc:174: error: expected statement before ‘)’ token
Connection.hsc:175: error: expected specifier-qualifier-list before 
‘MYSQL_FIELD’

Connection.hsc:175: error: expected ‘;’ before ‘)’ token
Connection.hsc:175: error: expected statement before ‘)’ token
Connection.hsc:203: error: ‘MYSQL_BIND’ undeclared (first use in this 
function)
Connection.hsc:210: error: expected specifier-qualifier-list before 
‘MYSQL_BIND’

Connection.hsc:210: error: expected ‘;’ before ‘)’ token
Connection.hsc:210: error: expected statement before ‘)’ token
Connection.hsc:211: error: expected specifier-qualifier-list before 
‘MYSQL_BIND’

Connection.hsc:211: error: expected ‘;’ before ‘)’ token
Connection.hsc:211: error: expected statement before ‘)’ token
Connection.hsc:212: error: expected specifier-qualifier-list before 
‘MYSQL_BIND’

Connection.hsc:212: error: expected ‘;’ before ‘)’ token
Connection.hsc:212: error: expected statement before ‘)’ token
Connection.hsc:213: error: expected specifier-qualifier-list before 
‘MYSQL_BIND’

Connection.hsc:213: error: expected ‘;’ before ‘)’ token
Connection.hsc:213: error: expected statement before ‘)’ token
Connection.hsc:214: error: expected specifier-qualifier-list before 
‘MYSQL_BIND’

Connection.hsc:214: error: expected ‘;’ before ‘)’ token
Connection.hsc:214: error: expected statement before ‘)’ token
Connection.hsc:215: error: expected specifier-qualifier-list before 
‘MYSQL_BIND’

Connection.hsc:215: error: expected ‘;’ before ‘)’ token
Connection.hsc:215: error: expected statement before ‘)’ token
Connection.hsc:216: error: expected specifier-qualifier-list before 
‘MYSQL_BIND’

Connection.hsc:216: error: expected ‘;’ before ‘)’ token
Connection.hsc:216: error: expected statement before ‘)’ token
Connection.hsc:228: error: ‘MYSQL_TIME’ undeclared (first use in this 
function)
Connection.hsc:232: error: expected specifier-qualifier-list before 
‘MYSQL_TIME’

Connection.hsc:232: error: expected ‘;’ before ‘)’ token
Connection.hsc:232: error: expected statement before ‘)’ token
Connection.hsc:233: error: expected specifier-qualifier-list before 
‘MYSQL_TIME’

Connection.hsc:233: error: expected ‘;’ before ‘)’ token
Connection.hsc:233: error: 

Re: [Haskell-cafe] Wondering if this could be done.

2010-11-22 Thread Ling Yang
Haskell does not play as well with overloading as one would do it in C++;
every
name used must be fully qualified.  Indeed, if we try something like

Indeed, if we try something like

data A = A Int deriving (Show, Eq)

test = A 3 unA (A i) = i

class Group a where (+) :: a -> a -> a

instance Group A where (+) x y = A $ unA x + unA y

we will get

Ambiguous occurrence `+'

It could refer to either `Main.+', defined at .hs:7:1
or `Prelude.+', imported from Prelude

Failed, modules loaded: none.

Haskell has its own brand of 'overloading': type classes. Every (+) sign
used
assumes that the operands are of the Num typeclass in particular. In order
to
define (+) on something else you will need to instance the Num typeclass
over
your A type.

I am not sure what you mean by "the stuff defined in class Num is meanless
to
A." Strictly speaking nothing needs to be defined in a typeclass declaration
other than the required type signatures.

To instance the Num typeclass with A, though, assuming that A constructors
take
something that works with Num, you would do something similar to what Miguel
posted:

data A = A Int deriving (Show, Eq)

test = A 3 unA (A i) = i

instance Num A where (+) x y = A $ (unA x) + (unA y) (-) x y = A $ (unA x) -
(unA y) (*) x y = A $ (unA x) * (unA y) abs x = A $ (unA $ abs x) signum y =
A
$ (unA $ signum y) fromInteger i = A (fromInteger i)

Look at fromInteger, which must take Integer as as argument. That may be
inconvenient for you. The Awesome Prelude, referenced in Chris's post, is a
way
of defining less specific version of basic types like Bool so that you have
more choices in defining things like fromInteger in the Num typeclass (which
must take an Integer; it is 'sad' if that Integer refers to a grounded,
specific type).

Still, if not every one of the Num operations make sense for your A type,
you
can leave them blank and get a warning.

On Sun, Nov 21, 2010 at 10:48 PM, Magicloud Magiclouds <
magicloud.magiclo...@gmail.com> wrote:

> Hi,
>  For example, I have a data A defined. Then I want to add (+) and (-)
> operators to it, as a sugar (compared to addA/minusA). But * or other
> stuff defined in class Num is meanless to A. So I just do:
> (+) :: A -> A -> A
> (+) a b =
>  A (elem1 a + elem1 b) (elem2 a + elem2 b) -- I got errors here, for
> the (+) is ambiguous.
>
>  So, just wondering, does this way work in Haskell?
> --
> 竹密岂妨流水过
> 山高哪阻野云飞
> ___
> 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] Derived type definition

2010-11-22 Thread Miguel Mitrofanov
Sure, it's possible with TypeFamilies. The following compiles OK:

{-# LANGUAGE TypeFamilies #-}
module TypeCalc where
data Rec a r = Rec a r
data RecNil = RecNil
data Wrapper a = Wrapper a
class TypeList t where
   type Wrapped t
   i :: t -> Wrapped t
instance TypeList RecNil where
   type Wrapped RecNil = RecNil
   i RecNil = RecNil
instance TypeList r => TypeList (Rec a r) where
   type Wrapped (Rec a r) = Rec (Wrapper a) (Wrapped r)
   i (Rec a r) = Rec (Wrapper a) (i r)
type TTest = Rec Int (Rec String RecNil)
type TTestWrapped = Rec (Wrapper Int) (Rec (Wrapper String) RecNil)
a :: TTest
a = Rec 1 (Rec "a" RecNil)
f :: TTestWrapped -> (Int, String)
f (Rec (Wrapper n) (Rec (Wrapper s) RecNil)) = (n, s)
r = f (i a) -- so, "i a" is of the type TTestWrapped.


On 22 Nov 2010, at 23:43, kg wrote:

> Hi,
> 
> I've tried to simplify as much as possible my problem. Finally, I think I can 
> resume it like that:
> 
> Suppose these following data types :
> data Rec a r = Rec a r
> data RecNil = RecNil
> data Wrapper a = Wrapper a
> 
> Then, we can build the following type:
> type TTest = Rec Int (Rec String RecNil)
> or this type:
> type TTestWrapped = Rec (Wrapper Int) (Rec (Wrapper String) RecNil)
> 
> Is it possible to build TTestWrapped from TTest ?
> 
> 
> Thx in advance,
> Antoine.
> 
> ___
> 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] Why does cabal unnecessarily reinstall dependencies?

2010-11-22 Thread Ivan Lazar Miljenovic
On 23 November 2010 08:26, Martijn van Steenbergen
 wrote:
> Hello cafe,
>
> When I want to locally install my own package through "cabal install" it
> tries to reinstall dependencies convertible-1.0.9.1, HDBC-2.2.6.1 and
> HDBC-mysql-0.6.3 even though they are already installed (and work fine). Why
> does it do this?

1) Does "ghc-pkg check" complain about them?  If so, it will rebuild them.

2) Do you mean it rebuilds the same version or a different/older version?

3) Did you build those packages with any compile-time flags,
constraints, etc.?  If so, I believe cabal-install defaults to wanting
to rebuild them with the default settings.

I believe that if you want to stop cabal-install from rebuilding
non-broken packages, that unpacking what you want to install and then
running "cabal install" within that directory (as opposed to doing
"cabal install foo") is meant to work.

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Why does cabal unnecessarily reinstall dependencies?

2010-11-22 Thread Martijn van Steenbergen

Hello cafe,

When I want to locally install my own package through "cabal install" it 
tries to reinstall dependencies convertible-1.0.9.1, HDBC-2.2.6.1 and 
HDBC-mysql-0.6.3 even though they are already installed (and work fine). 
Why does it do this?


cabal-install version 0.8.2
using version 1.8.0.2 of the Cabal library
Mac OS Leopard

Thanks,

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


Re: [Haskell-cafe] looking for tagsoup-parsec examples

2010-11-22 Thread José Romildo Malaquias
On Mon, Nov 22, 2010 at 02:20:22PM -0200, José Romildo Malaquias wrote:
> 
> I am looking for some examples of code using Text.HTML.TagSoup.Parsec,
> from the tagsoup-parsec package.

In an attempt to learn how to use tagsoup together with parsec in order
to do web scrapping, I rewrote the application that displays the
Haskell.org hit count, explained in the "Drinking TagSoup by Example"
tutorial [1]. The source code is attached.

First I tried to use tagsoup-parsec [2], but it was not too
helpful. Therefore I wrote a few parser combinators myself (inspired by
tagsoup-parsec, and the "TagSoup, meet Parsec!" blog post [3].

I am posting the program here so that other Haskell programmers can
comment on it.

I would like also to do some suggestions to the author of
tagsoup-parsec:

a) export more functions, like tagEater, which may be needed in order to
define new parsers or parser combinators; I needed them, but they were
no usable because they are not exported;

b) add more basic parsers and parser combinators (at least the ones I
have defined in my program).

c) add some examples

d) use parsec version 3


[1] http://community.haskell.org/~ndm/darcs/tagsoup/tagsoup.htm
[2] http://hackage.haskell.org/package/tagsoup-parsec
[3] http://therning.org/magnus/archives/367

Regards,

Romildo
module Main (main) where

import Text.Parsec hiding (satisfy)
import Text.HTML.TagSoup (parseTags, Tag(TagText), (~==))
import Text.HTML.Download (openURL)
import Data.Char (isDigit)
import Data.List (findIndex)

main =
  do src <- openURL "http://www.haskell.org/haskellwiki/Haskell";
 let x = tagParse counter (parseTags src)
 putStrLn $ "haskell.org has been hit " ++ show x ++ " times"


counter =
  do skipTo (tag "")
 count 2 (skipTo (tag ""))
 s <- tagText ""
 let ss = words s
 case findIndex (== "times.") ss of
   Just i -> let num = ss !! (i - 1)
 in return (read (filter isDigit num) :: Int)
   Nothing -> parserZero


--
-- tag parser library
--

tagParse p ts =
  either ( error . show ) id $ parse p "tagsoup" ts

tagEater matcher =
  tokenPrim show (\pos t ts -> incSourceLine pos 1) matcher

anyTag = tagEater Just

satisfy f =
  tagEater (\t -> if f t then Just t else Nothing)

tag t = satisfy (~== t)  show t

tagText str = do TagText x <- tag (TagText str)
 return x

skipTo p = try p <|> (anyTag >> skipTo p)

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


[Haskell-cafe] Derived type definition

2010-11-22 Thread kg

 Hi,

I've tried to simplify as much as possible my problem. Finally, I think 
I can resume it like that:


Suppose these following data types :
data Rec a r = Rec a r
data RecNil = RecNil
data Wrapper a = Wrapper a

Then, we can build the following type:
type TTest = Rec Int (Rec String RecNil)
or this type:
type TTestWrapped = Rec (Wrapper Int) (Rec (Wrapper String) RecNil)

Is it possible to build TTestWrapped from TTest ?


Thx in advance,
Antoine.

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


[Haskell-cafe] looking for tagsoup-parsec examples

2010-11-22 Thread José Romildo Malaquias
Hello.

I am looking for some examples of code using Text.HTML.TagSoup.Parsec,
from the tagsoup-parsec package.

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


Re: [Haskell-cafe] Re: Re: Reply-To: Header in Mailinglists

2010-11-22 Thread Nick Bowler
On 2010-11-21 08:24 +, Malcolm Wallace wrote:
> If the list were to add a "Reply-To:" header, but only in the case  
> where one was not already present, that would seem to me to be ideal.   
> (None of the internet polemics against Reply-To that I have seen, have  
> considered this modest suggestion.)

This still breaks the reply-to-author feature.

> In the past, I have carefully used the Reply-To header to direct  
> responses to a particular mailing list of many (e.g. when cross- 
> posting an announcement).  Yet because there is a culture of "Reply- 
> To: is bad", and most MUAs do not have a "ReplyToList" option, most  
> respondents end up pushing "Reply to all", which ignores my setting of  
> "Reply-To:", and spams more people than necessary.

MUAs will honour the Reply-To header when using the reply-to-all
function: the problem is that Reply-To does not mean what you think it
means.  The header indicates where *you* want to receive replies.  So
the reply-to-all function will reply to *you* (by using the value in
Reply-To), and to everyone else by copying the To and Cc lists.

There is another header, Mail-Followup-To, which tells MUAs to also drop
the To and CC lists.  I know several posters to this very list use it.
However, it needs to be used with care because it can fragment cross-
list discussions and/or prevent non-subscribers from receiving messages.

-- 
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GUI Designer

2010-11-22 Thread Jeremy O'Donoghue
On 18 November 2010 20:28, c8h10n4o2  wrote:

>
> Or how to use XRC files with wxHaskell?
>

There are sample files in the wxHaskell distribution. If you can wait a day
or two I will have a step-by-step blog article, but it's not quite finished
yet.

Regards
Jeremy


> --
> View this message in context:
> http://haskell.1045720.n5.nabble.com/GUI-Designer-tp3271441p3271441.html
> Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
> ___
> 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] Berlin Haskell Meeting

2010-11-22 Thread Sönke Hahn
The next haskell meeting in Berlin will be this wednesday:

Date: Wednesday, November 24th
Time: from 20:00
Location: c-base, Rungestrasse 20, 10179 Berlin

Hope to see you there,
Sönke
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GUI Designer

2010-11-22 Thread Stefan Kersten
On 18.11.10 21:28, c8h10n4o2 wrote:
> There's a tutorial on how to use qtDesigner with qtHaskell ?

sorry, i don't know of any tutorial, but there are some examples in the
`examples' directory of the source distribution (e.g. tetrix.hs). basically you
load the ui file, retrieve named widgets and attach signal handlers in haskell.
signals and slots of compatible types can also be connected directly in 
Designer.


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


Re: [Haskell-cafe] Wondering if this could be done.

2010-11-22 Thread Miguel Mitrofanov

 Sure, you can define your own type class like that:

import Prelude hiding ((+), (-)) -- usual (+) and (-) shouldn't be here...
import qualified Prelude as P -- but they still are accessible with a prefix
class Group a where
   (+) :: a -> a -> a
   (-) :: a -> a -> a
instance Group Integer where
   (+) = (P.+)
   (-) = (P.-)
instance Group A where
   (+) a b = A (elem1 a + elem1 b) (elem2 a + elem2 b) -- works for elem1 and 
elem2 being of class Group - say, Integer's
   (-) a b = ...

22.11.2010 9:48, Magicloud Magiclouds пишет:

Hi,
   For example, I have a data A defined. Then I want to add (+) and (-)
operators to it, as a sugar (compared to addA/minusA). But * or other
stuff defined in class Num is meanless to A. So I just do:
(+) :: A ->  A ->  A
(+) a b =
   A (elem1 a + elem1 b) (elem2 a + elem2 b) -- I got errors here, for
the (+) is ambiguous.

   So, just wondering, does this way work in Haskell?

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