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:  Need Help (kaushal Pathak)
   2. Re:  List Function (Yitzchak Gale)
   3.  Re: List Function (Heinrich Apfelmus)
   4.  Re: Selecting a GUI toolkit (Heinrich Apfelmus)
   5. Re:  Selecting a GUI toolkit (Daniel Carrera)
   6. Re:  Re: Selecting a GUI toolkit (Daniel Carrera)
   7. Re:  Re: Selecting a GUI toolkit (Thomas Davie)
   8. Re:  Re: Selecting a GUI toolkit (Daniel Carrera)
   9. Re:  Re: Selecting a GUI toolkit (Thomas Davie)


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

Message: 1
Date: Wed, 29 Apr 2009 19:14:21 +0530
From: kaushal Pathak <[email protected]>
Subject: Re: [Haskell-beginners] Need Help
To: Rahul Kapoor <[email protected]>, [email protected]
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

Whats the issue with following pgm to find permutation of a string

permute myStr = foldl(\acc x1 ->
                      (foldr(\x2 acc1 ->
                                 (zipWith (\x3 y3 -> x3 ++ [x1] ++ y3)
(inits acc1) (tails acc1)))
                       [] acc))
                    [] myStr


On Wed, Apr 29, 2009 at 6:35 PM, kaushal Pathak <[email protected]> wrote:

> Here is another one liner I am stuck at(Find permuation of string), here is
> my one line code :
>
> permute myStr = foldr(\x acc -> (zipWith (\x1 y1 -> x1 ++ [x] ++ y1) (inits
> acc) (tails acc))) [] myStr
>
> and here is 5 line error ;-(
>
>     Occurs check: cannot construct the infinite type: a = [a]
>       Expected type: [a]
>       Inferred type: [[a]]
>     In the expression:
>         (zipWith (\ x1 y1 -> x1 ++ x ++ y1) (inits acc) (tails acc))
>     In the first argument of `foldr', namely
>         `(\ x acc
>               -> (zipWith (\ x1 y1 -> x1 ++ x ++ y1) (inits acc) (tails
> acc)))'
>
>
> Will really appreciate your help in moving ahead
>
> Regards
> Kaushal
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20090429/2442e1d8/attachment-0001.htm

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

Message: 2
Date: Thu, 30 Apr 2009 10:22:30 +0300
From: Yitzchak Gale <[email protected]>
Subject: Re: [Haskell-beginners] List Function
To: "Edward Z. Yang" <[email protected]>
Cc: beginners <[email protected]>
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1

Brent Yorgey wrote:
>>   Prelude Control.Applicative> liftA2 (,) [1,2,3] [4,5,6]
>>   [(1,4),(1,5),(1,6),(2,4),(2,5),(2,6),(3,4),(3,5),(3,6)]

Edward Z. Yang wrote:
> I'm not even going to try to understand that now.

Brent used that because Applicative is even simpler
than Monad - at least theoretically. But it's less well
known at the moment.

If you want to stick to Monad, Brent's method works
there too:

  Prelude Control.Monad> liftM2 (,) [1,2,3] [4,5,6]
  [(1,4),(1,5),(1,6),(2,4),(2,5),(2,6),(3,4),(3,5),(3,6)]

-Yitz


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

Message: 3
Date: Thu, 30 Apr 2009 09:57:25 +0200
From: Heinrich Apfelmus <[email protected]>
Subject: [Haskell-beginners] Re: List Function
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8

Edward Z. Yang wrote:
>> However, explaining how/why sequence does this requires understanding
>> the list monad, which you may or may not want to tackle at this point.
> 
> Interesting! According to Hoogle, the sequence function evaluates each
> monad and then collects the results. I know evaluating a list monad returns
> a list, but what do they mean by "collect"?

There is also  sequence_  which does not collect the results, but throws
them away.

    Prelude> sequence_ [ [1,2,3], [4,5,6] ]
    [(),(),(),(),(),(),(),(),()]


(Also, concerning terminology,  sequence  evaluates each monadic action.
You can't evaluate a monad, it's a type constructor, not a function or
value.)

>> If you import 'Control.Applicative' you can even do exactly what you
>> wanted, with pairs and all:
>>
>>   Prelude Control.Applicative> liftA2 (,) [1,2,3] [4,5,6]
>>   [(1,4),(1,5),(1,6),(2,4),(2,5),(2,6),(3,4),(3,5),(3,6)]
>>
>> Here, liftA2 is applying the function (,) to every possible pair of
>> values from the two lists.
> 
> I'm not even going to try to understand that now.

Also known as

    liftM2 (,) [1,2,3] [4,5,6]

Which is the same as

    do
       x <- [1,2,3]
       y <- [4,5,6]
       return (x,y)


Regards,
apfelmus

--
http://apfelmus.nfshost.com



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

Message: 4
Date: Thu, 30 Apr 2009 10:00:08 +0200
From: Heinrich Apfelmus <[email protected]>
Subject: [Haskell-beginners] Re: Selecting a GUI toolkit
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1

Felipe Lessa wrote:
> Daniel Carrera wrote:
>> I think I read somewhere that Gtk2Hs is the more active project, so it
>> might be more mature. On the other hand, Gtk kinda sucks on Mac OS X. I
>> hate how Gimp or GnuCash look when I run them on OS X. On Windows Gtk
>> runs fine except that the file browser looks out of place.
> 
> Although I don't have access to a Mac, people usually don't like
> Gtk there.  But there seems to be a native port somewhere that is
> going to be merged into Gtk+ someday :).

I think the "native" refers not to the GUI appearance but to the feature
that you don't need an X server to run a Gtk application anymore.

> Now, good support today for Mac OS X would be my only reason to
> go through the wxWindows route.  I use Gtk+ because back in the
> days that I tried wxWindows, it had a terrible appearence when
> using Gtk as a backend, but probably things improved since then.

WxWindows on Mac OS X doesn't really look great either, I'm afraid.


Regards,
apfelmus

--
http://apfelmus.nfshost.com



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

Message: 5
Date: Thu, 30 Apr 2009 10:41:19 +0200
From: Daniel Carrera <[email protected]>
Subject: Re: [Haskell-beginners] Selecting a GUI toolkit
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Felipe Lessa wrote:
> Although I don't have access to a Mac, people usually don't like
> Gtk there.  But there seems to be a native port somewhere that is
> going to be merged into Gtk+ someday :).
> 
> Now, good support today for Mac OS X would be my only reason to
> go through the wxWindows route.  I use Gtk+ because back in the
> days that I tried wxWindows, it had a terrible appearence when
> using Gtk as a backend, but probably things improved since then.


Thanks. I guess one would have to try making a simple program with each 
and see. After all, one of the selling points of WX is that it's 
supposed to look right in all platforms. I have been sort of assuming 
that between WX and Gtk you might as well pick WX because WX uses Gtk in 
the platforms where Gtk looks right.

The choice would be simpler if Gtk ran natively on Mac. Right now it 
looks horrible and it is hard to setup if you are not a technical person 
or don't have the latest OS X. At a *minimum* you'll need to install 
fink or mac ports and run the program from the terminal.

Btw, I have read the first few chapters of the Gtk2Hs tutorial. The code 
looks extremely imperative. Even more than wxHaskell. I mean... initGUI,
"widgetShowAll window", "mainGUI"...

In principle I would be happy with any WX, Gtk and Qt. I think well of 
all of them. It's just that they all seem to have a lot of limitations.

Cheers,
Daniel.


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

Message: 6
Date: Thu, 30 Apr 2009 10:44:28 +0200
From: Daniel Carrera <[email protected]>
Subject: Re: [Haskell-beginners] Re: Selecting a GUI toolkit
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Heinrich Apfelmus wrote:
> WxWindows on Mac OS X doesn't really look great either, I'm afraid.

Really? The screen shots look good to me. See:

http://wxhaskell.sourceforge.net/images/controls-macosx.png

Daniel.


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

Message: 7
Date: Thu, 30 Apr 2009 10:54:26 +0200
From: Thomas Davie <[email protected]>
Subject: Re: [Haskell-beginners] Re: Selecting a GUI toolkit
To: Daniel Carrera <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On 30 Apr 2009, at 10:44, Daniel Carrera wrote:

> Heinrich Apfelmus wrote:
>> WxWindows on Mac OS X doesn't really look great either, I'm afraid.
>
> Really? The screen shots look good to me. See:
>
> http://wxhaskell.sourceforge.net/images/controls-macosx.png

Really, here's what that *should* look like:

http://www.cs.kent.ac.uk/people/rpg/tatd2/controls-macosx.png

Of note though, the main problem with WX is not that the controls look  
different, it's that they behave differently.  UI is not just about  
looks ;).

Bob


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

Message: 8
Date: Thu, 30 Apr 2009 11:12:40 +0200
From: Daniel Carrera <[email protected]>
Subject: Re: [Haskell-beginners] Re: Selecting a GUI toolkit
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Thomas Davie wrote:
> Really, here's what that *should* look like:
> 
> http://www.cs.kent.ac.uk/people/rpg/tatd2/controls-macosx.png

Your link is for Panther, my link was for Jaguar. The wxHaskell also has 
a screenshot on Panther:

http://wxhaskell.sourceforge.net/images/controls-macosx2.png

> Of note though, the main problem with WX is not that the controls look 
> different, it's that they behave differently.  UI is not just about 
> looks ;).

Ok.. how do they behave?  I bet you that they behave better than the Gtk 
controls on OS X... ugh.

You are right that UI is not just looks. That's another of the issues 
with X11 on OS X, it behaves wrong. The command key doesn't do anything, 
so for example, it's a major pain to use Gimp on OS X without a two 
button mouse.

How about Qt? Do you know if Qt behaves well on OS X? I thought that Qt 
didn't look native on OS X (I'm on Ubuntu right now, so I can't check).

Daniel.


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

Message: 9
Date: Thu, 30 Apr 2009 12:07:13 +0200
From: Thomas Davie <[email protected]>
Subject: Re: [Haskell-beginners] Re: Selecting a GUI toolkit
To: Daniel Carrera <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="windows-1252"


On 30 Apr 2009, at 11:12, Daniel Carrera wrote:

> Thomas Davie wrote:
>> Really, here's what that *should* look like:
>> http://www.cs.kent.ac.uk/people/rpg/tatd2/controls-macosx.png
>
> Your link is for Panther, my link was for Jaguar. The wxHaskell also  
> has a screenshot on Panther:
>
> http://wxhaskell.sourceforge.net/images/controls-macosx2.png

My link was on leopard actually, but that still looks significantly  
different to the natively designed UI.
>
>> Of note though, the main problem with WX is not that the controls  
>> look different, it's that they behave differently.  UI is not just  
>> about looks ;).
>
> Ok.. how do they behave?  I bet you that they behave better than the  
> Gtk controls on OS X... ugh.

I very much doubt that actually – mac users in my experience notice  
when things are annoyingly slightly different from the norm – a kind  
of uncanny valley effect, it's almost what you expect, but not quite.   
In the mean time, gtk being entirely non-OS X like running in X11 says  
"hey, I'm different, deal with it", and people do.

> You are right that UI is not just looks. That's another of the  
> issues with X11 on OS X, it behaves wrong. The command key doesn't  
> do anything, so for example, it's a major pain to use Gimp on OS X  
> without a two button mouse.

Well yes, but then all macs come with 2 button mice, so *shrug*.  But  
yes, X11 apps in general behave wrong, and mac users don't like them  
much, but they like them better than apps that pretend to be OS X  
like, but don't get it right.

> How about Qt? Do you know if Qt behaves well on OS X? I thought that  
> Qt didn't look native on OS X (I'm on Ubuntu right now, so I can't  
> check).

Qt get closer into uncanny valley than gtk does, because it runs  
natively.

This really though comes down to the fact that it's totally impossible  
to design cross platform UIs for applications.  Different platforms  
UIs behave differently, so deal with it, and write different UIs for  
the different platforms.  Don't expect everyone to fit into your one- 
size-fits-all straight jacket.

This is extra work, but 1) it enforces a good abstraction layer  
between your UI and your actual application, and 2) it gives major  
benefits in terms of happy customers.

Bob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20090430/3468665d/attachment.htm

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

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


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

Reply via email to