Assignment 2, task 2

Benutzeravatar
Alp.traum
Mausschubser
Mausschubser
Beiträge: 85
Registriert: 3. Feb 2004 15:15
Wohnort: Darmstadt
Kontaktdaten:

Assignment 2, task 2

Beitrag von Alp.traum »

I'm trying to add exception handling to the interpreter.

I tried to use "catch foo Nothing" where foo tries to return "Just (FAEValue a)". But i get the following error:

Code: Alles auswählen

Couldn't match expected type `IO a'
           against inferred type `Maybe (FAEValue a1)'
    In the first argument of `catch'
How do i use the catch function?

Benutzeravatar
sproksch
Computerversteher
Computerversteher
Beiträge: 346
Registriert: 15. Apr 2004 17:56

Re: Assignment 2, task 2

Beitrag von sproksch »

My solutions passes 5 out of 6 tests and I believe I know whats the problem that needs to be solved for the last one, but... I have no idea how to express this in haskell. This task has disencouraged me alot, maybe I'm too stupid ;) I'm definitely feel not competent enough to solve this problem, based on the knowledge I recieved from the lecture so far...

Task 3 was ok, Task 1+2 were solved by heavy guessing and random trial and error... I don't think we are suposed to solve the tasks this way -.- in addition to this (or because of it) the working time rises exponentially every assignment... In my opinion the difference in difficulty between assignment 3 an 4 was way too big...

Benutzeravatar
Alp.traum
Mausschubser
Mausschubser
Beiträge: 85
Registriert: 3. Feb 2004 15:15
Wohnort: Darmstadt
Kontaktdaten:

Re: Assignment 2, task 2

Beitrag von Alp.traum »

I can second that. Task 2 is really a huge trial and error rollercoaster. I can't find the right way to solve this task.

/edit

I think i just got it to work. Eight hours of work or something.
Zuletzt geändert von Alp.traum am 22. Mai 2009 10:06, insgesamt 1-mal geändert.

Benutzeravatar
Aaron
Windoof-User
Windoof-User
Beiträge: 25
Registriert: 24. Mai 2004 20:09
Wohnort: Darmscht
Kontaktdaten:

Re: Assignment [4], task 2

Beitrag von Aaron »

What they said. :(
The preparation appeared insufficient; the processing time grew exponentially since assignment 2, which was way too high this time.
If there's one thing I've learned in all my days ... it's that if knowledge is power, then the internet is full of completely useless power. Think about it. —Brett Erlich

Benutzeravatar
sewe
Sonntagsinformatiker
Sonntagsinformatiker
Beiträge: 295
Registriert: 16. Jan 2009 14:53
Kontaktdaten:

Re: Assignment 2, task 2

Beitrag von sewe »

@Alp.traum: catch is a red herring, at least as far as task 2 is concerned. This function is used by Haskell's exception handling machinery, which wasn't required for task 2 (and which we can only delve into once we have covered monads in the lecture.)

@Aaron, sproksch: I'll try to give a more gentle introduction to Haskell during Prof. Mezini's absence. I like the language a lot and it would be a pity if you remember it as as "trial and error rollercoaster". :(

Benutzeravatar
Alp.traum
Mausschubser
Mausschubser
Beiträge: 85
Registriert: 3. Feb 2004 15:15
Wohnort: Darmstadt
Kontaktdaten:

Re: Assignment 2, task 2

Beitrag von Alp.traum »

sewe hat geschrieben:@Alp.traum: catch is a red herring, at least as far as task 2 is concerned. This function is used by Haskell's exception handling machinery, which wasn't required for task 2 (and which we can only delve into once we have covered monads in the lecture.)(
Yep, i didn't solve it with exception handling now, i think i found the right way. But at least for me, it was not clear enough how we had to establish a working solution. Don't take me wrong, Haskell seems to be a nice language and i really like its possibilities. But i guess there is a reason why they say: "There are object-oriented languages, functional languages and Haskell."
Zuletzt geändert von Alp.traum am 23. Mai 2009 13:43, insgesamt 1-mal geändert.

Benutzeravatar
Aaron
Windoof-User
Windoof-User
Beiträge: 25
Registriert: 24. Mai 2004 20:09
Wohnort: Darmscht
Kontaktdaten:

Re: Assignment 2, task 2

Beitrag von Aaron »

sewe hat geschrieben:@Aaron, sproksch: I'll try to give a more gentle introduction to Haskell during Prof. Mezini's absence. I like the language a lot and it would be a pity if you remember it as as "trial and error rollercoaster". :(
That's great, because I - too - found Haskell pretty sympathetic for its expressive idioms. I love that, in fact!
But in the matter of this opaque type system, it became kind of a Has-Liebe, kell? ;) (Please excuse the particularly bad pun. Thank you!)

So I'm looking forward to getting to know Haskell better; see you soon!
If there's one thing I've learned in all my days ... it's that if knowledge is power, then the internet is full of completely useless power. Think about it. —Brett Erlich

Antworten

Zurück zu „Archiv“