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. Re:  first number is a list (Roelof Wobben)
   2. Re:  first number is a list (Mats Rauhala)
   3. Re:  Why aren't David Harley's QT bindings more   popular?
      (?ystein Kolsrud)
   4. Re:  first number is a list (Roelof Wobben)
   5. Re:  first number is a list (Mats Rauhala)
   6. Re:  A first try (Yitzchak Gale)
   7. Re:  first number is a list (David Virebayre)
   8. Re:  Why aren't David Harley's QT bindings more popular?
      (Mats Rauhala)


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

Message: 1
Date: Mon, 27 Jun 2011 12:08:50 +0000
From: Roelof Wobben <[email protected]>
Subject: Re: [Haskell-beginners] first number is a list
To: <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"



 Sorry,  Now Im missing you. First you talked about head[x:-] = x and now head 
[1,2,3,4] is good. Roelof  Date: Mon, 27 Jun 2011 15:03:00 +0300
From: [email protected]
To: [email protected]
Subject: Re: [Haskell-beginners] first number is a list

On 11:55 Mon 27 Jun     , Roelof Wobben wrote:
> 
> Oke, 
> I'm not sure I understand you right. Let's say I have this list [1,2,3,4]How 
> must I use head now ? Roelof Date: Mon, 27 Jun 2011 14:50:14 +0300
 
 head [1,2,3,4] -- Returns 1
 
-- 
Mats Rauhala
MasseR

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners                               
          
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20110627/e4ef7005/attachment-0001.htm>

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

Message: 2
Date: Mon, 27 Jun 2011 15:20:18 +0300
From: Mats Rauhala <[email protected]>
Subject: Re: [Haskell-beginners] first number is a list
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"

On 12:08 Mon 27 Jun     , Roelof Wobben wrote:
>  Sorry,  Now Im missing you. First you talked about head[x:-] = x and now 
> head [1,2,3,4] is good. Roelof  Date: Mon, 27 Jun 2011 15:03:00 +0300

I wasn't entirely clear. The function declaration for head is:

 head (x:_) = x
 head _ = error "No elements"

or something similar. You can see from this that it uses pattern
matching to find the first element (x:_). _ means that the value is
disgarded. [1,2,3,4] is just syntactic sugar for 1 : 2 : 3 : 4 : [], so
pattern matching (x:_) finds 1 from the previous list.

You use the function head like I mentioned in the last email; `head
[1,2,3,4]`. Try firing up ghci and inputting that in it.


-- 
Mats Rauhala
MasseR
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20110627/d68a306e/attachment-0001.pgp>

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

Message: 3
Date: Mon, 27 Jun 2011 14:19:01 +0200
From: ?ystein Kolsrud <[email protected]>
Subject: Re: [Haskell-beginners] Why aren't David Harley's QT bindings
        more    popular?
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1

I've been using qtHaskell for a spare-time project lately, and I think
it works pretty well. The documentation could be better, and I had a
little trouble during the installation of the package on Windows, but
it seems to work fine once you get it up and running. The
documentation on the QT site is great though, and that's where I look
mostly, but mapping the QT constructs to its qtHaskell counterpart is
not always straight forward. Also, parts of the QT interface is not
implemented yet in qtHaskell, and it's not documented what parts are
missing. I have run into situations where I have spent a lot of time
figuring out how to do something in QT only to find out that that
option is not available in qtHaskell. I've usually found workarounds
for it, but it can take a while to find a "working path".

I haven't had a look at any of the other libraries out there, so I
don't really have much to compare with, but a problem with qtHaskell
is that it's usage is very non-functional in nature, and a lot of it's
C++ background shines through into the Haskell code (for instance
management of constructors/destructors). But on the whole I am pretty
happy with it.

Best regards, ?ystein Kolsrud

On Fri, Jun 24, 2011 at 11:31 PM, Michael Serra <[email protected]> wrote:
> Hi all,
> ? Recently I have been doing the usual beginner's search for the "best GUI
> toolkit" available to Haskell, and today I installed David Harley's
> qtHaskell bindings.? I was surprised to find they were easy to install (on
> Linux), and all the examples run flawlessly.? So I have two related
> questions: (1) has anyone out there used qtHaskell, and what was your
> experience; (2) why do these bindings seem to be a less-popular option than
> wxwidgets and gtk2hs?? I understand qtHaskell is much newer than the others,
> and so far its development appears to be a one-man operation; other than
> these obvious explanations, is there a bigger reason people don't seem to be
> using or discussing QT with Haskell?? I would have thought working bindings
> to such a useful framework would be a bigger deal.
> - m. serra
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>



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

Message: 4
Date: Mon, 27 Jun 2011 12:24:21 +0000
From: Roelof Wobben <[email protected]>
Subject: Re: [Haskell-beginners] first number is a list
To: <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"



 Oke,  Now figure out how I can find the 3 in the list [1,2,3,4] I was thinking 
about using tail [1,2,3,4] and after that use last [1,2,3] So something like 
last [ tail [1,2,3,4] Or : let outcome = tail [1,2,3,4]let outcome2 = last 
[outcome] Roelof Date: Mon, 27 Jun 2011 15:20:18 +0300
From: [email protected]
To: [email protected]
Subject: Re: [Haskell-beginners] first number is a list

On 12:08 Mon 27 Jun     , Roelof Wobben wrote:
>  Sorry,  Now Im missing you. First you talked about head[x:-] = x and now 
> head [1,2,3,4] is good. Roelof  Date: Mon, 27 Jun 2011 15:03:00 +0300
 
I wasn't entirely clear. The function declaration for head is:
 
 head (x:_) = x
 head _ = error "No elements"
 
or something similar. You can see from this that it uses pattern
matching to find the first element (x:_). _ means that the value is
disgarded. [1,2,3,4] is just syntactic sugar for 1 : 2 : 3 : 4 : [], so
pattern matching (x:_) finds 1 from the previous list.
 
You use the function head like I mentioned in the last email; `head
[1,2,3,4]`. Try firing up ghci and inputting that in it.
 
 
-- 
Mats Rauhala
MasseR

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners                               
          
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20110627/63582477/attachment-0001.htm>

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

Message: 5
Date: Mon, 27 Jun 2011 15:33:49 +0300
From: Mats Rauhala <[email protected]>
Subject: Re: [Haskell-beginners] first number is a list
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"

On 12:24 Mon 27 Jun     , Roelof Wobben wrote:
>  Oke,  Now figure out how I can find the 3 in the list [1,2,3,4] I was 
> thinking about using tail [1,2,3,4] and after that use last [1,2,3] So 
> something like last [ tail [1,2,3,4] Or : let outcome = tail [1,2,3,4]let 
> outcome2 = last [outcome]

tail returns the list except for the head. So for example the list
[1,2,3,4] becomes [2,3,4]. Using last on that would return 4, not 3.
However the function init returns the list except for the last item, so
using init on [1,2,3,4] would return [1,2,3] and then using last on that
would return the 3 you wanted. So for example:

 ghci> last $ init [1,2,3,4]
 3

But Data.List exports a function `find :: (a -> Bool) -> [a] -> Maybe
a`, which you can use to find 3.

 ghci> find (== 3) [1,2,3,4]
 Just 3

Another way could be using head and dropWhile:

 ghci> head $ dropWhile (/= 3) [1,2,3,4]
 3



-- 
Mats Rauhala
MasseR
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20110627/912b80f2/attachment-0001.pgp>

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

Message: 6
Date: Mon, 27 Jun 2011 15:33:50 +0300
From: Yitzchak Gale <[email protected]>
Subject: Re: [Haskell-beginners] A first try
To: David Place <[email protected]>
Cc: Heinrich Apfelmus <[email protected]>,
        [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1

David Place wrote:
> Suppose the file is only partially demanded as in the case I quoted earlier.
>
> print10 =
> ? ? do
> ? ? ? contents <- withFile "/usr/share/dict/words" ReadMode (\h -> 
> hGetContents h)
> ? ? ? print $ take 10 contents
>
> The file would never be closed.

I tried it - it does close the file.

Thanks,
Yitz



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

Message: 7
Date: Mon, 27 Jun 2011 14:36:29 +0200
From: David Virebayre <[email protected]>
Subject: Re: [Haskell-beginners] first number is a list
To: Thomas Davie <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8

2011/6/27 Thomas Davie <[email protected]>:

> Actually it's saying it expects a bool value, no function at all.

Damned, you caught me writing nonsense :)

I meant expression, because writing [ x | x <- [1,2,3,4],True]  has
little interest :)


Thanks,



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

Message: 8
Date: Mon, 27 Jun 2011 15:45:38 +0300
From: Mats Rauhala <[email protected]>
Subject: Re: [Haskell-beginners] Why aren't David Harley's QT bindings
        more popular?
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

On 14:19 Mon 27 Jun     , ?ystein Kolsrud wrote:
> I haven't had a look at any of the other libraries out there, so I
> don't really have much to compare with, but a problem with qtHaskell
> is that it's usage is very non-functional in nature, and a lot of it's
> C++ background shines through into the Haskell code (for instance
> management of constructors/destructors). But on the whole I am pretty
> happy with it.

That seems to be quite common with haskell GUI libraries. Even GTK is
extremly imperative by nature, almost clear mapping between the C
version and the Haskell version. The general concensus seems to be that
'no-one wants gui libraries, as everything can be done on the web' :/.

-- 
Mats Rauhala
MasseR
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20110627/7ccda5d7/attachment.pgp>

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

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


End of Beginners Digest, Vol 36, Issue 71
*****************************************

Reply via email to