GPWiki.org
GPWiki.org
It is currently Mon May 20, 2013 3:17 pm

All times are UTC




Post new topic Reply to topic  [ 13 posts ] 
Author Message
PostPosted: Mon May 05, 2008 4:38 am 
Level 22 Norse Warrior-Librarian

Joined: Sun Mar 04, 2007 5:08 pm
Posts: 525
Location: Perth w.a.
I've decided to learn Haskell.

I wanted to learn a functional programming language and by what I've read Haskell is/is one of the purest functional languages around.

My Ignorant assumptions...

1)Bloody hell,if I get into the mindset of a functional language I'll have to think in a completely different way than I do with c++.

Q) Is that going to upset my c++ programming,confusing and confounding myself.

2)Wow, this Haskell is really VERY fresh and exciting.

3)I doubt Haskell is used to make games

Q)
[quote]
Running the compiler is fairly easy. Assuming that you have a program written with a
main function in a file called Main.hs, you can compile it simply by writing:

% ghc --make Main.hs -o main

The “–makeâ€Â


Top
 Profile  
 
PostPosted: Mon May 05, 2008 4:48 am 
Harmlessness does no harm
User avatar

Joined: Tue Sep 14, 2004 8:37 pm
Posts: 3807
Location: Ferriday, LA, US
[quote="Hugh"]Q)
[quote]
Running the compiler is fairly easy. Assuming that you have a program written with a
main function in a file called Main.hs, you can compile it simply by writing:

% ghc --make Main.hs -o main

The “–makeâ€Â

_________________
What most people don't understand about "enlightenment" is that it is not an end-goal; but where you find yourself just before taking a new "first step."


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 05, 2008 5:00 am 
Level 22 Norse Warrior-Librarian

Joined: Sun Mar 04, 2007 5:08 pm
Posts: 525
Location: Perth w.a.
Thanks theraje,

ghc --make Main.hs -o main

GHC tells me that ghc is not in scope,I know theres an easy solution to this,great to get your help though bro.

I hear your doing great things with your nail collection,I have a bunyon collection if you want to trade???


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 05, 2008 5:06 am 
Harmlessness does no harm
User avatar

Joined: Tue Sep 14, 2004 8:37 pm
Posts: 3807
Location: Ferriday, LA, US
Hugh wrote:
Thanks theraje,

ghc --make Main.hs -o main

GHC tells me that ghc is not in scope,I know theres an easy solution to this,great to get your help though bro.


Are you using Windows? If so, try adding the .exe at the end of the command. Otherwise, I don't know (never used Haskell myself).

Hugh wrote:
I hear your doing great things with your nail collection,I have a bunyon collection if you want to trade???


Sure... in fact, I can throw in some scabs if you have any really good bunyons for trade.

_________________
What most people don't understand about "enlightenment" is that it is not an end-goal; but where you find yourself just before taking a new "first step."


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 05, 2008 6:55 am 
Level 22 Norse Warrior-Librarian

Joined: Sun Mar 04, 2007 5:08 pm
Posts: 525
Location: Perth w.a.
theraje wrote:
Sure... in fact, I can throw in some scabs if you have any really good bunyons for trade.


Sweet, purrfect,can't wait bro.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 05, 2008 7:24 am 
Prolific Poster

Joined: Fri Apr 25, 2008 7:37 am
Posts: 24
Currently I'm fiddling with haskell from time to time, too.
It has some nice ideas in it though it is really a *completely* different way of thinking about programs. (Which makes the learning curve hard to climb for an imperial ( ;) ) programmer.

Also I find it hard to find & use libraries. Unlike Python, D or whatever it doesnt seem to be that easy to be easy to use any existing c lib.
Also IO stuff seems to be always a little harder to master correctly for the beginner (ie me), even if one understands what a Monad is.
(I wouldnt want to use SDL via haskell I guess it would basically degenerate to 'purely' imperative code)

I think a good use case for haskell might be a pure game server which does a lot of logic/calculating stuff. Such things seem to be haskells strength at my first glances.


Top
 Profile  
 
PostPosted: Mon May 05, 2008 10:29 am 
Technomaniac

Joined: Sun Dec 05, 2004 11:27 am
Posts: 3249
Location: Sydney, Australia
Hugh wrote:
1)Bloody hell,if I get into the mindset of a functional language I'll have to think in a completely different way than I do with c++.

That isn't a bad thing.

Quote:
Q) Is that going to upset my c++ programming,confusing and confounding myself.

It will probably change the way you write your c++ code, but it will be for the better. My c code changed a lot as a result of learning Haskell, and even though I rarely use it now, it improved my coding in other languages.

Quote:
3)I doubt Haskell is used to make games

First person shooter in haskell:

http://www.haskell.org/haskellwiki/Frag

Quote:
if I type % ghc --make Main.hs -o main.exe
into the glasgow haskell compiler interactive nothing happens.

Type it into the command prompt (ie, not ghci)

The thing you have to get drilled into your head with Haskell is that all your state must be explicit. To make a game, you have an object representing the game, and an object representing the players commands, and a function which takes the old state, the commands and spits out a new state (oh, and probably another function which displays the state).

You can't mix things up like you can in an imperative language - for example, code which said "if the left arrow is down then move the player to the left" should be split up between the different abstractions - the left arrow key being down shouldn't directly change where the player is, only the function that creates a new game state based on the old state and some input gets to move where the player is (and when I say "move", I really mean "create a new version of the world, where the player is to the left").

Stick with it though, you'll be a better person for it.

_________________
Trying is the first step towards failure
b


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 05, 2008 11:44 am 
Level 22 Norse Warrior-Librarian

Joined: Sun Mar 04, 2007 5:08 pm
Posts: 525
Location: Perth w.a.
Thanks Andy.

Thanks alot, and Thanks theraje, thanks alot (beutiful nail specimens,
I hope you appreciate my bunyons).

The more I delve into Haskell the greater the feeling of purity and clarity.

<EDIT>

Directed at Andy...

1) Why do you rarely use Haskell nowadays ?

2)I have a cousin called Andrew (Carrol) who lives in Sydney Australia,
he's a bloody programming wiz...I wonder...nah...it probably is'nt but I had to ask.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 05, 2008 12:24 pm 
Technomaniac

Joined: Sun Dec 05, 2004 11:27 am
Posts: 3249
Location: Sydney, Australia
Hugh wrote:
Directed at Andy...

1) Why do you rarely use Haskell nowadays ?

No real reason. My main project at the moment is done in c, mainly because it needs to be very easy to deploy anywhere and very easy to integrate with lots of other stuff. While Haskell is cross platform, it is super common to find gcc on a device, while finding ghc would be a pleasant surprise :)

Quote:
2)I have a cousin called Andrew (Carrol) who lives in Sydney Australia,
he's a bloody programming wiz...I wonder...nah...it probably is'nt but I had to ask.

No relation and no knowledge.

When I was in San Francisco in 2006, I was at a bar and on finding out that I was from Australia, a guy asked me if I knew "Ricky". Ricky was apparently a really great guy. He didn't know the last name, but he did know he was from Darwin. :)

_________________
Trying is the first step towards failure
b


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 05, 2008 12:34 pm 
Game Programming Guru

Joined: Thu Jun 08, 2006 7:48 pm
Posts: 1248
Location: Scotland
He basically lives right next you! How could you not know him??? :lol


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 06, 2008 11:30 am 
Level 22 Norse Warrior-Librarian

Joined: Sun Mar 04, 2007 5:08 pm
Posts: 525
Location: Perth w.a.
for prosperity then.

from the command prompt.....

set the path to the directory of your project
eg.where you want the executable to be placed.

e.g...... cd c:\\haskellProject

then at the prompt type...

ghc --make $ -o main.exe

(where $ stands for "add the path of the project to be compiled here")

eg.....

ghc --make c:\\haskellProject\\data\\Main.hs -o main.exe

nb.remembering the .hs file must be called Main.hs and must contain a definition
of the function main.

(without the smily faces)


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 06, 2008 12:13 pm 
Bibliotherapist
User avatar

Joined: Wed Dec 21, 2005 6:23 pm
Posts: 6210
Location: Manchester, UK
edited it for you and ticked the lovely 'Disable Smilies in this post' checkbox at the bottom so you don't have smilies cluttering up your paths :)

_________________
God must love stupid people, he made so many.
theraje: 'God doesn't love stupid people, they're just easier to make'
http://sharedillusions.blogspot.com


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 06, 2008 12:20 pm 
Level 22 Norse Warrior-Librarian

Joined: Sun Mar 04, 2007 5:08 pm
Posts: 525
Location: Perth w.a.
Haha,

WorkMad desist...desist

Thanks bro )


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC


Who is online

Users browsing this forum: Baidu [Spider] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group