#haskell - Mon 26 Feb 2007 between 03:03 and 03:11



jqlnever seen someone use Haskell as their first *or* second language. :)
MP0is there a way to declare a data type in a let statement? I've tried "let data AAA = A | B | C deriving (Eq, Ord) in (A<B)"
emuno
donsjql, it was my first language :-)
ddariusjql: Occasionally if they get it in a university.
donsand thousands of others at unsw, actually. or chalmers, or oxford, or ...
MP0is there a reason why that's not possible?
ddariusdons: In my experience, they tend not to be the ones that stay.
jqlis there an inverse first-language-BASIC rule in effect? does learning haskell first cripple you with regard to learning more primitive languages? :)
donsMP0, types (which is what you're declaring), are at the top level of a module
ddarius: that's true.
sjanssenMP0: it's a little tricky, what is the type of "let data A = A in A"?
MP0hmm, I was hoping if it derived Ord, it would be 0 or 1
donsif you derive Enum
> fromEnum True
lambdabot1
MP0sorry, Enum
jqlEvery Haskell program I've written feels more like writing a maths proof than an imperative progrem
dons> fromEnum LT
lambdabot0
donsjql, maybe you write the wrong kind of haskell program?
jqlI can't picture going from that to... say, VB
sitiwrite a gui app :D
ddariusjql: You are writing a logical proof.
jqlno, I meant that in the good way. :)
donshere's some imperative haskell :-) http://www.cse.unsw.edu.au/~dons/code/nobench/bin/bench.hs
ddariusThat said, writing Haskell feels like neither to me.
dons(that's a testsuite driver)
quick hack
jqlI don't want to write another kind of Haskell program. I'm trying to escape the finger-diarrea of other languages
araujohello
sitienough indentation?
donsjust a little
just to say, you can hack perlish scripts in haskell too ;) but they'll have data types in them
sjanssenMP0: I think the answer to your question is a cost vs. benefit issue. Let scoped data decls are rarely (never?) needed, and they'd be quite complicated to describe in the standard
MP0ah. My only issue is that it makes it impossible to play with in ghci
so I've changed over to writing into a text file
sjanssenMP0: that is the recommended workflow with ghci or hugs
type the definitions in a file, then :load the file and explore
actionddarius doesn't say something about Church encoding data types into functions...
ddariusdoesn't say something about Church encoding data types into functions...

Page: 2 9 16 23 30 37 44 51 58 65 72 79 86 93 

IrcArchive