[Haskell-cafe] Re: Is there anyone out there who can translate C# generics into Haskell?

Achim Schneider barsoap at web.de
Sun Jan 6 13:48:13 EST 2008


Jonathan Cast <jonathanccast at fastmail.fm> wrote:

> On 6 Jan 2008, at 2:13 AM, Achim Schneider wrote:
> 
> > Jonathan Cast <jonathanccast at fastmail.fm> wrote:
> >
> >> On 4 Jan 2008, at 2:00 AM, Nicholls, Mark wrote:
> >>
> >>> You may be right...but learning is not an atomic
> >>> thing....wherever I start I will get strange things happening.
> >>
> >> The best place to start learning Haskell is with the simplest type
> >> features, not the most complicated.  And it's the simplest features
> >> that are most unlike OO.
> >>
> >> Yes, Haskell will be `strange'.  But if you think you're `the
> >> intersection' between Haskell and OO, you'll think things are
> >> familiar, and you'll be surprised when they turn  out to be
> >> different.  I'd concentrate on watching out for differences --- but
> >> then I can't imagine how finding `familiar' ideas would help.
> >>
> > just a sec...
> >
> > things like
> 
> <C++ translated into Haskell>
> 
> > come to mind.
> >
> > But then this has more to do with Monads than with classes. IO, in
> > particular, and GL and GLUT, which are state machines and
> > thus predestined for OOP.
> 
> Your example is very unintuitive and unidiomatic Haskell.  The  
> reference to GL makes me think this is for a `low-level' binding to  
> an imperative library, no?  Those are scarcely good places to learn  
> Haskell.
> 
Well, I learnt a lot, knowing GL quite well already and seeing how easy
everything fit together and how easy it was to abstract things away,
like stuffing a bunch of IO actions consisting of GL primitives into a
map, automatically generating and managing display-lists... 

I don't speak C++, btw, just C and Java.

You can't just take years of programming experience and then start
again with calculating Fibonacci numbers, just this time implemented
functionally... There's always this creepy feeling that you understand
everything, although you didn't understand a thing. 

Shivers run down my spine when I think about how 

    let amb = 0.2
        ambm = 0.2
        spec = 0.7
    preservingMatrix $ do
        materialDiffuse FrontAndBack $= Color4 ambm ambm ambm 0.3
        materialSpecular FrontAndBack $= Color4 spec spec spec 0.7
        materialShininess FrontAndBack $= 50
        border 30 40 (depth * 10) 0.01 True

looks like in C.

or, for that matter, what atrocious code gcc generates if you
parametrise calls to vertex3f with functions.

-- 
(c) this sig last receiving data processing entity. Inspect headers for
past copyright information. All rights reserved. Unauthorised copying,
hiring, renting, public performance and/or broadcasting of this
signature prohibited. 



More information about the Haskell-Cafe mailing list