
3d scene representation in Haskell - zik
http://devskypers.blogspot.com/2014/07/lost-in-space.html
======
orangeduck
I think this demonstraights a real weakness of Haskell. Several times I've
started a new project only to spend several hours trying to work out the
correct way to structure what I want. Often it is hours before I even get my
first successful compile. This is exactly as shown in this blog post. While
some people enjoy this kind of tinkering, for me this really quickly saps all
my motivation for the task. I just want to get something, anything, working. I
work best jumping directly into a task and understanding it from the inside
out, learning from my mistakes. Sometimes if I do find a quick and dirty way
to get something working in Haskell - often refactoring it also becomes pretty
difficult - which turns me off again. Neither of these are problems I have in
other languages.

Arguments for which approach is better aside, it is no wonder lots of people
who learn and approach tasks like me, feel a little betrayed by Haskell. I've
used it for a bunch of things, I'm past the steep learning curve - but it
seems I'm still not reaping the rewards. Is my philosophy of jumping into
projects really so bad? Is it Haskell's place to question such an approach,
when it has served me so well elsewhere?

~~~
reikonomusha
I agree.

Haskell enforces a programmer to create structure. There's no way around it.
And it's (nearly) impossible to hack things together without failing early and
often.

As a result, before the problem you're trying to solve can be explored, you're
stuck making guesses on how the problem should even be structured. You spend a
few hours with one guess, it turns out to not get your far, and you try
another.

The unfortunate part is that these guesses aren't letting you get to the meat
of the problem effectively; you're stuck trying to solve a _meta-problem_.

Of course, once you have solved the meta-problem well enough, you can start
exploring your problem. Unfortunately, you may find that your meta-solution
doesn't actually let you answer questions you didn't know you wanted to answer
from the get-go, and now you're back to square-one.

When everything is right, the program is usually very beautiful, safe, and—if
you're skilled enough—efficient.

Perhaps not all Haskell programmers have this issue for very non-trivial
programs, though I certainly do.

~~~
lclarkmichalek
I don't really agree. The greatest structure in most of my Haskell programs is
some kind of ErrorT or something. That requires me to structure the way I
handle IO and the way that Errorable things happen, but beyond that, `a` is
just as generic as any Python type. Sure, a lot of libraries do require you to
accept certain premises, which may be a problem, but most of them provide ways
to break out of their abstractions: ErrorT provides `runErrorT :: (Monad m,
Error e) => ErrorT e m a -> m (Either e a)` which allows me to break out very
easily, and due to the composable nature of Haskell, even if the library does
not provide a function, it is often far from hard to write one yourself.

------
wyager
This is the "problem" with haskell. It makes you have a reasonably good model
before you can even codify it.

You have to front-load all the whiteboarding. Everything is easier (and
usually bug-free) after that.

There have been many times where my inability to codify a mental model in
haskell made me realize why that mental model was inherently wrong/unsafe.

------
hawkharris
A very small tip for people learning Haskell (coming from a fellow newcomer to
the language): as you read the code, mentally replace "::" with "has type of."

------
damncabbage
I think there may be a typo with the first example:

    
    
      newtype ID a = ID Int deriving (Eq,Ord,Show)
    

Should possibly just be:

    
    
      newtype ID a = ID a deriving (Eq,Ord,Show)

~~~
edwardkmett
Nah, it is a type of numeric ID's for different types of things. The parameter
'a' is just a phantom type parameter to keep you from mixing up a mesh ID with
a texture ID.

------
lobster_johnson
Lots of good discussion in this thread -- but no suggestions relevant to the
author's problem. Is there a better solution?

