Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  mSys and shadowing packages (Kees Bleijenberg)
   2.  Question about CFloat and Float (C Gosch)
   3.  how to save the GHC errormessages in a file on   Windows
      (Kees Bleijenberg)
   4. Re:  how to save the GHC errormessages in a file on Windows
      (Ozgur Akgun)
   5. Re:  how to save the GHC errormessages in a file  on Windows
      (Daniel Fischer)
   6. Re:  Question about CFloat and Float (Alberto Ruiz)
   7. Re:  how to save the GHC errormessages in a file on Windows
      (Federico Mastellone)
   8.  Looking for more information about Pattern       Matching
      (Graham Hopper)


----------------------------------------------------------------------

Message: 1
Date: Thu, 28 Apr 2011 14:25:04 +0200
From: "Kees Bleijenberg" <[email protected]>
Subject: [Haskell-beginners] mSys and shadowing packages
To: <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"

After a lot of struggling I finally managed to install the packages network
and ftpsh on a Windows machine. After installing msys and adjusting the path
for mingW, the command "cabal install network" finally worked. At least I
thought it was. But when I put "import Network.FTP.Client" in myprogram.hs,
GHC can't find the package. After a while I found how to get more info: ghc
--make -v myprogram.hs -package ftphs. There was a long list of warnings,
missing packages, wrong versionnumbers... arghh...
 
Ghc also complained about shadowed packages. i.e. When I do: ghc-dpg list, I
get 2 versions of Win32-2.2.0.2. They have equal version numbers but the
package-id's are different. One package is stored in \program files\Haskell
Platform/2010.2.0.0/lib/package.conf.d and the other is stored at
\Docs&Settings\Kees\Application Data\ghc\i386-mingw32-6.12.3\package.conf.d
The packages from Docs&Settings map were creates using msys. The other were
create before installing network, ftpsh etc (normal cmd command line).
 
I wonder whether the 2 directories are okay and if not, how do I change the
cabal-directory for msys/mingw?
 
As a beginner I love the language. Using Haskell as a platform (at least for
Win32 development) with all it's version dependencies is in my opinion
difficult (compared to   Java, C#, Delphi).
 
 
Can somebody help?
 
Kees
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20110428/1abf7009/attachment-0001.htm>

------------------------------

Message: 2
Date: Thu, 28 Apr 2011 14:27:22 +0200
From: C Gosch <[email protected]>
Subject: [Haskell-beginners] Question about CFloat and Float
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

Dear list members,
I have the following problem: I have wrapped a C library using the FFI and
c2hs.
The C functions all take a bunch of pointers to C arrays of floats, doubles,
or ints as arguments.
Naturally, the Haskell representation of these is e.g.
 Ptr CFloat
or, for single values, CFloat.
My question is: if I have an array, e.g. allocated with mallocArray, to
Haskell Float values (Ptr Float),
is the representation of Float exactly the same as for CFloat? Can I safely
use Ptr Float where the C function
expects the C type float* ?
I assume that I can not, and in that case I would like to find a way to have
Float on the Haskell side and CFloat on the C side.
Any hint on how I would do that without copying data and without too large
performance penalties?

Thanks a lot,
Christian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20110428/a5828f60/attachment-0001.htm>

------------------------------

Message: 3
Date: Thu, 28 Apr 2011 14:31:29 +0200
From: "Kees Bleijenberg" <[email protected]>
Subject: [Haskell-beginners] how to save the GHC errormessages in a
        file on Windows
To: <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"

When I try in Windows in cmd: ghc --make myprogram.hs > test.txt I only get
the first lines in test.txt. The errormessages itself are on the screen, not
in test.txt.
 
In test.txt:
Resolving dependencies...
Configuring ftphs-1.0.7...
Preprocessing library ftphs-1.0.7...
Preprocessing executables for ftphs-1.0.7...
Building ftphs-1.0.7...

The errormessages: Could not find  module 'Network.FTP.Client'.... and a lot
more.
 
How do I 'intercept' these messages?
 
Kees
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20110428/648bf85e/attachment-0001.htm>

------------------------------

Message: 4
Date: Thu, 28 Apr 2011 14:05:20 +0100
From: Ozgur Akgun <[email protected]>
Subject: Re: [Haskell-beginners] how to save the GHC errormessages in
        a file on Windows
To: Kees Bleijenberg <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"

I believe those messages are written to stderr, not stdout.
'>' redirects stdout, for stderr you need '2>'.

HTH,
Ozgur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20110428/9882b9bc/attachment-0001.htm>

------------------------------

Message: 5
Date: Thu, 28 Apr 2011 15:04:18 +0200
From: Daniel Fischer <[email protected]>
Subject: Re: [Haskell-beginners] how to save the GHC errormessages in
        a file  on Windows
To: [email protected]
Message-ID: <[email protected]>
Content-Type: Text/Plain;  charset="utf-8"

On Thursday 28 April 2011 14:31:29, Kees Bleijenberg wrote:
> When I try in Windows in cmd: ghc --make myprogram.hs > test.txt I only
> get the first lines in test.txt. The errormessages itself are on the
> screen, not in test.txt.
> 
> In test.txt:
> Resolving dependencies...
> Configuring ftphs-1.0.7...
> Preprocessing library ftphs-1.0.7...
> Preprocessing executables for ftphs-1.0.7...
> Building ftphs-1.0.7...
> 
> The errormessages: Could not find  module 'Network.FTP.Client'.... and a
> lot more.
> 
> How do I 'intercept' these messages?

The error messages are printed to stderr, while the others are printed to 
stdout. I'm not sure how it works on Windows, but on unix or linux, you'd 
redirect stderr with

$ command 2> file.txt

It's worth a try on Windows too, I think.

> 
> Kees



------------------------------

Message: 6
Date: Thu, 28 Apr 2011 15:27:41 +0200
From: Alberto Ruiz <[email protected]>
Subject: Re: [Haskell-beginners] Question about CFloat and Float
To: C Gosch <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi Christian,

On 04/28/2011 02:27 PM, C Gosch wrote:
> Dear list members,
> I have the following problem: I have wrapped a C library using the FFI
> and c2hs.
> The C functions all take a bunch of pointers to C arrays of floats,
> doubles, or ints as arguments.
> Naturally, the Haskell representation of these is e.g.
>   Ptr CFloat
> or, for single values, CFloat.
> My question is: if I have an array, e.g. allocated with mallocArray, to
> Haskell Float values (Ptr Float),
> is the representation of Float exactly the same as for CFloat? Can I
> safely use Ptr Float where the C function
> expects the C type float* ?
> I assume that I can not, and in that case I would like to find a way to
> have Float on the Haskell side and CFloat on the C side.
> Any hint on how I would do that without copying data and without too
> large performance penalties?
>
> Thanks a lot,
> Christian
>

I think that in ghc you can assume the same representation for CFloat 
and CDouble, they are newtypes of Float and Double:

http://www.haskell.org/ghc/docs/7.0.3/html/libraries/base-4.3.1.0/Foreign-C-Types.html#g:4

(I directly use arrays of Float and Double with C libraries without any 
problem). But Int may be different from CInt depending on the 
architecture, so we need explicit conversions.

Alberto



------------------------------

Message: 7
Date: Thu, 28 Apr 2011 12:37:38 -0300
From: Federico Mastellone <[email protected]>
Subject: Re: [Haskell-beginners] how to save the GHC errormessages in
        a file on Windows
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1

If you want all the output (stdout and stderr) to be redirected
together, doing "&>filename" redirects both stdout and stderr.
You can also redirect stderr to stdout by doing "2>&1" and then
redirecting the stdout to the file you need.

On Thu, Apr 28, 2011 at 10:04 AM, Daniel Fischer
<[email protected]> wrote:
> On Thursday 28 April 2011 14:31:29, Kees Bleijenberg wrote:
>> When I try in Windows in cmd: ghc --make myprogram.hs > test.txt I only
>> get the first lines in test.txt. The errormessages itself are on the
>> screen, not in test.txt.
>>
>> In test.txt:
>> Resolving dependencies...
>> Configuring ftphs-1.0.7...
>> Preprocessing library ftphs-1.0.7...
>> Preprocessing executables for ftphs-1.0.7...
>> Building ftphs-1.0.7...
>>
>> The errormessages: Could not find ?module 'Network.FTP.Client'.... and a
>> lot more.
>>
>> How do I 'intercept' these messages?
>
> The error messages are printed to stderr, while the others are printed to
> stdout. I'm not sure how it works on Windows, but on unix or linux, you'd
> redirect stderr with
>
> $ command 2> file.txt
>
> It's worth a try on Windows too, I think.
>
>>
>> Kees
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>



-- 
Federico Mastellone
Computer Science Engineer - ITBA
".. there are two ways of constructing a software design: One way is
to make it so simple that there are obviously no deficiencies, and the
other way is to make it so complicated that there are no obvious
deficiencies. The first method is far more difficult."

Tony Hoare, 1980 ACM Turing Award Lecture.



------------------------------

Message: 8
Date: Fri, 29 Apr 2011 01:35:13 +0100
From: Graham Hopper <[email protected]>
Subject: [Haskell-beginners] Looking for more information about
        Pattern Matching
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

Hi,

I am very much a newbie to Haskell and currently working through
http://learnyouahaskell.com and trying some of the
http://www.haskell.org/haskellwiki/99_questions. I am struggling to get my
head around pattern matching. I think I can understand the individual
patterns presented in LYAH, but can't seem to find any information about
generalising the formats.

Is there a good resource that describes the patterns that are available or
provides more details about how to create them.

For example the format of [x] and (x:xs) seem very different and I cant
quite get a handle on the syntax(?) behind them. I can see how patterns work
when shown an example, but wouldn't know how to create one from scratch.

I hope you can understand what I am trying to say - its a little difficult
to explain.


Thanks

Graham
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20110429/4c33f8b3/attachment.htm>

------------------------------

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 34, Issue 40
*****************************************

Reply via email to