Live data from Hacker News

Becoming Productive in Haskell

mechanical-elephant.com

101–110 of 213 posts

Re: Becoming Productive in Haskell

#101
I really like Haskell, but one of the main problems I've had (that I don't see many people cite) is that the libraries just aren't made for use under serious load/concurrency. Many of the people that have written these libraries, and use them are not using them in high-performance, memory-sensitive areas (production use at companies).

There are Haskell libs of course that are used in these environments, and the companies usually end up fixing them such that they're quite good. Most libs used by pandoc are likely to be great, and there's a few dozen others of the same caliber (its useful to search around and see what libs are used by the other few companies using Haskell since they have likely been vetted as well).

The other largest issue to actually using Haskell is that all the knowledge your ops team has of running a production system are essentially null and void. All your existing knowledge of how to fix performance issues, null and void. Learning Haskell and becoming productive in it almost starts to look like the easy part compared to effectively running a Haskell (dealing with space leaks, memory fragmentation issues, and ghc tuning for stack sizes, allocations, etc).

Re: Becoming Productive in Haskell

#102
post #49
post #46

Earlier quoted context omitted.

That Either is Mappable is, IMO, both clearer and more informative than that it's a Functor.

Maybe someone can correct me here, but that kind of approach seems ill-founded to me when after a couple examples, people are already talking about different things using the same terminology. The article says "A list is a Functor". Now you're saying "Either is a Functor". But those two things don't have the same nature. Maybe what the author meant "The [] list constructor is a Functor"? I'm not sure what is gained b…

"Either" actually isn't a Functor, at least in Haskell

In Haskell, a Functor actually consists of two parts: The type itself (f), which 'transforms' a type a into type "f a". ie. Maybe "applied" to Int gives "Maybe Int", a new simple type (let's handwave kinds away for now). In addition to that, the fmap function is required for Maybe to be a Functor. A Functor is defined by this ability to "add structure" to existing types and the mapping operation.

Seen this way, Either is clearly not a Functor: "Either Int" is not a simple type. However, "Either Int" is a functor: Either Int String forms a simple type, and you can implement fmap. In fact, that works for any type, so "Either a" is the functor as usually defined in Haskell.

Re: Becoming Productive in Haskell

#103
post #87

Earlier quoted context omitted.

I didn't try to say that Haskell is the best language for everything. I also wouldn't want to do everything in Haskell. But as you are pointing out, you learned a lot from Haskell and you are using its lessons in production. The best a language can do is to fill a niche and to be very good at that particular thing. You should always use the language that is most suited for your problem, whatever that is. But there ar…

> I also wouldn't want to do everything in Haskell. Examples, please? And why?

If you have an array that fills a significant fraction of your memory (say, tens of Gigabytes), you don't have another choice but to use mutation (Haskell doesn't support that).

While quite fast, it is not in the league of low level programming languages. If you need ridiculous speeds, you don't have another choice but to use C, C++ or Fortran.

Python has a lot of very useful modules. If I can solve my problem with basically a few import statements and don't care about performance or anything, I find Python to be better suited.

Erlang's light-weight threads are a boon. Having a webserver written in Erlang and using Erlang as a server-side language, you can support a lot of sessions at once.

Re: Becoming Productive in Haskell

#104

The author's comments on noise chime true with me: every time I give Haskell a try I end up struggling with frustrating and opaque vocabulary, sometimes completely at odds with the way other languages use them: e.g. C++ also has functors, and they're completely unrelated to Haskell functors. I really like the author's suggestion of mentally translating Functor to Mappable. Are there any other synonyms for other Haske…

Functors and monads are somewhat not going to change their names, partly because Haskell derives from math and those are what they're called over there. But foldl' is horrible, I agree.

foldl' is a consistent and meaningful name. fold performs a fold without specifying an order[1], foldl folds from the left, and foldl' is a non-lazy version of of foldl.

1: fold :: (Foldable t,Monoid m) => t m -> m

Re: Becoming Productive in Haskell

#105
post #4

> So, I started calling it Mappable. Mappable was easy for me to remember and was descriptive of what it did. A list is a Functor. A list is Mappable. I wish there was a language or library that was willing to take the Haskell functionality and just give it all names like this.

> I wish there was a language or library that was willing > to take the Haskell functionality and just give it all > names like this. I don't think this helps understanding that - for example - Either is also a functor.

`Either a` is a functor, not Either. I agree with the rest of your point, though. Maybe might be a better example - similar in spirit to Either, but without requiring an application to get a functor.

Re: Becoming Productive in Haskell

#106
I've got a side project webapp I'd like to use to learn some Haskell. What is the most mainstream Rails-like web application framework out there? By Rails-like I mostly mean convention-over-configuration, with a strong ecosystem of plugins so I don't have to re-invent the wheel for auth, file uploads, etc. So far I've seen:

- Yesod

- Snap

- Happstack

- Scotty

- Spock

Right now I'm learning Yesod, but I don't feel confident that's really what I want. Which of these are closest to Rails? Which are closest to Sinatra?

Re: Becoming Productive in Haskell

#107
post #30

Scripting languages try to seduce you to just fiddle around until the output looks like something you want. While that quickly gives you some results, I think it's a huge roadblock in the mid- to longterm. Especially when programmers are only familiar with "easy" scripting languages, there are rarely insights about the general approach to the problem until the project already grew to become an abomination. While fidd…

IIRC, the Show class is supposed to be the reverse of the Read class -- so you should not use it to pretty print stuff.

This split was learnt from in Rust, and Rust has both the Debug class (which is the inverse of Read) and a Display typeclass for showing nice versions of things.

Re: Becoming Productive in Haskell

#108

The author's comments on noise chime true with me: every time I give Haskell a try I end up struggling with frustrating and opaque vocabulary, sometimes completely at odds with the way other languages use them: e.g. C++ also has functors, and they're completely unrelated to Haskell functors. I really like the author's suggestion of mentally translating Functor to Mappable. Are there any other synonyms for other Haske…

Functors and monads are somewhat not going to change their names, partly because Haskell derives from math and those are what they're called over there. But foldl' is horrible, I agree.

I mentally pronounce foldl' as "fold ell prime," and it never gives me any difficulty.

Re: Becoming Productive in Haskell

#109

I've got a side project webapp I'd like to use to learn some Haskell. What is the most mainstream Rails-like web application framework out there? By Rails-like I mostly mean convention-over-configuration, with a strong ecosystem of plugins so I don't have to re-invent the wheel for auth, file uploads, etc. So far I've seen: - Yesod - Snap - Happstack - Scotty - Spock Right now I'm learning Yesod, but I don't feel con…

Yesod would be the closest to Rails.

Scotty would be closer to Sinatra and Flask. Spock is similar to Scotty but comes with a few more built-in features like type-safe routing, sessions, etc.

I recommend Yesod but there are certainly some advanced metaprogramming features (routing, models).

Have you checked out the Yesod scaffold site? https://github.com/yesodweb/yesod-scaffold

Re: Becoming Productive in Haskell

#110

I really like Haskell, but one of the main problems I've had (that I don't see many people cite) is that the libraries just aren't made for use under serious load/concurrency. Many of the people that have written these libraries, and use them are not using them in high-performance, memory-sensitive areas (production use at companies). There are Haskell libs of course that are used in these environments, and the compa…

Could you name some of these libraries? IME, most of the libraries that are needed for common things are very mature.
Post reply on HN